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
 * — Get the lead section of the requested page
 * — Get the requested section (includes subsections)

The  method has 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

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


 * — Exclude all subsections
 * — Exclude all lists but the first
 * — Exclude all tables but the first and third
 * — Exclude all paragraphs but the first, second and third
 * — Exclude all references
 * — Exclude all categories

Options can be combined at will. For example:


 * — Get only the first file and first three paragraphs of the lead of the section

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


 * — Link the bold title or synonym near the start of the text
 * — Remove bold text
 * — Remove self links
 * — 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
 * — Include subsections

You can also get only one kind of element like so:


 * — Get only the files
 * — Get only the first list
 * — Get only the first and third table
 * — Get only the first, third, fourth and fifth paragraph

The  method treats and tags the usual way.

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, excluding subsections
 * — Transclude the requested section, including subsections
 * — Transclude the first file of the page
 * — Transclude the second table of the requested section
 * — Transclude only the paragraphs of the lead section and link the bold text

Tests

 * Module:Transclude/testcases