rw-moore / SciLO

GNU General Public License v3.0
0 stars 0 forks source link

Conditional Rendering in Question Text XML #115

Closed corlick98 closed 2 years ago

corlick98 commented 2 years ago

Is your feature request related to a problem? Please describe. Interest was expressed in being able to render parts of the question text only if a condition is met. For example: you have variables a and b that can be positive or negative and you want to render an+b without conditional rendering the current system will display this as 3n+-5 if b is negative. Being able to control whether the + is rendered based on the value of b would help this issue.

Describe alternatives you've considered When using maxima you can set g: a*n+b and it will render correctly most of the time unless b is positive and a is negative where it will render as 3 - 9n

Additional context A possible structure for the xml is described here https://stackoverflow.com/questions/6061470/if-then-else-using-xml

corlick98 commented 2 years ago
<if>
<condition test="is(roots(p)=5)">--if
something
</condition>
<condition test="is(roots(p)=4)">--else if
something
</condition>
<condition test="true">--else
something
</condition>
</if>
bohungi commented 2 years ago

Confirmed: This is working!