Page MenuHomePhabricator

Transclusion from pages built by a template
Open, MediumPublicFeature

Description

Author: webmaster

Description:
As it stands, if you have two pages, A and B...

A:

<section begin=chapter1 />this is a chapter<section end=chapter1 />

B:

{{#lst:A|chapter1}}

You will get the expected results. :)

Now suppose if you have three pages, A, B and C...

A:

<section begin=chapter1 />this is a chapter<section end=chapter1 />

B:

{{:A}}

C:

{{#lst:B|chapter1}}

This does not currently work. Page C shows nothing from Page A.
Here is just one example of why this would be handy:

Page A is a template. (Protected)

Page B is a templated article, using template Page A. This page describes a type of wine. (Not Protected)
(Ex. Chateau Sanbeg, Chardonnay, White, $12.00, 14%)

Page C is a very similarly templated article, but described a variant of Page B.
(Ex. Chateau Sanbeg, 2008, Chardonnay, White, $13.00, 14%)

For each wine (Page B), there could be dozens of 'vintages' or variants. (2005,2006,2007,2008,etc)
Rather than having to type out the common elements to Page B, over and over, in all of the numerous Page Cs, it would be great to be able to have them pulled in from Page B. Having the section begin/end tags in Page B is inefficient and since it is unprotected allows the possibility that it will be broken by a poor user edit. Placing the tags directly in Page A would hide the magic under the hood.

In effect... a double hop transclusion.

I am willing to help in any way needed to make this new feature possible.


Version: unspecified
Severity: enhancement

Details

Reference
bz21339

Event Timeline

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

ssanbeg wrote:

The extension works by retrieving the template, extracting the section, and then doing the normal parse, which would cause any templates in the section to be transcluded. This feature would require doing some kind of recursive template substitution before extracting sections and parsing, which make make it slower without being useful for the normal case. But this does come up form time to time, so it may be useful to have either another function or an argument to the existing function to do this.

eliyak wrote:

This has come up in the context of transcluding Bible verses at [[ws:Template:Bible/Leviticus]]. Right now that template won't work right for [[ws:Bible (Jewish Publication Society 1917)/Leviticus]] unless every verse is *individually* transcluded from Page space (having content transcluded from Page space is current best practice at Wikisource) and marked with a section tag. This process cannot even be assisted by a template, because section tags can't be transcluded!

eliyak wrote:

Perhaps it would be appropriate to first recursively transclude *only* #section transclusions. In this way, the entire page A could be transcluded to page B with {{#section:A}}, and the extension would pick up on that when processing page C. Also, it would be important for the extension to retain the <section> tags at the beginning and end of a section transclusion, so that the section could be re-transcluded elsewhere.

mystic_sonic wrote:

"Any news on getting this extension to work from within a template? That would dramatically upgrade its functionality!" Ethan1701 11:09, 3 October 2010 (UTC
) - http://www.mediawiki.org/wiki/Extension_talk:Labeled_Section_Transclusion#Templates

mystic_sonic wrote:

"Any news on getting this extension to work from within a template? That would dramatically upgrade its functionality!" Ethan1701 11:09, 3 October 2010 (UTC
) - http://www.mediawiki.org/wiki/Extension_talk:Labeled_Section_Transclusion#Templates

Patch got reverted - removing keyword.

  • Bug 69736 has been marked as a duplicate of this bug. ***

Adding Guillaume Paumier's example from #69736:

When the labeled section is located inside a template call, you can't
transclude it.

Example on PageX: {{green|<section begin="foo"/>bar<section end="foo"/>}}

Then {{#lst:PageX|foo}} doesn't show anything.

This is a bit of a bummer when the text you want to transclude in wrapped in
a formatting template.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:24 PM
Aklapper removed a subscriber: wikibugs-l-list.