User:Sephira/Sandbox/Sandbox Alpha: Difference between revisions

From Avlis Wiki
Jump to navigation Jump to search
(Beginning of page)
 
m (Replaced content with "<noinclude>{{<!-- sec -->User:Sephira/Sandbox/Sandbox_Alpha | User:Sephira/Sandbox | 1 }}")
Tag: Replaced
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{<!-- sec -->User:Darkfire/Sandbox/Sandbox_Alpha | User:Darkfire/Sandbox | 1 }}
<noinclude>{{<!-- sec -->User:Sephira/Sandbox/Sandbox_Alpha | User:Sephira/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 ===
 
Darkfire stole this from [[User:Gorgon|Gorgon]] and then gave it to [[User:Sephira|Sephira]]
 
 
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>
 
 
==== 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
 
 
  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>
 
{{ns detect | template = [[Category:Templates |{{PAGENAME}}]] }}</noinclude>

Latest revision as of 00:04, 5 June 2023