Template:Section transclude/doc: Difference between revisions

Content deleted Content added
No edit summary
 
(20 intermediate revisions by 7 users not shown)
Line 1:
{{Documentation subpage}}
{{nosubst}}
{{Template shortcut|st}}
Transcludes thea specified labelled section of the current page. AllowsThis allows the same content to be used in multiple partsplaces ofin athe page, while only needing to be updatedmaintained in one place.
 
'''Will not work on sub-pages (pages with a slash "/" in the title).'''
Line 7:
==Example==
===Code===
<pre><nowiki>
<includeonly>
<section begin=number/>seven<section end=number/>
</includeonly>
 
<syntaxhighlight lang="wikitext">
As I was going to St. Ives, I met a man with {{st|number}} wives. Every wife had {{st|number}} sacks, every sack had {{st|number}} cats, every cat had {{st|number}} kitts. Kitts, cats, sacks, wives, how many were going to St. Ives?
<section begin=lorem/>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<section end=lorem/> <!--This section is transcluded elsewhere on this page-->
</nowiki></pre>
 
...
 
{{section transclude|lorem}} <!--Text from elsewhere on this page is transcluded here-->
</syntaxhighlight>
 
===Output===
<section begin=lorem/>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<section end=lorem/> <!--This section is transcluded elsewhere on this page-->
As I was going to St. Ives, I met a man with seven wives. Every wife had seven sacks, every sack had seven cats, every cat had seven kitts. Kitts, cats, sacks, wives, how many were going to St. Ives?
 
...
 
{{section transclude|lorem}} <!--Text from elsewhere on this page is transcluded here-->
<includeonly>{{sandbox other||
[[Category:Wikipedia page-section templates]]
[[Category:Transclude page content templates]]
}}</includeonly>
== See also ==
* [[Help:Labeled section transclusion]]
* {{tl|Excerpt}} – for transcluding sections from another article