Page MenuHomePhabricator

Add Extension:Variables to en.wikiversity
Closed, DeclinedPublic


Please add Extension:Variables ( to en.wikiversity. The community supports this request, per .


Event Timeline

Dave_Braunschweig raised the priority of this task from to Needs Triage.
Dave_Braunschweig updated the task description. (Show Details)
Dave_Braunschweig subscribed.

This is unlikely to happen. Variables has been rejected in the past, and I'm given to understand would cause large problems for certain extensions (VisualEditor)

Thanks for the fast response. Are there any alternatives that might provide similar functionality?

Thanks for the fast response. Are there any alternatives that might provide similar functionality?

To be clear, my previous comment wasn't an "official" rejection. I just think its super unlikely to happen.

Can you give me an example of the types of things you want to do, but can't currently?

Generally parsoid people have been opposed to adding any extensions that allow for "global state" within a page.

We have a number of pages where we have sequential numbers on content, but the numbers need to sent to templates to be rendered rather than numbering the content using #. Some pages may have as many as 40 or 50 of these items, and they are currently maintained manually. I was hoping to use variables to automate the counting. I tried Lua, but each #invoke is a clean state.

Looking around, perhaps the Lua GetContent method could be used. It would be a lot more processing, but might work as an alternative.

@Dave_Braunschweig could you give some sample URLs to illustrate your explanation?

See . The review questions are numbered both internally (hidden tag) and visually for the user. It would be nice to have a variable that could be used for both numbers and incremented through code rather than typed manually.

The same is true for pages where we use flashcards, such as . At present, each flashcard is numbered manually.

This type of code is used on several hundred pages at en.wv.

The following markup could ensure that:


Could you give a try to such markup and see if you can style it and offer your spoiler system?

Thanks for the suggestion. But there's more to it than just HTML formatting. The numbers are used as div IDs to hide and show each answer individually. The div could likely be converted to a span, but that doesn't resolve the issue of numbering them uniquely on the page so they can be triggered individually.

If page variables can't be enabled, they can't be enabled. I've written local Word macros I use to generate the content as a work-around, but it doesn't help others edit these or similar pages.

@matmarex would you have some idea of the ideal markup here?

Hello, sorry for late reply.

As it was pointed out earlier, using the HTML tags <ol>/<li> is a good start. (Unfortunately, wikitext list syntax doesn't work for content spanning multiple lines.) I did it for the page you linked, as an example:

You can actually create custom toggles for <div class="mw-collapsible> that don't require giving each one a manual id, like this:

<div class="mw-collapsible">
  <div class="mw-collapsible-toggle">Toggle</div>
  <div class="mw-collapsible-content">Collapsible content</div>

Clicking the mw-collapsible-toggle will hide the corresponding mw-collapsible-content, that has to be contained within the same mw-collapsible element.

I created a simple template to wrap this on Wikiversity: (please tweak/categorize/document, I'm not sure what your template conventions are) – it also has style="float: none;" on the toggle, since it has some weird floating by default which is not desirable in this case.

And I used it in that same article:

I think you could use something very similar for the flashcards example.

Does this do everything you need? Hopefully we can avoid the Variables extension :)

Yes, that resolves this issue. I took the code and put it into a different template:

This version wraps the remaining HTML tags, embeds the style, and makes the parameters positional for easier end-user development. Something similar will work for the flashcards, and eventually I'll create a Lua module to replace the switch.

Are the mw- classes documented somewhere? I sense there are many things we could be taking advantage of, if we only knew they existed.


There is some documentation at
, but neither seems to include this in particular. :/

There's also
, which we used at some point when developing this functionality, and which
should actually contain everything that can be done with mw-collapsible and
related classes. It's just examples though, with little explanation. :/

matmarex claimed this task.

I'll close this, since we won't be needing Variables hopefully. :)