<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ATranscluder%2Fdoc</id>
	<title>Module:Transcluder/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ATranscluder%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Transcluder/doc&amp;action=history"/>
	<updated>2026-06-19T12:48:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Transcluder/doc&amp;diff=479809&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Transcluder/doc&amp;diff=479809&amp;oldid=prev"/>
		<updated>2021-07-16T07:41:19Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Module rating|beta}}&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
&lt;br /&gt;
The main entry point for modules is the &amp;lt;code&amp;gt;get&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title' )&amp;lt;/code&amp;gt; — Get the requested page (exact same result as normal transclusion)&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#' )&amp;lt;/code&amp;gt; — Get the lead section of the requested page&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section' )&amp;lt;/code&amp;gt; — Get the requested section or &amp;lt;nowiki&amp;gt;&amp;lt;section&amp;gt;&amp;lt;/nowiki&amp;gt; tag (includes any subsections)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;noinclude&amp;gt;&amp;lt;/nowiki&amp;gt; and &amp;lt;nowiki&amp;gt;&amp;lt;onlyinclude&amp;gt;&amp;lt;/nowiki&amp;gt; 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:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = 0 } )&amp;lt;/code&amp;gt; — Exclude all files&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = 1 } )&amp;lt;/code&amp;gt; — Exclude all files except the first&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = 2 } )&amp;lt;/code&amp;gt; — Exclude all files except the second&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '1,2' } )&amp;lt;/code&amp;gt; — Exclude all files except the first and second&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '1-3' } )&amp;lt;/code&amp;gt; — Exclude all files except the first, second and third&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '1,3-5' } )&amp;lt;/code&amp;gt; — Exclude all files except the first, third, fourth and fifth&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = -2 } )&amp;lt;/code&amp;gt; — Exclude the second file&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '-2,3' } )&amp;lt;/code&amp;gt; — Exclude the second and third files&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '-1,3-5' } )&amp;lt;/code&amp;gt; — Exclude the first, third, fourth and fifth files&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = 'A.png' } )&amp;lt;/code&amp;gt; — Exclude all files except A.png&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '-A.png' } )&amp;lt;/code&amp;gt; — Exclude A.png&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = 'A.png, B.jpg, C.gif' } )&amp;lt;/code&amp;gt; — Exclude all files except A.png, B.jpg and C.gif&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '-A.png, B.jpg, C.gif' } )&amp;lt;/code&amp;gt; — Exclude A.png, B.jpg and C.gif&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = { [1] = true, [3] = true } } )&amp;lt;/code&amp;gt; — Exclude all files except the first and third&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = { [1] = false, [3] = false } } )&amp;lt;/code&amp;gt; — Exclude the first and third files&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = { ['A.png'] = false, ['B.jpg'] = false } } )&amp;lt;/code&amp;gt; — Exclude A.png and B.jpg&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '.+%.png' } )&amp;lt;/code&amp;gt; — Exclude all files except PNG files (see [[mw:Extension:Scribunto/Lua reference manual#Patterns|Lua patterns]])&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { files = '-.+%.png' } )&amp;lt;/code&amp;gt; — Exclude all PNG files&lt;br /&gt;
&lt;br /&gt;
The very same syntax can be used to exclude many other elements:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { sections = 0 } )&amp;lt;/code&amp;gt; — Exclude all subsections&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { sections = 'History, Causes' } )&amp;lt;/code&amp;gt; — Exclude all subsections except 'History' and 'Causes'&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { lists = 1 } )&amp;lt;/code&amp;gt; — Exclude all lists except the first&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { tables = 'stats' } )&amp;lt;/code&amp;gt; — Exclude all tables except the one with id 'stats'&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { paragraphs = '1-3' } )&amp;lt;/code&amp;gt; — Exclude all paragraphs except the first, second and third&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { references = 0 } )&amp;lt;/code&amp;gt; — Exclude all references&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { categories = '0' } )&amp;lt;/code&amp;gt; — Exclude all categories&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { templates = '-.+infobox' } )&amp;lt;/code&amp;gt; — Exclude infobox templates&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { parameters = 'image' } )&amp;lt;/code&amp;gt; — Exclude all parameters from all templates except the one named 'image'&lt;br /&gt;
&lt;br /&gt;
Options can be combined at will. For example:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { sections = 0, files = 1, paragraphs = '1-3' } )&amp;lt;/code&amp;gt; — Exclude all subsections, all files except the first, and all paragraphs except the first three&lt;br /&gt;
&lt;br /&gt;
You can also get only some elements like so:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { only = 'files' } )&amp;lt;/code&amp;gt; — Get only the files&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { only = 'lists', lists = 1 } )&amp;lt;/code&amp;gt; — Get only the first list&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { only = 'tables', tables = 'stats' } )&amp;lt;/code&amp;gt; — Get only the table with id 'stats'&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { only = 'paragraphs', paragraphs = '1,3-5' } )&amp;lt;/code&amp;gt; — Get only the first, third, fourth and fifth paragraph&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { only = 'templates', templates = 'Infobox' } )&amp;lt;/code&amp;gt; — Get only the infobox&lt;br /&gt;
&lt;br /&gt;
The output can be further modified with a few special options:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { noFollow = true } )&amp;lt;/code&amp;gt; — Don't follow redirects&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { linkBold = true } )&amp;lt;/code&amp;gt; — Link the bold title or synonym near the start of the text&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { noBold = true } )&amp;lt;/code&amp;gt; — Remove bold text&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { noSelfLinks = true } )&amp;lt;/code&amp;gt; — Remove self links&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { noBehaviorSwitches = true } )&amp;lt;/code&amp;gt; — Remove [[mw:Help:Magic words#Behavior switches|behavior switches]] such as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;__NOTOC__&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;get( 'Title#Section', { fixReferences = true } )&amp;lt;/code&amp;gt; — Prefix reference names with 'Title ' to avoid name conflicts when transcluding and rescue references defined outside the requested section to avoid undefined reference errors&lt;br /&gt;
&lt;br /&gt;
Besides the &amp;lt;code&amp;gt;get&amp;lt;/code&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
The main entry point for templates is the &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; method. It's essentially a wrapper of the &amp;lt;code&amp;gt;get&amp;lt;/code&amp;gt; method to make it usable for templates. See the documentation of the &amp;lt;code&amp;gt;get&amp;lt;/code&amp;gt; method for more details and options.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Transclude the requested page&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title#}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Transclude the lead section of the requested page&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title#Section}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Get the requested section or &amp;lt;nowiki&amp;gt;&amp;lt;section&amp;gt;&amp;lt;/nowiki&amp;gt; tag (includes any subsections)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title#Section|sections=0}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Transclude the requested section, excluding subsections&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title|only=files|files=1}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Transclude only the first file of the page&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title#Section|only=tables|tables=2}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Transclude only the second table of the requested section&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Transcluder|main|Title#|only=paragraphs|linkBold=yes}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; — Transclude only the paragraphs of the lead section and link the bold text&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>