User:Gorgon/Sandbox/Sandbox Beta: Difference between revisions

From Avlis Wiki
Jump to navigation Jump to search
(Temp version of Main Page to propose changes/fixes, after a Getting Started page update broke several links. Several old redirected links updated, and a few more tweaks.)
 
m (Added "Technical details" section for information about using pipes "|" (or wikitables containing them) as template parameters.)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<center>[[Image:Avlis_header_new.gif]]</center>
<noinclude>{{<!-- sec -->User:Gorgon/Sandbox/Sandbox_Beta | User:Gorgon/Sandbox | 1 }}
</noinclude>{{#switch:{{{2}}}
|1={{{{{ns|}}}:{{{1}}}
  |sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|2={{{{{ns|}}}:{{{1}}}
  |sec1=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|3={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|4={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|5={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|6={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|7={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|8={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|9={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|10={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|11={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|12={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|13={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|14={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|15={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|16={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|17={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|18={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|19={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec20=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|20={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=
  |sec21=|sec22=|sec23=|sec24=|sec25=}}
|21={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec22=|sec23=|sec24=|sec25=}}
|22={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec23=|sec24=|sec25=}}
|23={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec24=|sec25=}}
|24={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec25=}}
|25={{{{{ns|}}}:{{{1}}}
  |sec1=|sec2=|sec3=|sec4=|sec5=|sec6=|sec7=|sec8=|sec9=|sec10=
  |sec11=|sec12=|sec13=|sec14=|sec15=|sec16=|sec17=|sec18=|sec19=|sec20=
  |sec21=|sec22=|sec23=|sec24=}}
}}<noinclude>


== Template:Sec (Section Transclusion) Documentation ==


=== Credit ===


{| style="width: 100%;" cellspacing="5" cellpadding="0"
''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).'' -- [[User:Gorgon|Gorgon]] --
|-
| colspan="2" style="background: #FCFCFC; border: 1px solid #AAA; vertical-align: top;" |
<div style="background: #ACD; border: 1px solid #7BC; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;"><div style="float: right;"></div>What is Avlis?</div>
<div style="padding-left: 2em; padding-right: 2em;">
'''<span class="plainlinks">[http://neverwintervault.org/project/nwn1/module/gameworld/world-avlis Avlis]</span>''' is a persistent world running on [[NWN:Neverwinter_Nights | Neverwinter Nights 1]].
*Avlis has [[Servers | 9 servers]], running smoothly on dedicated up-to-date machines!
*It has a vast array of custom scripted systems and features! Examples are the [[Crafting_System | crafting system]], the [[Prestige_Classes | custom classes]], a [[Magic_System | custom spell system]], [[Custom_Races | custom races]], and [[:Category:Systems | much, much more]].
*It has an active player base across several time zones, consisting of hundreds of players.
*It has an [[The_Avlis_Team | active team]], expanding upon the world, and DM'ing many events.
*Our world is dynamic and alive! Players have achieved godhood, conquered towns, created guilds. You can do the same!




If you seek high fantasy with intense [[NWN:Roleplay |roleplay]], where your character, and the characters around you, come to feel not just like a collection of stats and pixels, but true living beings, then Avlis is the place for you.
The original test version of this template was created in [http://en.wikisource.org/wiki/User:Sanbeg/Sec Steve Sanbeg's userspace on Wikisource].
</div>
* Steve Sanbeg is also the author of [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion 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.
* [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] is an improved method of doing this task, and this template should be considered [[Wikipedia:Deprecation | deprecated]] if that extension is implemented here.
* While Wikipedia's [[Wikipedia:Wikipedia:Transclusion#Without_using_the_labeled_section_method | 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:
 
<pre style="white-space: pre-wrap">
This is a sample article, with a few sections
&lt;onlyinclude><nowiki>{{{sec1 |This is the first section}}}</nowiki>&lt;/onlyinclude>
&lt;onlyinclude><nowiki>{{{sec2 |This is the second section}}}</nowiki>&lt;/onlyinclude>
</pre>
 
* 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 <code>sec1</code> through <code>sec25</code>.
 
 
==== 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: ''' <code><nowiki>{{sec | PAGENAME | SECTIONNUMBER }}</nowiki></code>
 
 
* Replace PAGENAME with the source article page name ('''Test_Article''' in the example above). E.g., <code>Test_Article</code>
** If the source article page is outside of the '''Main''' namespace, include the namespace (and full path from it). E.g., <code>User:John/Test_Article</code>
* Replace SECTIONNUMBER with the matching section number that you want to transclude from the source article (''do not include the '''sec''' prefix''). E.g., <code>1</code> - <code>25</code>
 
 
==== Examples ====
 
To transclude the <code>sec1</code> section from the <code>Test_Article</code> example above, use:
<code><nowiki>{{sec | Test_Article | 1 }}</nowiki></code>
 
To transclude the <code>sec2</code> section from the <code>Test_Article</code> example above, use:
<code><nowiki>{{sec | Test_Article | 2 }}</nowiki></code>
 
 
==== Other Usage ====
 
The author gave a few other examples in his [http://en.wikisource.org/wiki/User:Sanbeg/Test test page], using an extra <code>ns =</code> parameter after the SECTIONNUMBER, to modify which namespace the PAGENAME belongs to, so it doesn't need to be included.
 
An example of the previous <code>User:John/Test_Article</code> PAGENAME done this way would be:
 
<code><nowiki>{{sec | John/Test_Article | 1 | ns = User }}</nowiki></code>
 
* In this case there isn't much improvement (more confusing even), since the username still needs to be included, but it may be useful for the Template namespace, or others.
 
 
One other example he gave didn't use this template. Only the markup in the source article page, and transclusion with extra parameters.
 
Still using the '''Test_Article''' in the example above as a source, with the example code:
 
<code><nowiki>{{Test_Article | sec1 = }}</nowiki></code>
 
This transcludes everything except section 1 ('''sec1'''), since the contents of that section are unset by the empty parameter value given.
 
'''Result: ''' <code>This is the second section</code>
 
* This is basically the inverse of how this template works, since the template transcludes all sections, then empties the values of all that aren't selected. With the transclusion method above, everything is transcluded, and you specify individual sections that you don't want to include (or replacements for them - read on).
 
 
This also can be used to replace individual sections of the whole transcluded article page, by supplying a new value for each parameter.
 
E.g., <code><nowiki>{{Test_Article | sec1 = Hello World! }}</nowiki></code> adds <code>Hello World!</code> before also transcluding <code>This is the second section</code>.
 
 
With source article pages that have many sections set up this way, several can be left out or replaced. If '''Test_Article_2''' has 3 or more sections marked the same as the original '''Test_Article''', this can be demonstrated with the following example:
 
<code><nowiki>{{Test_Article_2 | sec1 = Hello World! | sec3 = }}</nowiki></code>
 
* This would add <code>Hello World!</code> instead of section 1, transclude section 2 normally with <code>This is the second section</code>, skip transcluding section 3, and then transclude whatever other sections come after that normally.
 
 
=== Technical details ===
 
If you intend to use <span class="plainlinks">[http://www.mediawiki.org/wiki/Help:Tables wikitables]</span> as parameter values in this template, then you need to know this:
 
<span class="plainlinks">[http://www.mediawiki.org/wiki/Help:Templates Templates]</span> have a problem handling parameter data that contains pipes "<code>|</code>", unless the pipe is inside another template <code><nowiki>{{name | param1 }}</nowiki></code>, or inside a piped link <code><nowiki>[[Help:Template | help]]</nowiki></code>. Therefore templates can not handle wikitables as input, unless you escape them by using the '''<nowiki>{{!}}</nowiki>''' magic word (parser function - see: <span class="plainlinks">[http://www.mediawiki.org/wiki/Help:Magic_words#Other Help:Magic words#Other]</span>). This makes it hard to use wikitables as parameters in templates. Instead, the usual solution is to use [[Wikipedia:Help:Table#Other_table_syntax | HTML wikimarkup]] for the table code, which is more robust.
 
'''''Note:''' [[Template:!]] functionality was replaced in MediaWiki version 1.24 by the '''<nowiki>{{!}}</nowiki>''' magic word, and the template is ignored when using it.''
 
 
=== Copy of Original Documentation ([http://en.wikisource.org/wiki/User:Sanbeg/Sec Steve Sanbeg's Userspace on Wikisource]) ===
 
* This was also in the Template namespace before he finalized [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion], and the template name was recycled. It can still be viewed in its [http://en.wikisource.org/w/index.php?title=Template:Sec&oldid=4659477 last revision] before being recycled as a redirect.
* [http://wikisource.org Wikisource] and [http://www.mediawiki.org Mediawiki] links have been reformatted to work here (and a few typo fixes).
 
 
<div name="Original Documentation" class="boilerplate metadata" id="odoc" style="margin: 0 1em; padding: 0 10px; border: 1px solid #aaa;">
Now that the [http://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Extension:Labeled Section Transclusion] extension is active here, this template is deprecated; please use the extension for any future work.
 
This template is intended as a proof of concept, to demonstrate transcluding sections of articles. 
 
To transclude larger sections, it may be more useful to split the section into a daughter page, or some other separate page/template, then transcluding that where necessary.  If you always transclude the same section, i.e. to transclude the body of text without extra boilerplate, then it should be simple to use &lt;onlyinclude&gt;.
 
However, when there are many smaller sections, it's simpler to mark the sections, and call them by name.  For example, if you have a a large article with small numbered sections, marked like
 


<div style="text-align: right; font-size: 0.8em; font-style: italic; margin: 0.3em 1em;"></div>
  This is a sample article, with a few sections
| style="width: 50%; background: #FCFCFC; border: 1px solid #AAA; vertical-align: top;" |
  &lt;onlyinclude><nowiki>{{{sec1|This is the first section}}}</nowiki>&lt;/onlyinclude>
<div style="background: #ACD; border: 1px solid #7BC; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;"><div style="float: right;"></div>Getting Started</div>
  &lt;onlyinclude><nowiki>{{{sec2|This is the second section}}}</nowiki>&lt;/onlyinclude>
<div style="padding-left: 1em;">
*'''[[Getting_Started | Getting Started]]'''
**How to register, get the required custom content files, connect to one of the servers, and start playing.
*'''[[Player_Guide | Player Guide]]'''
**Useful starting lore on Avlis, and general [[NWN:Out-of-character | out of character]] rules.
*'''[[Getting_Started#Additional_Useful_Information | Good to Know]]'''
**Extra information or tools that may not be covered in the Player Guide. Useful to know, though not essential.
*'''[[Getting_Started#List_of_Dungeons | List of Dungeons]]'''
**List of well known dungeons, so you know where to venture safely.


</div>
Then, you could transclude section 1 with
|-
  <nowiki>{{User:Sanbeg/Sec|Article|1}}</nowiki>
|-
| colspan="2" style="background: #FCFCFC; border: 1px solid #AAA; vertical-align: top;" |
<div style="background: #ACD; border: 1px solid #7BC; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;"><div style="float: right;"></div>Avlis Features</div>
<div style="padding: 0em 1em;"></div>
*'''[[:Category:Systems | Systems and Tools]]'''
**There are a lot of scripted custom systems in Avlis. Read here about them.
*'''[[Classes]]'''
**How to unlock certain prestige classes, the the custom classes on Avlis.
*'''[[Guilds]]'''
**Read about how guilds work, and which exist.


<div style="text-align: right; font-size: 0.8em; font-style: italic; margin: 0.3em 1em;"></div>
| style="width: 50%; background: #FCFCFC; border: 1px solid #AAA; vertical-align: top;" |
<div style="background: #ACD; border: 1px solid #7BC; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;"><div style="float: right;"></div>Lore</div>
<div style="padding-left: 1em;">
*'''[[Atlas_of_Avlis | Atlas]]'''
**Use this as a starting points to learn more of nations and cities in Avlis.
*'''[[Timeline | History]]'''
*'''[[:Category:Religion | Religion]]'''
*'''[[Races]]'''
**Not only which races live on Avlis, but also how to play them.
*'''[[:Category:Language | Languages]]'''
**The languages spoken on Avlis
*'''[[:Category:Art_and_Literature | Art and Literature]]'''


</div>
All text between &lt;onlyinclude> and &lt;/onlyinclude> should be marked with a section (or marked somehow) to prevent unconditional transclusion. Of course, it's possible to have multiple &lt;onlyinclude> blocks.
|-
|-
| colspan="2" style="background: #FCFCFC; border: 1px solid #AAA; vertical-align: top;" |
<div style="background: #ACD; border: 1px solid #7BC; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;"><div style="float: right;"></div>Avlis Contact</div>
<div style="padding: 0em 1em;"></div>
*'''[[The_Avlis_Team | The Avlis Team]]
**If you need to contact the team or learn more about them.  
*'''[[Avlis_Chat | Connect to IRC chat]]'''
*'''[[Donations | How to Donate]]'''
**It takes money to keep the lights on and machines running. Feel free to contribute.


<div style="text-align: right; font-size: 0.8em; font-style: italic; margin: 0.3em 1em;"></div>
See [http://en.wikisource.org/wiki/User:Sanbeg/Test Wikisource:User:Sanbeg/Test] for an example.
| style="width: 50%; background: #FCFCFC; border: 1px solid #AAA; vertical-align: top;" |
<div style="background: #ACD; border: 1px solid #7BC; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;"><div style="float: right;"></div>Player Stuff</div>
<div style="padding-left: 1em;">
*'''[[PCs | Player Characters]]'''
**Feel free to make your own page about your character, or read about other characters.
*'''[[Player's_Playground | Player's Playground]]'''
**Stuff that players gathered over time like Pictures, quotes and chats.


Please contact me with any feedback. -[http://en.wikisource.org/wiki/User:Sanbeg | Sanbeg] 19:28, 5 August 2006 (UTC)
</div>
</div>
|-
 
{{ns detect | template = [[Category:Templates |{{PAGENAME}}]] }}</noinclude>

Latest revision as of 06:51, 3 February 2017

This is a user sandbox of Gorgon. A user sandbox is a subpage of the user's user page. It serves as a testing spot and page development space for the user, and is not an Avlis wiki article.


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.


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 through sec25.


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
  • 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 }}


Other Usage

The author gave a few other examples in his test page, using an extra ns = parameter after the SECTIONNUMBER, to modify which namespace the PAGENAME belongs to, so it doesn't need to be included.

An example of the previous User:John/Test_Article PAGENAME done this way would be:

{{sec | John/Test_Article | 1 | ns = User }}

  • In this case there isn't much improvement (more confusing even), since the username still needs to be included, but it may be useful for the Template namespace, or others.


One other example he gave didn't use this template. Only the markup in the source article page, and transclusion with extra parameters.

Still using the Test_Article in the example above as a source, with the example code:

{{Test_Article | sec1 = }}

This transcludes everything except section 1 (sec1), since the contents of that section are unset by the empty parameter value given.

Result: This is the second section

  • This is basically the inverse of how this template works, since the template transcludes all sections, then empties the values of all that aren't selected. With the transclusion method above, everything is transcluded, and you specify individual sections that you don't want to include (or replacements for them - read on).


This also can be used to replace individual sections of the whole transcluded article page, by supplying a new value for each parameter.

E.g., {{Test_Article | sec1 = Hello World! }} adds Hello World! before also transcluding This is the second section.


With source article pages that have many sections set up this way, several can be left out or replaced. If Test_Article_2 has 3 or more sections marked the same as the original Test_Article, this can be demonstrated with the following example:

{{Test_Article_2 | sec1 = Hello World! | sec3 = }}

  • This would add Hello World! instead of section 1, transclude section 2 normally with This is the second section, skip transcluding section 3, and then transclude whatever other sections come after that normally.


Technical details

If you intend to use wikitables as parameter values in this template, then you need to know this:

Templates have a problem handling parameter data that contains pipes "|", unless the pipe is inside another template {{name | param1 }}, or inside a piped link [[Help:Template | help]]. Therefore templates can not handle wikitables as input, unless you escape them by using the {{!}} magic word (parser function - see: Help:Magic words#Other). This makes it hard to use wikitables as parameters in templates. Instead, the usual solution is to use HTML wikimarkup for the table code, which is more robust.

Note: Template:! functionality was replaced in MediaWiki version 1.24 by the {{!}} magic word, and the template is ignored when using it.


Copy of Original Documentation (Steve Sanbeg's Userspace on Wikisource)