[Wikitech-l] Enabling some string functions

Stephen Bain stephen.bain at gmail.com
Fri Jun 26 08:44:33 UTC 2009


On Fri, Jun 26, 2009 at 2:07 PM, Brian<Brian.Mingus at colorado.edu> wrote:
>
> 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}}}}}}}}}
> {{#if:{{{2}}}| {{{2}}}}}{{#if:{{{4}}}|]|{{#if:{{{5}}}|]}}}} {{#ifexist:
> File:{{{1}}}.pdf |[{{filepath:{{{1}}}.pdf}} (PDF)]|}} {{#if:{{{3}}}|
> ''{{{3}}}.''}}

On Fri, Jun 26, 2009 at 3:35 PM, Tim Starling<tstarling at wikimedia.org> wrote:
>
> While some template authors might attempt to make their templates
> accessible, the nature of Wikipedia is such that less-accessible
> contributions tend to accumulate.

In the good old days someone would have solved the same problem by
mentioning in the template's documentation that the parameter should
use full URLs. Both the template and instances of it would be
readable.

Template programmers are not going to create accessible templates
because they have a  programming mindset, and set out to solve
problems in ways like Brian's code above.

-- 
Stephen Bain
stephen.bain at gmail.com




More information about the Wikitech-l mailing list