Deepu Sasidharan
Deepu Sasidharan

Reputation: 5309

Display equations using wiris in Div in Moodle

I am using wiris plugin for tinyMCE editor in Moodle. Using the wiris editor I type some equations. But these equations are inserted in database as

<p>«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«msup»«mi»x«/mi»«mn»4«/mn»«/msup»«/math»</p>

this format. And while display these in browser it display as same

<p>«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«msup»«mi»x«/mi»«mn»4«/mn»«/msup»«/math»</p>

But I have to display as: enter image description here

How can I do this? Please help me..

EDIT

My problem is the equation generated using WIRIS is displaying in tinyMCE editor as desired, but while displaying in div/span/table etc it display as

<p>«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«msup»«mi»x«/mi»«mn»4«/mn»«/msup»«/math»</p>

Please refer the image for more details.

enter image description here

Upvotes: 0

Views: 779

Answers (2)

user3306551
user3306551

Reputation:

Once enabled, our filter automatically converts safeXML to formula images in Moodle contexts without any additional logic. If you try creating a regular native Moodle question including a WIRIS formula and then preview it, using Moodle's default preview, the formula will show as an image.

If you are trying to display the formulas in a custom module you are building from scratch, the scenario is different. Are you filtering the content before displaying it? You need to use format_text() so that the filter parses the text you are displaying. Please check the code of /<moodle>/blocks/html/block_html.php and how format_text() is used. We also recommend that you check the Moodle filter documentation at https://docs.moodle.org/dev/Filters#A_note_about_performance

Upvotes: 1

user3306551
user3306551

Reputation:

Please note that if you are using WIRIS in Moodle our formula images are stored in your database as what we call safeXML, which is a slight modification of MathML replacing five characters (http://wiris.com/plugins/docs/resources/encoding-attributes).

However, you don't need any additional configuration for formulas to be displayed as images in Moodle. WIRIS filter automatically converts safeXML into formula images.

Please check that you have enabled WIRIS filter as detailed on step 3 at http://www.wiris.com/plugins/docs/moodle

Upvotes: 0

Related Questions