IMHO the question, in this case, is not "how to build the perfect wikitext grammar/parser", but how to ease editing of wikitext through editor enhancements. For that, it seems sufficient to cover the vast majority of cases instead of writing a perfect solution, as long as it falls back to "ugly" wikitext when in doubt. Having 1% of templates appear in all their ugliness is better than 100%.
To that end, I have just written some proof-of-concept JavaScript: http://en.wikipedia.org/wiki/User:Magnus_Manske/tmpl.js
It is not a solution, but shows a possible approach (example text to use: [[Picopict]]): * On edit start, it finds all templates in wikitext * It does so only in namespace 0, so no template variables need to be considered (otherwise, move the damned text out of article namespace! ;-) * It will not touch templates that have no parameter - {{reflist}} is easy enough * It will replace all other templates with strings like ##TEMPLATEnumber:name##, e.g., ##TEMPLATE1:Infobox VG## * These will be replaced with the original text again on save/preview/diff * Double-clicking on, say, TEMPLATE1 will select that entire word. If it is a template placeholder, an action is performed. For this demo, it only shows the original text of the template (note that nested templates are left as wikitext).
Obviously, this can be expanded to call up an editor of some kind. I don't want to write one now that JQuery is around the corner :-)
And yes, I am introducing new syntax. That's not the point here; could just as well be some other, pretty placeholder in a wysiwyg editor.
As to the issue of getting possible template variable names: Why not * load the wikitext of the template in the background * remove all nowiki, noinclude, etc * get everything that looks like "{{{NAME|" or "{{{NAME}}}" * remove known magic words * Profit!
Cheers, Magnus
2009/9/25 Magnus Manske magnusmanske@googlemail.com:
As to the issue of getting possible template variable names: Why not
- load the wikitext of the template in the background
- remove all nowiki, noinclude, etc
- get everything that looks like "{{{NAME|" or "{{{NAME}}}"
- remove known magic words
- Profit!
We (the usability team) do intend to get 'content folding' (folding template calls and tables into stubs that can be expanded at will) done in the Citron (third) release.
Roan Kattouw (Catrope)
On Sat, Sep 26, 2009 at 3:11 AM, Roan Kattouw roan.kattouw@gmail.com wrote:
We (the usability team) do intend to get 'content folding' (folding template calls and tables into stubs that can be expanded at will) done in the Citron (third) release.
*falls to the ground and starts kissing your feet*
Awesome. Timeframe? Screenshots?
(Also, you're not actually calling them "stubs" are you? Confusing...)
Steve
2009/9/27 Steve Bennett stevagewp@gmail.com:
*falls to the ground and starts kissing your feet*
*refers praise to other people; I'm mostly just a code monkey there*
Awesome. Timeframe? Screenshots?
Nothing just yet. Right now we're focusing on getting the Babaco release deployed shortly. When that's done and the inevitable post-deployment problems have settled down, we're gonna get cracking at Citron features. We do have some mockups for Citron features at http://usability.wikimedia.org/wiki/Babaco_Designs#BEYOND_BABACO ; for a list of features per release see http://usability.wikimedia.org/wiki/Releases .
(Also, you're not actually calling them "stubs" are you? Confusing...)
No, fortunately not; I was just trying to come up with a shorter word for "visual placeholder for table/template/ref syntax that's much shorter than the actual syntax and that can be expanded and collapsed". They probably won't be called anything at all: we don't really need a name for them.
Roan Kattouw (Catrope)
Hmmm... reminds me of http://www.wikicreole.org/wiki/Placeholder
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
Magnus Manske wrote:
...
- It will replace all other templates with strings like
##TEMPLATEnumber:name##, e.g., ##TEMPLATE1:Infobox VG## ...
Cheers, Magnus
wikitech-l@lists.wikimedia.org