numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
199 stars 118 forks source link

Substitute variables into the alt attribute without eval-alt #922

Closed christianp closed 1 year ago

christianp commented 2 years ago

In HTML which has JME values substituted into it, such as the question statement, you can set an attribute on a tag from a JME expression by adding eval- to the attribute name.

For example, in

<p eval-class="{classname}"></p>

the class attribute will use the value of the classname question variable.

For images, the alt attribute is set by the rich text editor, but it'd be nice to have it sub in variable values instead.

So, in DOMcontentsubber.sub_element, I think that the attribute alt should have the same behaviour as attributes matching the regex eval-(.*)

lawrencetheabhorrence commented 2 years ago

Can I try for this issue?

christianp commented 2 years ago

@lawrencetheabhorrence thanks for offering! Please have a look at our guide on contributing to Numbas, and instructions on setting up a development environment

prakha commented 1 year ago

I see that this issue has been open for quite a while. So is it ok if I take this up?

christianp commented 1 year ago

Hi @prakha thanks for offering! Yes, please have a go at this.