ILIAS
trunk Revision v11.0_alpha-1749-g1a06bdef097
|
Class for processing of latex formulas This class uses a sigleton pattern to store the rendering purpose during a request. More...
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, factory(), and init().
ilMathJax::clearCache | ( | ) |
Clear the cache of rendered graphics.
Definition at line 457 of file class.ilMathJax.php.
References factory().
ilMathJax::getCacheSize | ( | ) |
Get the size of the image cache.
Definition at line 449 of file class.ilMathJax.php.
References factory().
|
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().
|
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.
Referenced by ILIAS\Wiki\Export\WikiHtmlExport\buildExportFile(), ilMathJaxSettingsGUI\clearCache(), ilMathJaxSettingsGUI\editSettings(), ILIAS\components\Export\HTML\Util\exportCOPageFiles(), ilAssSelfAssessmentQuestionFormatter\format(), ILIAS\components\ILIAS\Glossary\Table\TermListTable\getDataRetrieval(), ilPresentationTableGUI\getShortTextForTerm(), ilGlossaryTermGUI\output(), ilForumExportGUI\prepare(), ilForum\prepareText(), ilLegacyFormElementsUtil\prepareTextareaOutput(), assQuestionGUI\prepareTextareaOutput(), ilForumExportGUI\printPost(), ilForumExportGUI\printThread(), and ilPageObjectGUI\showPage().
ilMathJax::includeMathJax | ( | ?ilGlobalTemplateInterface | $a_tpl = null | ) |
Include the Mathjax javascript(s) in the page template.
Definition at line 258 of file class.ilMathJax.php.
References factory().
Referenced by init().
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 includeMathJax(), null, setEngine(), and setRendering().
Referenced by __construct().
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 283 of file class.ilMathJax.php.
References renderMathJax(), ilStr\strIPos(), ilStr\strLen(), and ilStr\subStr().
|
protected |
Render image from tex code using the MathJax server.
Definition at line 371 of file class.ilMathJax.php.
References $default_server_options, $dpi, Vendor\Package\$e, $server, and factory().
Referenced by insertLatexImages().
ilMathJax::setDpi | ( | int | $a_dpi | ) |
Set the dpi of the rendered images.
Definition at line 240 of file class.ilMathJax.php.
|
protected |
Set the Rendering engine.
Definition at line 201 of file class.ilMathJax.php.
Referenced by init().
ilMathJax::setRendering | ( | string | $a_rendering | ) |
Set the image type rendered by the server.
Definition at line 219 of file class.ilMathJax.php.
Referenced by init().
ilMathJax::setZoomFactor | ( | float | $a_factor | ) |
Set the zoom factor of the rendered images.
Definition at line 249 of file class.ilMathJax.php.
|
staticprotected |
Definition at line 56 of file class.ilMathJax.php.
|
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.
|
protected |
Definition at line 51 of file class.ilMathJax.php.
const ilMathJax::ENGINE_CLIENT = 'client' |
Definition at line 38 of file class.ilMathJax.php.
const ilMathJax::ENGINE_DEFERRED = 'deferred' |
Definition at line 39 of file class.ilMathJax.php.
const ilMathJax::ENGINE_NONE = 'none' |
Definition at line 40 of file class.ilMathJax.php.
const ilMathJax::ENGINE_SERVER = 'server' |
Definition at line 37 of file class.ilMathJax.php.
|
protected |
Definition at line 48 of file class.ilMathJax.php.
|
protected |
Definition at line 47 of file class.ilMathJax.php.
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\components\Export\HTML\Util\exportCOPageFiles(), and ilForumExportGUI\prepare().
const ilMathJax::PURPOSE_PDF = 'pdf' |
Definition at line 33 of file class.ilMathJax.php.
const ilMathJax::RENDER_PNG_AS_FO_FILE = 'png_as_fo_file' |
Definition at line 45 of file class.ilMathJax.php.
const ilMathJax::RENDER_PNG_AS_IMG_EMBED = 'png_as_img_embed' |
Definition at line 44 of file class.ilMathJax.php.
const ilMathJax::RENDER_SVG_AS_IMG_EMBED = 'svg_as_img_embed' |
Definition at line 43 of file class.ilMathJax.php.
const ilMathJax::RENDER_SVG_AS_XML_EMBED = 'svg_as_xml_embed' |
Definition at line 42 of file class.ilMathJax.php.