Module:Transcluder/doc/en

{{#switch: {{languages|Module:Transcluder/doc}} 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 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 C.gif
 * — Exclude A.png, B.jpg and C.gif
 * — Exclude all files except the first and third
 * — Exclude the first and third files
 * — Exclude A.png and B.jpg
 * — Exclude all files except PNG files (see 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 'History' and 'Causes'
 * — Exclude all lists except the first
 * — Exclude all tables except the one with id '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 '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 'stats'
 * — Get only the first, third, fourth and fifth paragraph
 * — Get only the infobox
 * — Get only the parameter called 'abstract' and remove all the references from it

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 all links
 * — Remove self links
 * — Remove non-free files (currently identified by having the words 'non-free' in their local description or at Commons)
 * — Remove behavior switches such as
 * — 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  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  method. It's essentially a wrapper of the  method to make it usable for templates.

See the documentation of the  method for more details and options.


 * — Transclude the requested page
 * — Transclude the lead section of the requested page
 * — Transclude the requested section or 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