标签源代码编辑
(撤销异尘余生讨论)的版本31188)
标签撤销
 
第1行: 第1行:
 
<onlyinclude><includeonly><!--
 
<onlyinclude><includeonly><!--
-->{{#vardefine:article|{{{article|{{{1|}}}}}}}}<!--
 
-->{{#vardefine:section|{{{section|{{{2|}}}}}}}}<!--
 
-->{{#vardefine:nointro|{{#ifeq:{{#invoke:String|find|{{{options|}}}|nointro}}|0||1}}}}<!--
 
-->{{#vardefine:except|{{#ifeq:{{#invoke:String|find|{{{options|}}}|except}}|0||1}}}}<!--
 
-->{{#vardefine:header|{{#ifeq:{{#invoke:String|find|{{{options|}}}|header}}|0||1}}}}<!--
 
-->{{#if:{{#var:article}}|<!-- check if the article parameter exists
 
-->{{#if:{{#var:section}}|<!-- check if the section parameter exists
 
   
 
-->{{#if:{{{1|}}}{{{article|}}}|<!--
-->{{#if:{{#ifeq:{{lc:{{#var:transcludeType}}}}|table|1}}{{#var:nointro}}||<!-- check if the transclude type is a table or if the nointro option has been specified
 
 
-->{{#if:{{{2|}}}{{{section|}}}|<!--
-->{{#if:{{#var:article}}|<!-- check if an article was specified and call the main template to display it
 
-->{{main|{{#var:article}}}}<!--
 
-->}}<!--
 
-->}}<!--
 
   
  +
-->{{#if:{{#ifeq:{{lc:{{#var:transcludeType}}}}|table|1}}{{#pos:,{{#replace:{{lc:{{{options|}}}}}}},|,nointro,}}||<!--
-->{{#vardefine:transcludedFrom|{{#var:article}}}}<!--
 
-->{{#if:{{#var:except}}<!--
+
-->{{#if:{{{1|}}}{{{article|}}}|<!--
 
-->{{main|{{#if:{{{article|}}}|{{{article}}}|{{{1}}}}}}}<!--
-->|<!--
 
 
-->}}<!--
-->{{#lstx:{{#var:article}}|{{#var:section}}}}<!-- show everything in the article except the specified section
 
-->|<!--
+
-->}}<!--
-->{{#if:{{#var:header}}<!--
 
-->|<!--
 
-->{{#lsth:{{#var:article}}|{{#var:section}}}}<!-- show a section based upon the header
 
-->|<!--
 
-->{{#lst:{{#var:article}}|{{#var:section}}}}<!-- show a section that was specified with the <section begin=> tag
 
-->}}<!--
 
-->}}<!--
 
-->{{#vardefine:transcludedFrom|}}<!--
 
   
 
-->{{#vardefine:transcludedFrom|{{#if:{{{article|}}}|{{{article}}}|{{{1}}}}}}}<!--
-->|{{terr|No section specified.}}}}<!--
 
  +
-->{{#if:{{#pos:,{{#replace:{{lc:{{{options|}}}}}}},|,except,}}<!--
  +
-->|{{#lstx:{{#if:{{{article|}}}|{{{article}}}|{{{1}}}}}|{{#if:{{{section|}}}|{{{section}}}|{{{2}}}}} }}<!--
  +
-->|{{#lst:{{#if:{{{article|}}}|{{{article}}}|{{{1}}}}}|{{#if:{{{section|}}}|{{{section}}}|{{{2}}}}} }}<!--
 
-->}}<!--
 
-->{{#vardefine:transcludedFrom|}}<!--
  +
 
-->|{{terr|No section specified.}}}}<!--
 
-->|{{terr|No article specified.}}}}<!--
 
-->|{{terr|No article specified.}}}}<!--
   
Clean up the variables
 
-->{{#vardefine:NumArgIterator|}}<!--
 
-->{{#vardefine:article|}}<!--
 
-->{{#vardefine:section|}}<!--
 
-->{{#vardefine:nointro|}}<!--
 
-->{{#vardefine:except|}}<!--
 
-->{{#vardefine:header|}}<!--
 
 
--></includeonly></onlyinclude>
 
--></includeonly></onlyinclude>
 
{{documentation}}
 
{{documentation}}
 
[[Category:Formatting templates]]
 
[[Category:Formatting templates]]
  +
[[en:Template:Transcludesection]]
[[fr:Modèle:SectionIncluse]]
+
[[fr:Modèle:Inclusion]]
 
[[ru:Шаблон:Включение раздела]]
 
[[ru:Шаблон:Включение раздела]]

2021年5月16日 (日) 05:31的最新版本

Template documentation (for the template shown above, sometimes hidden or invisible)

This template transcludes a section of another page and displays it in the current one.

Usage

{{transcludesection|article=name of article|section=name of section}}

Parameters

Required
article
Name of page which contains the sections you would like to transclude.
Required
section
Name of section in the source page which should be transcluded. You need to mark the section in the source article by inserting:
  • <section begin="name goes here" /> at its beginning and
  • <section end="name goes here" /> at its end

Then you need to set this template's section parameter to name goes here (in this example).

If you mark multiple sections in this fashion with the same name, all of them will be transcluded when using this template. This way you can transclude discontinuous sections.
Optional
options
Various options for the template output.

Available options:

  • except: Inverts the transclusion, i.e. instead of transcluding the marked section(s) of the source article, the whole source article except the marked section(s) is transcluded.
  • nointro: Removes transclusion intro ("Main article: ...").
  • header: Transclude a section based upon the header name ("Background","Characteristics","Notes").

Technical

  • Extensions used: Labeled Section Transclusion, VariablesExtension
  • This template defines a variable which can be accessed from transcluded content: transcludedFrom (the origin page). In addition, the variable transcludeType is interpreted and can be set by other templates.
Documentation transcluded from Template:Transcludesection/doc.
社区内容除另有注明外,均在CC-BY-SA许可协议下提供。