Module:Transcluder/doc

{{#switch: {{languages|Module:Transcluder/doc}} {{Shared Template Warning|Module:Transcluder|Module:Transcluder}}

This module is a general-purpose transclusion engine, able to transclude any part of any page and with many options that normal transclusion doesn't provide.

Modules
The main entry point for modules is the   method.


 * — Get the requested page (exact same result as normal transclusion)
 * — Get the lead section of the requested page
 * — Get the requested section or  tag (includes any subsections)

 and  tags are handled 3>Special:MyLanguage/Transclusion#Transclusion markup|the usual way and there's also an optional second parameter to exclude various elements from the result:


 * — Exclude all files
 * — Exclude all files except the first
 * — Exclude all files except the second
 * — Exclude all files except the first and second
 * — Exclude all files except the first, second and third
 * — Exclude all files except the first, third, fourth and fifth
 * — Exclude the second file
 * — Exclude the second and third files
 * — Exclude the first, third, fourth and fifth files
 * — Exclude all files except A.png
 * — Exclude A.png
 * — Exclude all files except A.png, B.jpg</> and <tvar|3>C.gif</>
 * — Exclude <tvar|1>A.png</>, <tvar|2>B.jpg</> and <tvar|3>C.gif</>
 * — Exclude all files except the first and third
 * — Exclude the first and third files
 * — Exclude <tvar|1>A.png</> and <tvar|2>B.jpg</>
 * — Exclude all files except PNG files (see 1>Special:MyLanguage/Extension:Scribunto/Lua reference manual#Patterns</>|Lua patterns)
 * — Exclude all PNG files

The very same syntax can be used to exclude many other elements:


 * — Exclude all subsections
 * — Exclude all subsections except '<tvar|1>History</>' and '<tvar|2>Causes</>'
 * — Exclude all lists except the first
 * — Exclude all tables except the one with id '<tvar|1>stats</>'
 * — Exclude all paragraphs except the first, second and third
 * — Exclude all references
 * — Exclude all categories
 * — Exclude infobox templates
 * — Exclude all parameters from all templates except the one named '<tvar|1>image</>'

Options can be combined at will.

For example:


 * — Exclude all subsections, all files except the first, and all paragraphs except the first three

You can also get only some elements like so:


 * — Get only the files
 * — Get only the first list
 * — Get only the table with id '<tvar|1>stats</>'
 * — Get only the first, third, fourth and fifth paragraph
 * — Get only the infobox
 * — Get only the first file, followed by all the lists

The output can be further modified with a few special options:


 * — Don't follow redirects
 * — Link the bold title or synonym near the start of the text
 * — Remove bold text
 * — Remove comments
 * — Remove self links
 * — Remove non-free files (currently identified by having the words 'non-free' in their local description or at Commons)
 * — Remove 1>Special:MyLanguage/Help:Magic words#Behavior switches</>|behavior switches such as <tvar|2> </>
 * — Prefix reference names with 'Title ' to avoid name conflicts when transcluding and rescue references defined outside the requested section to avoid undefined reference errors

Besides the <tvar|1> </> method, the module exposes several other methods to get specific parts of the wikitext.

This allows other modules to combine elements in more advanced ways.

Templates
The main entry point for templates is the <tvar|1> </> method.

It's essentially a wrapper of the <tvar|1> </> method to make it usable for templates.

See the documentation of the <tvar|1> </> method for more details and options.


 * — Transclude the requested page
 * — Transclude the lead section of the requested page
 * — Transclude the requested section or <tvar|1></> tag (includes any subsections)
 * — Transclude the requested section, excluding subsections
 * — Transclude only the first file of the page
 * — Transclude only the second table of the requested section
 * — Transclude only the paragraphs of the lead section and link the bold text