Page MenuHomePhabricator

Defining a template within a page
Open, LowPublicFeature

Description

Author: JPMcGrath

Description:
I would like a way to define a template (or something equivalent), for use on a single page, within that page. There are times when it makes sense to define a template that will only be used on one page, for example a "row template" for a single use table. Creating a separate template has a few disadvantages:

  • When trying to examine the WikiMarkup, you have to open multiple pages to see what is going on.
  • Testing the template requires saving the template every time you make a change. You cannot just use the preview feature to see how things will be formatted.
  • The history of the main page and the template are separate, so retrieving old versions can result in mismatches.

I would like instead to do something like this:

#defineTemplate row
|-
| style="font-weight: bold; text-align: left" | {{{name}}}
| style="text-align: right" | {{{age}}}
| style="background-color: #DDD; text-align: right" | {{{salary}}}
#endTemplate

{|
{{row | name="Sally" | age="25" | salary="$50,000" }}
{{row | name="Dick" | age="30" | salary="$75,000" }}
{{row | name="Jane" | age="35" | salary="$100,000" }}
|}

Version: unspecified
Severity: enhancement

Details

Reference
bz22111

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:58 PM
bzimport set Reference to bz22111.
bzimport added a subscriber: Unknown Object (MLST).
matmarex subscribed.

This feature would allow passing arbitrary information between any templates transcluded on a page, and that's apparently a big no-no because it breaks parsing optimizations.

matmarex edited subscribers, added: Jackmcbarn, cscott, ssastry, GWicke; removed: Unknown Object (MLST).
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM
Aklapper removed a subscriber: GWicke.