|
ILIAS
release_8 Revision v8.24
|
Class for processing of latex formulas This class uses a sigleton pattern to store the rendering purpose during a request. More...
Collaboration diagram for ilMathJax:Public Member Functions | |
| init (string $a_purpose=self::PURPOSE_BROWSER) | |
| Initialize the usage for a certain purpose This must be done before any rendering call. More... | |
| setRendering (string $a_rendering) | |
| Set the image type rendered by the server. More... | |
| setDpi (int $a_dpi) | |
| Set the dpi of the rendered images. More... | |
| setZoomFactor (float $a_factor) | |
| Set the zoom factor of the rendered images. More... | |
| includeMathJax (ilGlobalTemplateInterface $a_tpl=null) | |
| Include the Mathjax javascript(s) in the page template. More... | |
| insertLatexImages (string $a_text, ?string $a_start='[tex]', ?string $a_end='[/tex]') | |
| Replace all tex code within given start and end delimiters in a text If client-side rendering is enabled, change the start end end delimiters to what Mathjax expects If Server-side rendering is used, replace the whole expression with delimiters by svg or image. More... | |
| getCacheSize () | |
| Get the size of the image cache. More... | |
| clearCache () | |
| Clear the cache of rendered graphics. More... | |
Static Public Member Functions | |
| static | getInstance () |
| Singleton: get instance for use in ILIAS requests with a config loaded from the settings. More... | |
| static | getIndependent (ilMathJaxConfig $config, ilMathJaxFactory $factory) |
| Get an independent instance with a specific config for use in unit tests or on the mathjax settings page Don't use in standard cases! More... | |
Data Fields | |
| const | PURPOSE_BROWSER = 'browser' |
| const | PURPOSE_EXPORT = 'export' |
| const | PURPOSE_PDF = 'pdf' |
| const | PURPOSE_DEFERRED_PDF = 'deferred_pdf' |
| const | ENGINE_SERVER = 'server' |
| const | ENGINE_CLIENT = 'client' |
| const | ENGINE_DEFERRED = 'deferred' |
| const | ENGINE_NONE = 'none' |
| const | RENDER_SVG_AS_XML_EMBED = 'svg_as_xml_embed' |
| const | RENDER_SVG_AS_IMG_EMBED = 'svg_as_img_embed' |
| const | RENDER_PNG_AS_IMG_EMBED = 'png_as_img_embed' |
| const | RENDER_PNG_AS_FO_FILE = 'png_as_fo_file' |
Protected Member Functions | |
| __construct (ilMathJaxConfig $config, ilMathJaxFactory $factory) | |
| Protected constructor to force the use of an initialized instance. More... | |
| setEngine (string $a_engine) | |
| Set the Rendering engine. More... | |
| renderMathJax (string $a_tex) | |
| Render image from tex code using the MathJax server. More... | |
Protected Attributes | |
| const | OUTPUT_SVG = 'svg' |
| const | OUTPUT_PNG = 'png' |
| const | DEFAULT_DPI = 150 |
| const | DEFAULT_ZOOM = 1.0 |
| ilMathJaxConfig | $config |
| ilMathJaxFactory | $factory |
| string | $engine |
| string | $rendering = self::RENDER_SVG_AS_XML_EMBED |
| string | $output = self::OUTPUT_SVG |
| int | $dpi |
| float | $zoom_factor |
| array | $default_server_options |
Static Protected Attributes | |
| static self | $_instance |
Class for processing of latex formulas This class uses a sigleton pattern to store the rendering purpose during a request.
The rendering purpose for export or deferred PDF generation must be determined at the beginning of a request. All following calls to convert latex code must use this purpose. Use init() to reset the purpose and all related settings.
Definition at line 29 of file class.ilMathJax.php.
|
protected |
Protected constructor to force the use of an initialized instance.
Definition at line 113 of file class.ilMathJax.php.
References $config, $factory, and init().
Here is the call graph for this function:| ilMathJax::clearCache | ( | ) |
Clear the cache of rendered graphics.
Definition at line 458 of file class.ilMathJax.php.
| ilMathJax::getCacheSize | ( | ) |
Get the size of the image cache.
Definition at line 450 of file class.ilMathJax.php.
|
static |
Get an independent instance with a specific config for use in unit tests or on the mathjax settings page Don't use in standard cases!
Definition at line 138 of file class.ilMathJax.php.
References $config, and $factory.
Referenced by ilMathJaxSettingsGUI\editSettings(), ilMathJaxTest\testClientSideRendering(), ilMathJaxTest\testInstanceCanBeCreated(), and ilMathJaxTest\testServerSideRendering().
Here is the caller graph for this function:
|
static |
Singleton: get instance for use in ILIAS requests with a config loaded from the settings.
Definition at line 123 of file class.ilMathJax.php.
References $_instance.
Referenced by ILIAS\Wiki\Export\WikiHtmlExport\buildExportFile(), ilMathJaxSettingsGUI\clearCache(), ilMathJaxSettingsGUI\editSettings(), ILIAS\Services\Export\HTML\Util\exportCOPageFiles(), ilPresentationListTableGUI\fillRow(), ilTermListTableGUI\fillRow(), ilCertificateMathJaxHelper\fillXlsFoContent(), ilAssSelfAssessmentQuestionFormatter\format(), ilForumExportGUI\prepare(), ilTCPDFRenderer\prepareGenerationRequest(), ilWkhtmlToPdfRenderer\prepareGenerationRequest(), ilForum\prepareText(), assQuestionGUI\prepareTextareaOutput(), ilLegacyFormElementsUtil\prepareTextareaOutput(), ilForumExportGUI\printPost(), ilForumExportGUI\printThread(), and ilPageObjectGUI\showPage().
Here is the caller graph for this function:| ilMathJax::includeMathJax | ( | ilGlobalTemplateInterface | $a_tpl = null | ) |
Include the Mathjax javascript(s) in the page template.
Definition at line 259 of file class.ilMathJax.php.
References $tpl.
Referenced by init().
Here is the caller graph for this function:| ilMathJax::init | ( | string | $a_purpose = self::PURPOSE_BROWSER | ) |
Initialize the usage for a certain purpose This must be done before any rendering call.
Definition at line 147 of file class.ilMathJax.php.
References DEFAULT_DPI, DEFAULT_ZOOM, ENGINE_NONE, includeMathJax(), OUTPUT_SVG, RENDER_SVG_AS_XML_EMBED, setEngine(), and setRendering().
Referenced by __construct().
Here is the call graph for this function:
Here is the caller graph for this function:| ilMathJax::insertLatexImages | ( | string | $a_text, |
| ?string | $a_start = '[tex]', |
||
| ?string | $a_end = '[/tex]' |
||
| ) |
Replace all tex code within given start and end delimiters in a text If client-side rendering is enabled, change the start end end delimiters to what Mathjax expects If Server-side rendering is used, replace the whole expression with delimiters by svg or image.
| string | $a_text | text to be converted |
| string | null | $a_start | start delimiter to be searched for |
| string | null | $a_end | end delimiter to be converted |
Definition at line 284 of file class.ilMathJax.php.
References ENGINE_CLIENT, ENGINE_DEFERRED, ENGINE_SERVER, renderMathJax(), ilStr\strIPos(), ilStr\strLen(), and ilStr\subStr().
Here is the call graph for this function:
|
protected |
Render image from tex code using the MathJax server.
Definition at line 372 of file class.ilMathJax.php.
References $default_server_options, $dpi, Vendor\Package\$e, $server, OUTPUT_PNG, OUTPUT_SVG, RENDER_PNG_AS_FO_FILE, RENDER_PNG_AS_IMG_EMBED, RENDER_SVG_AS_IMG_EMBED, and RENDER_SVG_AS_XML_EMBED.
Referenced by insertLatexImages().
Here is the caller graph for this function:| ilMathJax::setDpi | ( | int | $a_dpi | ) |
Set the dpi of the rendered images.
Definition at line 241 of file class.ilMathJax.php.
|
protected |
Set the Rendering engine.
Definition at line 202 of file class.ilMathJax.php.
References ENGINE_CLIENT, ENGINE_DEFERRED, ENGINE_NONE, and ENGINE_SERVER.
Referenced by init().
Here is the caller graph for this function:| ilMathJax::setRendering | ( | string | $a_rendering | ) |
Set the image type rendered by the server.
Definition at line 220 of file class.ilMathJax.php.
References OUTPUT_PNG, OUTPUT_SVG, RENDER_PNG_AS_FO_FILE, RENDER_PNG_AS_IMG_EMBED, RENDER_SVG_AS_IMG_EMBED, and RENDER_SVG_AS_XML_EMBED.
Referenced by init().
Here is the caller graph for this function:| ilMathJax::setZoomFactor | ( | float | $a_factor | ) |
Set the zoom factor of the rendered images.
Definition at line 250 of file class.ilMathJax.php.
|
staticprotected |
Definition at line 56 of file class.ilMathJax.php.
Referenced by getInstance().
|
protected |
Definition at line 61 of file class.ilMathJax.php.
Referenced by __construct(), and getIndependent().
|
protected |
Definition at line 96 of file class.ilMathJax.php.
Referenced by renderMathJax().
|
protected |
Definition at line 86 of file class.ilMathJax.php.
Referenced by renderMathJax().
|
protected |
Definition at line 71 of file class.ilMathJax.php.
|
protected |
Definition at line 66 of file class.ilMathJax.php.
Referenced by __construct(), and getIndependent().
|
protected |
Definition at line 81 of file class.ilMathJax.php.
|
protected |
Definition at line 76 of file class.ilMathJax.php.
|
protected |
Definition at line 91 of file class.ilMathJax.php.
|
protected |
Definition at line 50 of file class.ilMathJax.php.
Referenced by init().
|
protected |
Definition at line 51 of file class.ilMathJax.php.
Referenced by init().
| const ilMathJax::ENGINE_CLIENT = 'client' |
Definition at line 38 of file class.ilMathJax.php.
Referenced by insertLatexImages(), and setEngine().
| const ilMathJax::ENGINE_DEFERRED = 'deferred' |
Definition at line 39 of file class.ilMathJax.php.
Referenced by insertLatexImages(), and setEngine().
| const ilMathJax::ENGINE_NONE = 'none' |
Definition at line 40 of file class.ilMathJax.php.
Referenced by init(), and setEngine().
| const ilMathJax::ENGINE_SERVER = 'server' |
Definition at line 37 of file class.ilMathJax.php.
Referenced by insertLatexImages(), and setEngine().
|
protected |
Definition at line 48 of file class.ilMathJax.php.
Referenced by renderMathJax(), and setRendering().
|
protected |
Definition at line 47 of file class.ilMathJax.php.
Referenced by init(), renderMathJax(), and setRendering().
| const ilMathJax::PURPOSE_BROWSER = 'browser' |
Definition at line 31 of file class.ilMathJax.php.
Referenced by ilMathJaxSettingsGUI\editSettings().
| const ilMathJax::PURPOSE_DEFERRED_PDF = 'deferred_pdf' |
Definition at line 34 of file class.ilMathJax.php.
| const ilMathJax::PURPOSE_EXPORT = 'export' |
Definition at line 32 of file class.ilMathJax.php.
Referenced by ILIAS\Wiki\Export\WikiHtmlExport\buildExportFile(), ILIAS\Services\Export\HTML\Util\exportCOPageFiles(), and ilForumExportGUI\prepare().
| const ilMathJax::PURPOSE_PDF = 'pdf' |
Definition at line 33 of file class.ilMathJax.php.
Referenced by ilCertificateMathJaxHelper\fillXlsFoContent(), ilTCPDFRenderer\prepareGenerationRequest(), and ilWkhtmlToPdfRenderer\prepareGenerationRequest().
| const ilMathJax::RENDER_PNG_AS_FO_FILE = 'png_as_fo_file' |
Definition at line 45 of file class.ilMathJax.php.
Referenced by ilCertificateMathJaxHelper\fillXlsFoContent(), renderMathJax(), and setRendering().
| const ilMathJax::RENDER_PNG_AS_IMG_EMBED = 'png_as_img_embed' |
Definition at line 44 of file class.ilMathJax.php.
Referenced by ilTCPDFRenderer\prepareGenerationRequest(), renderMathJax(), and setRendering().
| const ilMathJax::RENDER_SVG_AS_IMG_EMBED = 'svg_as_img_embed' |
Definition at line 43 of file class.ilMathJax.php.
Referenced by renderMathJax(), and setRendering().
| const ilMathJax::RENDER_SVG_AS_XML_EMBED = 'svg_as_xml_embed' |
Definition at line 42 of file class.ilMathJax.php.
Referenced by init(), ilWkhtmlToPdfRenderer\prepareGenerationRequest(), renderMathJax(), and setRendering().