David Gerard writes:
I suppose you can do that more easily than in ParserFunctions ...
- d.
That's... evil.
* David Gerard dgerard@gmail.com [Mon, 5 Oct 2009 19:16:08 +0100]:
I suppose you can do that more easily than in ParserFunctions ...
Any language can be abused. The problem is opposite: when you need to have clean, well-readable code, some languages offer better help. Dmitriy
2009/10/6 Dmitriy Sintsov questpc@rambler.ru:
- David Gerard dgerard@gmail.com [Mon, 5 Oct 2009 19:16:08 +0100]:
http://codepad.org/cmQIjdzI I suppose you can do that more easily than in ParserFunctions ...
Any language can be abused. The problem is opposite: when you need to have clean, well-readable code, some languages offer better help.
indeed ;-) Perhaps an International Unobfuscated ParserFunctions Context?
- d.
* David Gerard dgerard@gmail.com [Tue, 6 Oct 2009 12:30:51 +0100]:
2009/10/6 Dmitriy Sintsov questpc@rambler.ru: indeed ;-) Perhaps an International Unobfuscated ParserFunctions Context?
I am not expert on this. The readability of templates can be improved: if there were separate wikitext context and Parser interpreter context, there would be no need to place additional double curly braces in source code during every Parser function call, while wikitext would be insterted in escaped (quoted) strings, something like this: (imaginary code in NS_TEMPLATE)
{{#if: test string | value if true | value if false }} {{#ifeq: string 1 | string 2 | value if true | value if false }} {{#ifexpr: expression | value if true | value if false }} <interpreter> if('test string','value if true','value if false') ifeq('string 1','string 2','value if true','value if false') ifexpr('expression','value if true','value if false') </interpreter> escaping apostroph probably should be enough. Doesn't look much different at the first sight, but imagine these nested.
where <interpreter> context syntax is different from wikitext syntax, but because templates generate the wikitext, they can be presented inside interpreter as escaped strings. And the default (wikitext) context is compatible to the existing template syntax. The same functionality in the interpreter context, but with better readability for templates and worse readability for wikitext (which is a selectable trade-off). Just an idea, probably can be improved. Dmitriy
* David Gerard dgerard@gmail.com [Tue, 6 Oct 2009 12:30:51 +0100]:
indeed ;-) Perhaps an International Unobfuscated ParserFunctions Context?
ah, just forgot to add: template parameters will be $1 in the "interpreter context", not a horrible {{{1}}} (keep it for the compatibility in "wikitext context") . Internally, the language is the same, only two different syntax contexts. Dmitriy
David Gerard wrote:
indeed ;-) Perhaps an International Unobfuscated ParserFunctions Context?
- d.
There should be an alternative way to do: {{#if: {{{foo|}}}| {{!}}- {{!}} Foo {{!}} {{{foo}}} |}}
Ie: If parameter foo exists, add it surrounded by a title and a table cell. We would need an "outer {{{foo|}}}" syntax.
wikitech-l@lists.wikimedia.org