Page MenuHomePhabricator

TemplateData: Add property to indicate a template must be substituted
Open, MediumPublicFeature

Description

Some templates use complex logic to provide default values for other templates, or they are used as boilerplates for articles.

These must always be substituted (they might even result in an error when transcluded without substitution).

There should be a way to indicate this fact about a template.

Details

Reference
bz65550

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:08 AM
bzimport added a project: TemplateData.
bzimport set Reference to bz65550.
Krinkle set Security to None.

As part of T64217 we are going to add "format" which can be either "inline" or "block". Do you think "subst" should also fit to this "format" or do we want it in different field? (preferred format of inline/block doesn't have real meaning when template is substituted)

@Jdforrester-WMF: Are you okay with this being a "must"? I'm wondering if perhaps we want to go with "should" instead.

As part of T64217 we are going to add "format" which can be either "inline" or "block". Do you think "subst" should also fit to this "format" or do we want it in different field? (preferred format of inline/block doesn't have real meaning when template is substituted)

Indeed, defining a new substitute possible value for format key seems me to be a good interface implementation.

As part of T64217 we are going to add "format" which can be either "inline" or "block". Do you think "subst" should also fit to this "format" or do we want it in different field? (preferred format of inline/block doesn't have real meaning when template is substituted)

Indeed, defining a new substitute possible value for format key seems me to be a good interface implementation.

+1

+1 It would be really important. I think the substitued function should be indicated by inserting a template only on a meta page because there is no reason to subst a template on an article.

Tacsipacsi changed the subtype of this task from "Task" to "Feature Request".Nov 20 2022, 4:29 PM
Tacsipacsi subscribed.

As part of T64217 we are going to add "format" which can be either "inline" or "block". Do you think "subst" should also fit to this "format" or do we want it in different field? (preferred format of inline/block doesn't have real meaning when template is substituted)

Indeed, defining a new substitute possible value for format key seems me to be a good interface implementation.

+1

+1. Sounds like a good place for this designation.

Just a small comment, in response to the last words in @NemoLePoisson's comment:
There are use cases for template substitution in articles. For example: some maintenance templates in our wiki are actually "envelopes" for other, "internal" templates. When the envelope template is *substituted*, it transcludes the internal template and automatically assigns some value (like the current date) to one of its parameters. It has to be substitution, it wouldn't work otherwise.
Some of these templates, like a notification saying that this article is currently WIP (starting from some date), are intended to be substituted in articles.

As part of T64217 we are going to add "format" which can be either "inline" or "block". Do you think "subst" should also fit to this "format" or do we want it in different field? (preferred format of inline/block doesn't have real meaning when template is substituted)

Technically the inline/block format does make a difference even when substituted: in unnamed (numbered) parameters, whitespace around the parameter value is preserved, so {{subst:Foo|bar}} and {{subst:Foo\n|bar\n}} (where \n is a line break) have slightly different results. However, treating substed templates as inline should probably be fine; if one wants more whitespace, they can add that in whatever wizard they’re using.

On the other hand, this would change the semantics of an already-established parameter. It would’ve been okay to establish the semantics differently in 2015, but changing it after almost a decade sounds dangerous; at this point, I think we need to find another solution because of backward compatibility concerns (and not because of the whitespace issues I discussed above).