Page MenuHomePhabricator

Dynamically generate files with Scribunto
Open, LowPublic


Currently, we have modules that create pie charts by stacking divs with very thick, differently-colored borders, as well as ones that do even crazier things. Perhaps Scribunto should be given a {{#invokefile:foo|bar}} syntax (or something), where the output returned by the module is treated as contents of an image (or in theory, even other types of files, such as audio). Primarily, I see this being used to make SVGs, as a replacement for the HTML hacks used to create "images" today. We can already have dynamic file generation with Extension:Math, so it should be feasible to do with Scribunto as well.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:23 AM
bzimport set Reference to bz64460.
bzimport added a subscriber: Unknown Object (MLST).

Change 113759 had a related patch set uploaded by Jackmcbarn:
Support for modules-as-images

This could also replace EasyTimeline, see bug 27156, bug 60263, bug 35320.

The reason I used the [[File:Module:XXX]] syntax for the prototype, is, that it enables these scripts to be used whereever images can currently be used. It was important to me that it worked with Extension:ImageMap, since that is necessary if we want to replace EasyTimeline.

SiBr4 added a subscriber: SiBr4.Feb 28 2015, 10:37 AM
JanusTroelsen added a comment.EditedSep 9 2015, 5:33 PM

I have another implementation strategy idea. We could let the module generate iframe data that would be embedded by base64'ing it. Since iframes do not allow scripting per default ( and the data would not be linkable, this would allow for manually made image-maps in SVG's but still retain security. Old browsers that run scripts in iframes per default, would need mitigation. The format of code in the module could be the same as my previous patch, but a new parser function would be needed. What do you think?

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 9 2015, 5:33 PM

MediaWiki-extensions-Graph should now cover most use cases. However, any imperative language is still a breath of air compared to Vega's declarative syntax.

Ebraminio added a subscriber: Ebraminio.
Yurik added a subscriber: Yurik.Jan 11 2017, 7:20 AM

I think we should reject this task, because Lua can already generate <graph>...</graph> chart -- that's what Template:Graph:Chart actually does, or, better yet, use one of the templates like Pie from row or Line chart to plot data directly from a dataset table on Commons.

There are more to files than just graphs.

Yurik added a comment.Jan 11 2017, 6:49 PM

@Anomie of course, but we should be very clear about listing the usecases that cannot be currently solved in any other way.