User:FreedomFighterSparrow/Sandbox

From mediawiki.org

Possibility of transcluding the section tags via a template[edit]

Hello guys,

is there a possibility to transclude the section tags with a template. An example: I want to define a template Definition with the code

{{#tag:section||begin="Definition:{{{title}}}"}}
'''Definition: {{{title}}}'''

{{{definition}}}
{{#tag:section||end="Definition:{{{title}}}"}}

On an article MyArticle I use the above template via

{{Definition
 |title=wiki
 |definition
... definition of a wiki ...
}}

Now I want to include this definition via {{#lst:MyArticle|Definition:wiki}}. However, this does not work. It seems, that I cannot transclude the section tags properly. Is there a way to archive this? Of course I can write something like this:

<section begin="Definition:wiki" />
{{Definition
 |title=wiki
 |definition
... definition of a wiki ...
}}
<section end="Definition:wiki" />

However, I want to transclude the section tags via the template. How can I do this? -- Stephan Kulla (talk) 15:55, 27 March 2017 (UTC)

Hi Stephan,
Unfortunately, this isn't currently possible. LabeledSectionTransclusion looks at the raw wikitext of the page you are transcluding from, finds its markers (<section>, {{#tag:section}}), and only then parses that wikitext, in the context of the transcluding page. Since the template will only be parsed *afterwards*, it just won't find your section markers. A more thorough explanation can be found in phab:T39256#1390633, including a suggestion on how one might go about adding that functionality to the extension. FFS Talk 18:57, 28 March 2017 (UTC)