On Tue, Sep 2, 2014 at 5:40 AM, Martijn Hoekstra <martijnhoekstra(a)gmail.com>
wrote:
tl;dr: We've been collectively whining about
templates for long enough. Who
wants to help with fixing them?
Improving on templates is broadly what I've been doing with my dialog tools
<https://en.wikinews.org/wiki/Help:Dialog>, which I've been working on for
about three years and am hoping to start using seriously pretty soon (I've
got a few more tweaks in mind to do first; after that, further improvements
I expect to be driven by experience with serious use). I've been
developing these tools using javascript under the hood, although I'm sure
they could in theory be done better as a wiki extension, because I reckoned
the design would need to be able to turn on a dime and I'd observed the
wiki-extension approval process was, well, not.
The dialog tools mediate passing data from page to page, using elements
specified using wiki markup, with the particular intent that a wiki
community could use these tools to crowdsource wizards
<https://en.wikipedia.org/wiki/Wizard_%28software%29> entirely written in
wiki markup.
Data is entered using input elements such as text boxes and dropdown menus,
then passed to the next page via buttons, all placed via templates like
{{dialog/textarea}}, {{dialog/button}}. At the receiving page, dialog data
can go into other input elements, but can also be substituted for template
parameters, and expressions using template-expansion can be used to specify
values for input elements, so that the whole thing meshes tolerably well
with the template system rather than competing with it. Each
{{dialog/button}} specifies an action to be performed. The usual action in
the middle of a dialog is "view", to display a page, but there's also an
action "edit" --- hedged around with safeguards against abuse, of course;
safeguards predicated on the assumption that admins are trustworthy.
In designing dialog-action edit, I uncovered something curious that hints
to me (as a programming-language designer) that the whole concept of wiki
templates might have been subtly flawed... though I don't imagine the flaw
could have been anticipated at the time, and I agree wholeheartedly that at
this late date, not breaking things is paramount. With the API edit
action, there's an optional preload page; and I'd originally imagined that
for dialog edit I'd want to allow the preload page to take template
parameters; but when I actually started creating dialog edit, keeping in
mind the sorts of wiki activities I was familiar with that one might want a
wizard for, I realized that it was more natural to provide a "form" page
that would be fully template-expanded to produce the raw content for the
edited page. In techspeak, this difference between preload pages with
template-parameter substitution, versus dialog-edit forms with full
template-expansion to generate raw content, is essentially that the preload
page is a macro
<https://en.wikipedia.org/wiki/Macro_%28computer_science%29#Syntactic_macros>,
while the dialog edit form is a fexpr <https://en.wikipedia.org/wiki/Fexpr>.