Difference between revisions of "Transclusionism"

From Mondothèque

(How it works:)
(How it works:)
Line 29: Line 29:
 
  |                                                  #  It will skip the page;
 
  |                                                  #  It will skip the page;
 
  |          {{#lst:                                #  Otherwise it searches through the  
 
  |          {{#lst:                                #  Otherwise it searches through the  
    {{#arrayindex: results | {{#var:looper}}  }} #  current page in the loop for
+
        {{#arrayindex: results | {{#var:looper}}  }} #  current page in the loop for
 
  | {{{1}}}  }}                                      #  all the occurrences of labeled sections
 
  | {{{1}}}  }}                                      #  all the occurrences of labeled sections
 
([[{{#arrayindex: results | {{#var:looper}}  }}]])  #  Adds a link to the current page in loop;
 
([[{{#arrayindex: results | {{#var:looper}}  }}]])  #  Adds a link to the current page in loop;

Revision as of 14:39, 6 July 2016

This page documents some of the contraptions at work in the Mondotheque wiki. The name "transclusionism" refers to the term "transclusion" coined by utopian systems humanist Ted Nelson and used in Mediawiki to refer to inclusion of the same piece of text in between different pages.

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 the text sections in other wiki pages which are selected along the same common ground will be transcluded on the side of the text.

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:

<div class="side">                                   #  Puts the trancluded sections in its own
                                                     #  div;
{{#ask:                                              #  Searches semantically for all the pages
   [[Category:{{{1}}}]]|format=array | name=results  #  in the requested category, puts them in 
}}                                                   #  an array;
{{#loop: looper                                      #  Starts a loop,
 | 0                                                 #  Going from 0 to
 | {{#arraysize: results}}                           #  the amount of pages of the array, that:
 | {{#ifeq: {{FULLPAGENAME:                          #  If the pagename
          {{#arrayindex: results | {{#var:looper}}  }}  #  of the current element of the array
            }}                                       #  is the same as 
 |          {{FULLPAGENAME}}                         #  the page calling the loop,
 |                                                   #  It will skip the page;
 |           {{#lst:                                 #  Otherwise it searches through the 
        {{#arrayindex: results | {{#var:looper}}  }} #  current page in the loop for
 | {{{1}}}   }}                                      #  all the occurrences of labeled sections
([[{{#arrayindex: results | {{#var:looper}}  }}]])   #  Adds a link to the current page in loop;
<br /><br />                                         #  Adds some space after the page;
   }}                                                #  End of pagename if;
}}                                                   #  End of loop;
</div>                                               #  Closes div;
[[category:{{{1}}}]]                                 #  Adds the page to the label category.

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.
Last Revision: 6·07·2016

What links here