Page MenuHomePhabricator

Add Extension:Variables to en.wikiversity
Closed, DeclinedPublic

Description

Please add Extension:Variables (https://www.mediawiki.org/wiki/Extension:Variables) to en.wikiversity. The community supports this request, per https://en.wikiversity.org/wiki/Wikiversity:Colloquium#Extension:Variables .

Thanks!

Event Timeline

Dave_Braunschweig raised the priority of this task from to Needs Triage.
Dave_Braunschweig updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 26 2015, 7:22 PM

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)

Bawolff set Security to None.
Restricted Application added a subscriber: Matanya. · View Herald TranscriptSep 26 2015, 7:26 PM

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.

revi added a subscriber: revi.

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

See https://en.wikiversity.org/wiki/IT_Fundamentals/Hardware#Review_Questions . 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 https://en.wikiversity.org/wiki/Windows_Server_Administration/Introduction/Lesson_flashcards . At present, each flashcard is numbered manually.

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

Dereckson added a comment.EditedNov 26 2015, 12:46 AM

The following markup could ensure that:

<ol>
  <li>
    <span>question</span>
    <span>answer</span>
  </li>
  <li>
    <span>question</span>
    <span>answer</span>
  </li>
</ol>

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

Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptNov 26 2015, 12:46 AM

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: https://en.wikiversity.org/w/index.php?title=IT_Fundamentals/Hardware&diff=1495207&oldid=1485870

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>
</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: https://en.wikiversity.org/wiki/Template:Collapsible_toggle_and_content (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: https://en.wikiversity.org/w/index.php?title=IT_Fundamentals/Hardware&diff=1495223&oldid=1495207

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:
https://en.wikiversity.org/wiki/Template:Review_question

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.

Thanks!

There is some documentation at
https://www.mediawiki.org/wiki/ResourceLoader/Modules#jquery.makeCollapsible
and
https://www.mediawiki.org/wiki/Manual:Collapsible_elements#jQuery.makeCollapsible
, but neither seems to include this in particular. :/

There's also
https://test.wikipedia.org/wiki/User:Krinkle/Test_suite_for_mw-collapsible
, 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 closed this task as Declined.Jan 4 2016, 2:58 AM
matmarex claimed this task.

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