Page MenuHomePhabricator

A new syntax for #if sections idea
Closed, DeclinedPublic

Description

Problem: The syntax of #if directive is hard to read (especially it is hard to read and understand for nontechnical users and especially in the case of nested directives).

I propose to introduce an alternative syntax for #if directive, having separate open and close tags.

Possible syntax:

<div if="condition">
...
</div>

or maybe

<if condition="...">
...
</if>

It is especially useful for excluding a part of an included template. (Yes, I know about <noinclude> directive, but it is not enough flexible to in/ex-clude parts of a page separately.)

Event Timeline

Aklapper triaged this task as Lowest priority.Dec 12 2016, 12:03 PM

@VictorPorton: Please edit the task summary to describe a problem instead of a solution - thank you!

Legoktm subscribed.

I don't think we're going to extend <div> syntax to diverge from the HTML standard, that would just be asking for trouble.

As for adding an <if> tag, that idea sounds interesting, but tag syntax doesn't expand templates inside of it, so you'd have to do {{#tag:if|...}} at which point you're back where you started.

In general if parser functions are too hard to read, I'd recommend migrating them to Lua.

"but tag syntax doesn't expand templates inside of it," - I don't understand this phrase.

Lua is not a solution of my problem at all, because what I need is readable syntax inside the content page.