Modul:Transcluder/dok
Dette modul er et generelt værktøj til at transkludere hele eller dele af sider med mange valgmuligheder som normal transklution ikke har.
Herunder er en kopi af modulets dokumentation på engelsk Wikipedia.
Usage
Modules
The main entry point for modules is the get method.
get( 'Title' )— Get the requested page (exact same result as normal transclusion)get( 'Title#' )— Get the lead section of the requested pageget( 'Title#Section' )— Get the requested section or <section> tag (includes any subsections)
<noinclude> and <onlyinclude> tags are handled the usual way and there's also an optional second parameter to exclude various elements from the result:
get( 'Title#Section', { files = 0 } )— Exclude all filesget( 'Title#Section', { files = 1 } )— Exclude all files except the firstget( 'Title#Section', { files = 2 } )— Exclude all files except the secondget( 'Title#Section', { files = '1,2' } )— Exclude all files except the first and secondget( 'Title#Section', { files = '1-3' } )— Exclude all files except the first, second and thirdget( 'Title#Section', { files = '1,3-5' } )— Exclude all files except the first, third, fourth and fifthget( 'Title#Section', { files = -2 } )— Exclude the second fileget( 'Title#Section', { files = '-2,3' } )— Exclude the second and third filesget( 'Title#Section', { files = '-1,3-5' } )— Exclude the first, third, fourth and fifth filesget( 'Title#Section', { files = 'A.png' } )— Exclude all files except A.pngget( 'Title#Section', { files = '-A.png' } )— Exclude A.pngget( 'Title#Section', { files = 'A.png, B.jpg, C.gif' } )— Exclude all files except A.png, B.jpg and C.gifget( 'Title#Section', { files = '-A.png, B.jpg, C.gif' } )— Exclude A.png, B.jpg and C.gifget( 'Title#Section', { files = { [1] = true, [3] = true } } )— Exclude all files except the first and thirdget( 'Title#Section', { files = { [1] = false, [3] = false } } )— Exclude the first and third filesget( 'Title#Section', { files = { ['A.png'] = false, ['B.jpg'] = false } } )— Exclude A.png and B.jpgget( 'Title#Section', { files = '.+%.png' } )— Exclude all files except PNG files (see Lua patterns)get( 'Title#Section', { files = '-.+%.png' } )— Exclude all PNG files
The very same syntax can be used to exclude many other elements:
get( 'Title#Section', { sections = 0 } )— Exclude all subsectionsget( 'Title#Section', { sections = 'History, Causes' } )— Exclude all subsections except 'History' and 'Causes'get( 'Title#Section', { lists = 1 } )— Exclude all lists except the firstget( 'Title#Section', { tables = 'stats' } )— Exclude all tables except the one with id 'stats'get( 'Title#Section', { paragraphs = '1-3' } )— Exclude all paragraphs except the first, second and thirdget( 'Title#Section', { references = 0 } )— Exclude all referencesget( 'Title#Section', { categories = '0' } )— Exclude all categoriesget( 'Title#Section', { templates = '-.+infobox' } )— Exclude infobox templatesget( 'Title#Section', { parameters = 'image' } )— Exclude all parameters from all templates except the one named 'image'
Options can be combined at will. For example:
get( 'Title#Section', { sections = 0, files = 1, paragraphs = '1-3' } )— 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( 'Title#Section', { only = 'files' } )— Get only the filesget( 'Title#Section', { only = 'lists', lists = 1 } )— Get only the first listget( 'Title#Section', { only = 'tables', tables = 'stats' } )— Get only the table with id 'stats'get( 'Title#Section', { only = 'paragraphs', paragraphs = '1,3-5' } )— Get only the first, third, fourth and fifth paragraphget( 'Title#Section', { only = 'templates', templates = 'Infobox' } )— Get only the infobox
The output can be further modified with a few special options:
get( 'Title#Section', { noFollow = true } )— Don't follow redirectsget( 'Title#Section', { linkBold = true } )— Link the bold title or synonym near the start of the textget( 'Title#Section', { noBold = true } )— Remove bold textget( 'Title#Section', { noSelfLinks = true } )— Remove self linksget( 'Title#Section', { noBehaviorSwitches = true } )— Remove behavior switches such as__NOTOC__get( 'Title#Section', { fixReferences = true } )— 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 get 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 main method. It's essentially a wrapper of the get method to make it usable for templates. See the documentation of the get method for more details and options.
{{#invoke:Transcluder|main|Title}}— Transclude the requested page{{#invoke:Transcluder|main|Title#}}— Transclude the lead section of the requested page{{#invoke:Transcluder|main|Title#Section}}— Get the requested section or <section> tag (includes any subsections){{#invoke:Transcluder|main|Title#Section|sections=0}}— Transclude the requested section, excluding subsections{{#invoke:Transcluder|main|Title|only=files|files=1}}— Transclude only the first file of the page{{#invoke:Transcluder|main|Title#Section|only=tables|tables=2}}— Transclude only the second table of the requested section{{#invoke:Transcluder|main|Title#|only=paragraphs|linkBold=yes}}— Transclude only the paragraphs of the lead section and link the bold text
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.









