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

From Avlis Wiki
Jump to navigation Jump to search
m (Blanked until needed again.)
m (New template to test for transcluding sections.)
Line 1: Line 1:
Blank until needed again.
{{#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 ===
 
''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]] --
 
 
The original test version of this template was created in [http://en.wikisource.org/wiki/User:Sanbeg/Sec Steve Sanbeg's userspace on Wikisource].
* 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>
 
 
=== Copy of Original Documentation ([http://en.wikisource.org/wiki/User:Sanbeg/Sec Steve Sanbeg's Userspace on Wikisource]) ===
 
* [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
 
 
  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>
 
Then, you could transclude section 1 with
  <nowiki>{{User:Sanbeg/Sec|Article|1}}</nowiki>
 
 
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.
 
See [http://en.wikisource.org/wiki/User:Sanbeg/Test Wikisource:User:Sanbeg/Test] for an example.
 
Please contact me with any feedback. -[http://en.wikisource.org/wiki/User:Sanbeg | Sanbeg] 19:28, 5 August 2006 (UTC)
</div>
 
<!-- [[Category:Templates|{{PAGENAME}}]] -->
</noinclude>

Revision as of 01:34, 27 January 2017


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


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