Difference between revisions of "Transclusionism"
From Mondothèque
Dickreckard (talk | contribs) (→How it shows up:) |
Dickreckard (talk | contribs) |
||
Line 10: | Line 10: | ||
== How it shows up: == | == How it shows up: == | ||
− | For example, this is how a transclusion from a labelled section | + | For example, this is how a transclusion from a labelled section of the [[Xanadu]] article on the wiki appears: |
{{RT|xanadu}} | {{RT|xanadu}} | ||
Revision as of 16:02, 2 August 2016
Contents
How to transclude labelled sections between texts:
To create transclusions between different texts, you need to select a section of text that will form a connection between the pages, based on a common subject:
- Think of a category that is the common ground for the link. For example if two texts refer to a similar issue or specific concept (eg. '
rawdata
'), formulate it without spaces or using underscores (eg. 'raw_data
', not 'raw data
' ); - Edit the two or more pages which you want to link, adding
{{RT|rawdata}}<section begin=rawdata />
before the text section, and<section end=rawdata />
at the end (take care of the closing '/>
' ); - All text sections in other wiki pages that are marked up through the same common ground, will be transcluded in the margin of the text.
How it shows up:
For example, this is how a transclusion from a labelled section of the Xanadu article on the wiki appears:
How it works:
The <section>
code is used by the 'Labeled Section Transclusion' extension, which looks for the tagged sections in a text, to transclude them into another text based on the assigned labels.
The {{RT|rawdata}}
instead, creates the side links by transcluding the Template:RT page, substituting the word rawdata
in its internal code, in place of {{{1}}}
. This is the commented content of Template:RT:
# Puts the trancluded sections in its own div: <div class="side"> # Searches semantically for all the pages in the # requested category, puts them in an array: {{#ask: [[Category:{{{1}}}]]|format=array | name=results }} # Starts a loop, going from 0 to the amount of pages # in the array: {{#loop: looper | 0 | {{#arraysize: results}} # If the pagename of the current element of the array # is the same as the page calling the loop, it will skip # the page: | {{#ifeq: {{FULLPAGENAME: {{#arrayindex: results | {{#var:looper}} }} }} | {{FULLPAGENAME}} | | {{#lst: # Otherwise it searches through the current page in the # loop, for all the occurrences of labeled sections: {{#arrayindex: results | {{#var:looper}} }} | {{{1}}} }} # Adds a link to the current page in loop: ([[{{#arrayindex: results | {{#var:looper}} }}]]) # Adds some space after the page: <br /><br /> # End of pagename if statement: }} # End of loop: }} # Closes div: </div> # Adds the page to the label category: [[category:{{{1}}}]]
Necessaire
Currently, on top of MediaWiki and SemanticMediaWiki, the following extensions needed to be installed for the contraption to work:
- Labeled Section Transclusion to be able to select specific sections of the texts and make connections between them;
- Parser Functions to be able to operate statements like
if
in the wiki pseudo-language; - Arrays to create lists of objects, for example as a result of semantic queries;
- Loops to loop between the arrays above;
- Variables as it's needed by some of the above.