Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Transcluder/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Modules === The main entry point for modules is the <code>get</code> method. * <code>get( 'Title' )</code> β Get the requested page (exact same result as normal transclusion) * <code>get( 'Title#' )</code> β Get the lead section of the requested page * <code>get( 'Title#Section' )</code> β Get the requested section or <nowiki><section></nowiki> tag (includes any subsections) <nowiki><noinclude></nowiki> and <nowiki><onlyinclude></nowiki> tags are handled [[mw:Transclusion#Transclusion markup|the usual way]] and there's also an optional second parameter to exclude various elements from the result: * <code>get( 'Title#Section', { files = 0 } )</code> β Exclude all files * <code>get( 'Title#Section', { files = 1 } )</code> β Exclude all files except the first * <code>get( 'Title#Section', { files = 2 } )</code> β Exclude all files except the second * <code>get( 'Title#Section', { files = '1,2' } )</code> β Exclude all files except the first and second * <code>get( 'Title#Section', { files = '1-3' } )</code> β Exclude all files except the first, second and third * <code>get( 'Title#Section', { files = '1,3-5' } )</code> β Exclude all files except the first, third, fourth and fifth * <code>get( 'Title#Section', { files = -2 } )</code> β Exclude the second file * <code>get( 'Title#Section', { files = '-2,3' } )</code> β Exclude the second and third files * <code>get( 'Title#Section', { files = '-1,3-5' } )</code> β Exclude the first, third, fourth and fifth files * <code>get( 'Title#Section', { files = 'A.png' } )</code> β Exclude all files except A.png * <code>get( 'Title#Section', { files = '-A.png' } )</code> β Exclude A.png * <code>get( 'Title#Section', { files = 'A.png, B.jpg, C.gif' } )</code> β Exclude all files except A.png, B.jpg and C.gif * <code>get( 'Title#Section', { files = '-A.png, B.jpg, C.gif' } )</code> β Exclude A.png, B.jpg and C.gif * <code>get( 'Title#Section', { files = { [1] = true, [3] = true } } )</code> β Exclude all files except the first and third * <code>get( 'Title#Section', { files = { [1] = false, [3] = false } } )</code> β Exclude the first and third files * <code>get( 'Title#Section', { files = { ['A.png'] = false, ['B.jpg'] = false } } )</code> β Exclude A.png and B.jpg * <code>get( 'Title#Section', { files = '.+%.png' } )</code> β Exclude all files except PNG files (see [[mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]]) * <code>get( 'Title#Section', { files = '-.+%.png' } )</code> β Exclude all PNG files The very same syntax can be used to exclude many other elements: * <code>get( 'Title#Section', { sections = 0 } )</code> β Exclude all subsections * <code>get( 'Title#Section', { sections = 'History, Causes' } )</code> β Exclude all subsections except 'History' and 'Causes' * <code>get( 'Title#Section', { lists = 1 } )</code> β Exclude all lists except the first * <code>get( 'Title#Section', { tables = 'stats' } )</code> β Exclude all tables except the one with id 'stats' * <code>get( 'Title#Section', { paragraphs = '1-3' } )</code> β Exclude all paragraphs except the first, second and third * <code>get( 'Title#Section', { references = 0 } )</code> β Exclude all references * <code>get( 'Title#Section', { categories = '0' } )</code> β Exclude all categories * <code>get( 'Title#Section', { templates = '-.+infobox' } )</code> β Exclude infobox templates * <code>get( 'Title#Section', { parameters = 'image' } )</code> β Exclude all parameters from all templates except the one named 'image' Options can be combined at will. For example: * <code>get( 'Title#Section', { sections = 0, files = 1, paragraphs = '1-3' } )</code> β Exclude all subsections, all files except the first, and all paragraphs except the first three You can also get only some elements like so: * <code>get( 'Title#Section', { only = 'files' } )</code> β Get only the files * <code>get( 'Title#Section', { only = 'lists', lists = 1 } )</code> β Get only the first list * <code>get( 'Title#Section', { only = 'tables', tables = 'stats' } )</code> β Get only the table with id 'stats' * <code>get( 'Title#Section', { only = 'paragraphs', paragraphs = '1,3-5' } )</code> β Get only the first, third, fourth and fifth paragraph * <code>get( 'Title#Section', { only = 'templates', templates = 'Infobox' } )</code> β Get only the infobox * <code>get( 'Title#Section', { only = 'parameters', parameters = 'abstract', references = 0 } )</code> β Get only the parameter called 'abstract' and remove all references from it The output can be further modified with a few special options: * <code>get( 'Title#Section', { noFollow = true } )</code> β Don't follow redirects * <code>get( 'Title#Section', { linkBold = true } )</code> β Link the bold title or synonym near the start of the text * <code>get( 'Title#Section', { noBold = true } )</code> β Remove bold text * <code>get( 'Title#Section', { noComments = true } )</code> β Remove all HTML comments * <code>get( 'Title#Section', { noLinks = true } )</code> β Remove all links * <code>get( 'Title#Section', { noSelfLinks = true } )</code> β Remove self links * <code>get( 'Title#Section', { noBehaviorSwitches = true } )</code> β Remove [[mw:Help:Magic words#Behavior switches|behavior switches]] such as <code><nowiki>__NOTOC__</nowiki></code> * <code>get( 'Title#Section', { noNonFreeFiles = true } )</code> β Remove non-free files (identified by having the words "non-free" in their local description or in Commons) * <code>get( 'Title#Section', { fixReferences = true } )</code> β 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 <code>get</code> 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.
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)