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. I talked with TimStarling and Carmela on IRC about this, and here's some of the ideas we came up with:
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 4. {{#invokefile:Foo|main|bar=baz}} Module:Foo's main function gets called to generate the file 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.
Advantages: 1. Works everywhere that normal files work without any modifications. 2. As #1, but not quite everywhere. No clashes with existing files. 3. Works everywhere, and no clashes. 4. Consistency with {{#invoke:}} and doesn't cause confusion with "real" files. 5. Simple.
Disadvantages: 1. Clashes with existing files already named File:Module:Foo. 2. Adding a second namespace that works like File is pretty much impossible. 3. Can't think of any right now. 4. Incompatible with things that expect filenames, which is a lot of on-wiki templates, and things like Extension:ImageMap 5. Wikis would probably build a wrapper module around it, making it equivalent to #4
At the moment, I'm leaning towards option 3.
Are there any other thoughts on these, or any additional ideas?
Jackmcbarn