## Text editors

### Clean the html things in the editor

Clean the html things in the editor

Hi,

I need to insert formula into editor of calculated question, like:

"ΔS1= {nx}*2.09*log(273.15/{T1x}) + {nx}*0.126*(273.15-{T1x}J/K = {=({nx}*2.09*log(273.15/{T1x}) + {nx}*0.126*(273.15-{T1x}))}"

However, the formula "{=({nx}..." can not be evaluated due to multiple html marks in the source code spoiling the formula string, like

"&nbsp;<span style="color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; wo"

Is there a smooth way to clean all html marks/tags/commands from the html source ?

Average of ratings: -
Re: Clean the html things in the editor

Hi Miro,

I opened the equation editor here ($$\sqrt\alpha$$) and then copied and pasted your equation above into the text box there. After putting in a little extra TeX notation it looks like this

\begin{align}\Delta S_1&= {n_x}*2.09*\log(\frac{273.15}{T_1x}) + {n_x}*0.126*(273.15-{T_1x}) J/K\\&= ({n_x}*2.09*\log(\frac{273.15}{T_1x}) + {n_x}*0.126*(273.15-{T_1x}))\end{align}.

Using TeX notation is usually the best way to display mathematics in Moodle. Although I think I messed the chemistry up.

Daniel

Average of ratings: -
Re: Clean the html things in the editor

Actually I think I misunderstood your question. If you are using calculated question type the problem has to do with the notation used in that question. The HTML is not the problem, but the braces used in mathematics which are interpreted as the calculated question type delimiter. You might be able to escape them, but it is probably better if you could use one of the another question type like algebra, formula or STACK that are more compatible.

Average of ratings: -
Re: Clean the html things in the editor

Hi Daniel,

the problem is that the "clean", working formula,  {=({nx}*2.09*log(273.15/{T1x}) + {nx}*0.126*(273.15-{T1x}))}", sometimes gets spoiled with html things, giving something like

{=(<span>{nx}*2.09*...+<span>....

Manual cleaning in the HTML window is tedious. The "Tx" buttton does not always work for removing the HTML stuff from formula string.

Average of ratings: -
Re: Clean the html things in the editor

Hi Miro,

In the editor cut the expression you want to clean, then click HTML source button, and paste it in again there. The browser only will paste text content into the text box.

If you need this a lot, you may install the Paste special plugin.

Daniel

Average of ratings: Useful (2)