Be able to hide/show numbers and apply style to numbers in Quiz
Open, NormalPublic

Description

We should be able to apply styles or hide/show all of the numbers in the Quiz.

Is there a reason the numbers are in spans instead of a <ol> tag? It would be a fairly simply matter to just do .myclass .ol or .myclass .li and apply styles to the list in the enclosed quiz. (If you do that to span, then it would change a lot of different things)

Alternatively we can add the class to the <span> i.e. <span class = 'enumeration'> I guess.

Doing this in <ol> would also fix T170798, but I wonder if the original author had a reason for doing it this way.

Mvolz created this task.Jul 17 2017, 5:34 PM

Change 368338 had a related patch set uploaded (by Harjotsingh; owner: Harjotsingh):
[mediawiki/extensions/Quiz@master] Add enumeration class to question id field

https://gerrit.wikimedia.org/r/368338

Each question is separately called using parseQuestion function.
Inside parseQuestion the number is added inside span by keeping track Question Id.
It would not be possible in this setup to use ol tags.

I've added enumeraton class to the span.

Harjotsingh added a comment.EditedSat, Aug 5, 1:47 PM

I think you mentioned this for passing style

questionID="display:none";

for disabling question numbering for particular questions.

Where should we pass this ?

Current quiz format being

<quiz >

// Individual questions 

</quiz>
Mvolz added a comment.Sat, Aug 5, 1:57 PM

I think you mentioned this for passing style

questionID="display:none";

for disabling question numbering for particular questions.

Where should we pass this ?

Current quiz format being

<quiz >

// Individual questions 

</quiz>

In the quiz tag, i.e. <quiz questionID="display:none;" words="color:red;" > etc but I'm not 100% on this.

Mvolz added a comment.EditedSat, Aug 5, 2:00 PM

Before we talked about just included a block of CSS, but as you mentioned before there are security implications for the rest of the page from doing that... but maybe we could parse it?

So like <quiz
css ="

.questionID {

color:red;

}

"

But we'd have to validate it and it might get very complicated to do that.

Mvolz added a subscriber: Reedy.Sat, Aug 5, 2:01 PM

@Reedy any thoughts?

As we're passing classnames with styles , can all this be combined into 1 attribute having these values as key-value pair
(this can extend functionality of T172593 ) or do we simply add these as individual parameters ?

Currently there are 2 classes in this example, but if we add want more classes to be configurable then having different quiz attribute for each can be long :)

Change 368338 abandoned by Harjotsingh:
Add enumeration class to question id field

Reason:
Abandoning this patch as this needs discussion

https://gerrit.wikimedia.org/r/368338

Adding T172593 as parent task as this can't be done with CSS only.