User:Gorgon/Sandbox/Sandbox Beta
Template:Sec (Section Transclusion) Documentation
Credit
As with most general purpose templates people think of creating, someone usually thought of the same idea before, and this template is another example of that (saved me the trouble of making a crappier version of it myself). -- Gorgon --
The original test version of this template was created in Steve Sanbeg's userspace on Wikisource.
- Steve Sanbeg is also the author of Extension:Labeled Section Transclusion, which will hopefully replace this here one day (see the Description below).
- While the documentation and format of this template have been changed, the original code should be essentially the same.
Description
This template is for transcluding pre-marked sections of articles.
- Extension:Labeled Section Transclusion is an improved method of doing this task, and this template should be considered deprecated if that extension is implemented here.
- While Wikipedia's Selective transclusion without using the labeled section method does work here, it is very limited/restricted, and this template allows more flexibility and ease of use.
Usage and Examples
Step 1
Add section tags to the article page that you want to transclude the information from, as shown below:
This is a sample article, with a few sections <onlyinclude>{{{sec1|This is the first section}}}</onlyinclude> <onlyinclude>{{{sec2|This is the second section}}}</onlyinclude>
- This is the article titled Test_Article used in Step 2 below.
- This template has a limit of 25 numbered sections, so you can only use
sec1
throughsec25
.
Step 2
Add the following code to the target article page that you want to transclude the previously defined section(s) of Test_Article to:
Usage: {{sec|PAGENAME|SECTIONNUMBER}}
- Replace PAGENAME with the source article page name (Test_Article in the example above). E.g.,
Test_Article
- If the source article page is outside of the Main namespace, include the namespace (and full path from it). E.g.,
User:John/Test_Article
- If the source article page is outside of the Main namespace, include the namespace (and full path from it). E.g.,
- Replace SECTIONNUMBER with the matching section number that you want to transclude from the source article (do not include the sec prefix). E.g.,
1
-25
Examples
To transclude the sec1
section from the Test_Article
example above, use:
{{{sec|Test_Article|1}}
To transclude the sec2
section from the Test_Article
example above, use:
{{{sec|Test_Article|2}}
Copy of Original Documentation (Steve Sanbeg's Userspace on Wikisource)
- Wikisource and Mediawiki links have been reformatted to work here (and a few typo fixes).