You seem confused. You seem to think that I care about the proper way to program using templates and parser functions. That's not true, they are an ugly hack and I recognize that. If have absolutely no desire to learn how to use something so hideously inefficient in an efficient manner.
On Sat, Jun 27, 2009 at 4:43 PM, Platonides <[email protected]> wrote: > Brian wrote: > > They want the functionality and they are willing to satisfy usability and > > quality of implementation in order to get it, plain and simple. > > ParserFunctions combined with StringFunctions is flat out unreadable. We > > should not facilitate the writing of unreadable code. > > > > As an example, yesterday I wrote some code that basically says, "check > the > > doi and http template parameters and check to make sure they begin with > > http, and if not add it." In any reasonable sort of language that lends > > itself to a reasonable sort of implementation. But not with Parser and > > String Functions. > > > > #[[{{{1}}}]]. > > > {{#if:{{{4}}}|[|{{#if:{{{5}}}|[}}}}{{#if:{{#pos:{{#if:{{{4}}}|{{{4}}}|{{#if:{{{5}}}|{{{5}}}}}}}|http|}}|{{#if:{{{4}}}|{{{4}}}|{{#if:{{{5}}}|{{{5}}}}}}}|{{#if:{{{4}}}| > > http://dx.doi.org/{{{4}}}|{{#if:{{{5}}}|http://dx.doi.org/{{{5}}}}}}}<http://dx.doi.org/%7B%7B%7B4%7D%7D%7D%7C%7B%7B#if:%7B%7B%7B5%7D%7D%7D%7Chttp://dx.doi.org/%7B%7B%7B5%7D%7D%7D%7D%7D%7D%7D> > }} > > {{#if:{{{2}}}| {{{2}}}}}{{#if:{{{4}}}|]|{{#if:{{{5}}}|]}}}} {{#ifexist: > > File:{{{1}}}.pdf |[{{filepath:{{{1}}}.pdf}} (PDF)]|}} {{#if:{{{3}}}| > > ''{{{3}}}.''}} > > > > There is some extra stuff in there, but you get my point. Just because a > few > > people really, really want extra functionality at any cost doesn't mean > > much. > > I have seen this before. > People use #if for everything even when there is a better way. > Look at what you're doing: > {{#if:{{{4}}}|{{{4}}}|{{#if:{{{5}}}|{{{5}}}}}}} > > > {{#if:{{{5}}}|{{{5}}} }}}} mean "show parameter 5 if it is set", or > "show parameter 5 if it is not blank". > In either case, {{{5|}}} would do the job. > > The parent #if is simlar parameter 4 if set, else parameter 5. > {{{4| {{{5|}}} }}} would do the job. > > Template default parameters were here much before ParserFunctions. > But people prefer using ugly #ifs, making syntax more unreadable (and > increasing preprocessor limits). > > > > Another common abuse is to do: > {{#if: {{{Foo}}}| > <tr><td>Foo: </td><td>{{{Foo}}} </td></tr> > }} > > > I'd like to have a feature in the parser to mark a section to be skipped > if the inner parameter is not set, without having to use #ifs everywhere. > > > _______________________________________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
