Jackmcbarn wrote:
I'm interested in adding the ability to generate
files via Scribunto. The
first major decision that we need to make is how we'd use these files from
a wiki page. [...]
1. [[File:Module:Foo|bar=baz|width=200px]] - Module:Foo gets called to
generate the file
2. [[DynamicFile:Foo|bar=baz|width=200px]] - Module:DynamicFile/Foo gets
called to generate the file
3. [[File:Any file that doesn't exist.svg|bar=baz|width=200px]] -
Module:FileHandlers/Any file that doesn't exist.svg gets called to
generate the file
As discussed on IRC, my biggest concern here is that file inclusion syntax
is pretty awkward and awful and I'm very wary of duplicating it. Current
file inclusion syntax requires parsing magic keywords that may change in
the future ("thumb", "left", etc.), there are unnamed parameters,
there
are parameters that only activate if the software thinks that the user
wanted a size specification, and so on.
If we use file inclusion syntax as a model, we would need to do what
you're suggesting here: be much more explicit about parameter names (i.e.,
"|width=200px" instead of just "|200px").
4. {{#invokefile:Foo|main|bar=baz}} Module:Foo's
main function gets called
to generate the file
I think this is my current favorite. It has parity with {{#invoke:}}. And
more fundamentally, if we rewrote MediaWiki from scratch, I would strongly
recommend {{#file:}} and {{#category:}} over the re-use of [[link
syntax]]. I think this option puts us in a better position for the future.
5. No use directly from wikitext. A Lua function
mw.makeFile() would take
file content as a parameter and emit (stripped) HTML to display it.
Eh, I'm not hot on this idea. Though maybe there would be benefits to
forcing everyone to use wrapper templates (particularly built-in usage
tracking and existing familiarity with the syntax).
Thanks for starting this thread. I'm excited to see work in this area.
MZMcBride