Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
filter_mathjaxloader Class Reference

Mathjax filtering. More...

Inheritance diagram for filter_mathjaxloader:
moodle_text_filter

Public Member Functions

 filter ($text, array $options=array())
 Override this function to actually implement the filtering. More...
 
 hash ()
 
 map_language_code ($moodlelangcode)
 
 setup ($page, $context)
 Setup page with filter requirements and other prepare stuff. More...
 

Protected Member Functions

 insert_span ($text, $start, $end)
 Wrap a portion of the $text inside a no link span (). More...
 
 wrap_math_in_nolink ($text)
 Find math environments in the $text and wrap them in no link spans (). More...
 

Protected Attributes

context $context
 The context we are in.
 
array $localconfig
 Any local configuration for this filter in this context.
 

Detailed Description

Mathjax filtering.

Member Function Documentation

◆ filter()

filter_mathjaxloader::filter (   $text,
array  $options = array() 
)

Override this function to actually implement the filtering.

Parameters
string$textsome HTML content to process.
array$optionsoptions passed to the filters
Return values
stringthe HTML content after the filtering has been applied.

Reimplemented from moodle_text_filter.

◆ insert_span()

filter_mathjaxloader::insert_span (   $text,
  $start,
  $end 
)
protected

Wrap a portion of the $text inside a no link span ().

The whole text is then returned.

Parameters
string$textThe text to modify.
int$startThe start index of the substring in $text that should be wrapped in the span.
int$endThe end index of the substring in $text that should be wrapped in the span.
Return values
stringThe whole $text with the span inserted around the defined substring.

◆ setup()

filter_mathjaxloader::setup (   $page,
  $context 
)

Setup page with filter requirements and other prepare stuff.

Override this method if the filter needs to setup page requirements or needs other stuff to be executed.

Note this method is invoked from {

See also
setup_page_for_filters()} for each piece of text being filtered, so it is responsible for controlling its own execution cardinality.
Parameters
moodle_page$pagethe page we are going to add requirements to.
context$contextthe context which contents are going to be filtered.
Since
Moodle 2.3

Reimplemented from moodle_text_filter.

◆ wrap_math_in_nolink()

filter_mathjaxloader::wrap_math_in_nolink (   $text)
protected

Find math environments in the $text and wrap them in no link spans ().

If math environments are nested, only the outer environment is wrapped in the span.

The recognized math environments are [ ] and $$ $$ for display mathematics and ( ) for inline mathematics.

Parameters
string$textThe text to filter.
Return values
arrayAn array containing the potentially modified text and a boolean that is true if any changes were made to the text.

The documentation for this class was generated from the following file: