GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||
GeezerVison is showing en.wikipedia.org — Help:Labeled section transclusion - Wikipedia Further information: Help:Transclusion § Selective transclusion, and mw:Extension:Labeled Section Transclusion
Labeled Section Transclusion (LST) is a parser function that provides two ways for designating a block or "section" of a page for transclusion. The first method identifies the block by using the page name and a heading (the section title as it appears in the source page). The second method allows the selection of an arbitrary block for transclusion, but this approach requires adding specific markup to label the desired section beforehand. Three functions can transclude a section from a given page name.
Note that there are also equivalent names for these functions, the base names being To prepare an arbitrary "section" for a labeled section transclusion, mark it with begin and end attributes inside Compared to LST transclusion, partial transclusion markup cannot be labeled, and thus the source page cannot have one set of its sections transcluded to one page while having also a different set for another page. A page marked up with partial transclusion tags only, will always transclude the same. But LST and partial transclusion can work together on the same page. These LST functions take additional parameters, as explained below. § Example pages provides search links for the articles that currently employ LST so you can see how they are using it. It would likely be beneficial for future editors of the page, especially if they edit in VisualEditor and are unfamiliar with wikitext, to leave a comment stating why the tags are there and to kindly not tamper with them or remove them: <!-- *** PLEASE DO NOT REMOVE [[Help:Labeled section transclusion]]: *** <section> tags transclude the wikitext inside them to other article(s) live. These tags must not be tampered with. You may freely edit the text between the tags. Transclusion target: [[Page name]]. --> <section begin=label /> Example wikitext. <section end=label /> Functions summaryThis section summarizes the three parser functions in the Labeled Section Transclusion extension.
It is not possible to pass template parameters to the transcluded section or page but the code of the page can use magic words like
LST
LST transclusion options:
Standard syntax applies:
Common usage errors.
MarkupNo markup of the source page is needed if only section titles are used to specify the transclusion. This is the case with #section-h. For labeling a section for LST transclusion use the following markup. Section markingMarkup your section boundaries in the source page using two, singular,
Note this is not normal opening-tag, closing-tag HTML. In HTML Section transclusionUse the parser function {{#section:ArticleX|chapter1}}
Transclude the page but exclude the sectionTo transclude a page, but exclude a specified section, use the {{#section-x:fullpagename|label}}
or {{#section-x:fullpagename|heading}}
Optionally, you may add replacement text to the excluded section. {{#section-x:fullpagename|label|replacement text}}
Example: {{#section-x:articleX|chapter1|See chapter 1 in [[articleX]].}} The replacement text will appear in the area where the section is skipped (excluded). Dealing with stray whitespaceBy default, {{#if:1|{{#section:ArticleX|chapter1}}}}
This will get rid of both leading and trailing whitespace, and the article will render as intended. Because you are nesting templates, it will double the post-expand include size of the excerpt, which can present a problem on longer pages, so you may wish to edit the source page to wrap the content you want to include, without the whitespace, in Other functionsDiscontiguous sectionsIt is possible to have multiple sections with the same name; in this case, every section with that name will be included/excluded. This is especially useful to mark various discussions. Section rangesThese functions can transclude the whole page, so they have the two, optional argument to specify behaviours: 1) a name-tagged section or heading-title, 2) a range of such named section-tags or section titles, and 3) replacement content for a named section.
SubstitutionInstead of transcluding every time, to "transclude" once (to copy), use substitution:
For example to archive old talk on your talk page, you can copy it to an archive page, then delete it, all using LST:
When using substitution to transclude content on Wikipedia, please use the edit summary to apply reusers' rights and obligations. This applies to any substantial content, and not just article contents. No templateCurrently, no template can facilitate this LST markup because it is necessary to use #tag in order to "preSaveTransform" magic words inside a tag of any kind. For the proper attempt see (the non-functioning) {{section}}. The only way to evaluate template arguments inside a tag (because of the parsing order) is #tag. LST would need (template) evaluation of the label as the section tag is generated: {{ #tag: section | {{{1}}} }} But #tag only produces XML-like (balanced, open-closed, start-end, pairs of) tags, while LST will use a singular, explicitly self closing, tag. So LST tags cannot be generated by any template. Compare actual (only in effect) output: {{#tag:section|content|begin=label}} →
<section begin=label> content </section>
with the requested output: <section begin=label /> content <section end=label /> Example pagesThese are searches stored in a link:
See also
Templates
| ||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | ||||||||||||||||||||||||||||||