Difference between revisions of "Transclusionism"

From Mondothèque

 
(40 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page documents some of the contraptions at work in this wiki.
+
__NOTOC__
 +
<div class="book">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 [[L'UTOPISTE|Ted Nelson]] and used in Mediawiki to refer to inclusion of the same piece of text in between different pages.</div>
  
 +
== How to transclude labelled sections between texts: ==
  
===== How to transclude labeled sections between texts: =====
+
<section begin='xanadu' />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:
To create links between different pages, based on some selection of text that somehow connects the pages on the bases of some common ground:
 
* Think of a category that is the common ground for the link. (eg. '<code>rawdata</code>'), formulate it '''without spaces''' or using underscores (eg. '<code>raw_data</code>', not '<code>raw data</code>' );
 
* Edit the page and add <code><nowiki>{{RT|rawdata}}<section begin=rawdata /> </nowiki></code> before the text selection, and  <code><nowiki><section end=rawdata /></nowiki></code> at the end (take care of the '<code>/</code>', without it doesn't work);
 
* All the other text selections in other pages which are selected along the same common ground will be transcluded on the side of the text.
 
  
 +
* 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. '<code>rawdata</code>'), formulate it '''without spaces''' or using underscores (eg. '<code>raw_data</code>', not '<code>raw data</code>' );
 +
* Edit the two or more pages which you want to link, adding <code><nowiki>{{RT|rawdata}}<section begin=rawdata /> </nowiki></code> before the text section, and  <code><nowiki><section end=rawdata /></nowiki></code> at the end (take care of the closing '<code>/></code>' );
 +
* 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.<section end='xanadu' />
  
===== How it works: =====
+
== How it shows up: ==
The <code><nowiki><section></code></nowiki> 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.
+
For example, this is how a transclusion from a labelled section of the [[Xanadu]] article appears:
The <code><nowiki>{{RT|rawdata}}<section begin=rawdata /> </nowiki></code> instead, transcludes the RT Template, substituting the word <code>rawdata</code> in its internal code, in place of <code>{{{1}}}</code>. This is the commented content of Template:RT:
+
{{RT|xanadu}}
<pre><nowiki><div class="side">                                  #  Puts the trancluded sections on its own div;
+
 
                                                    #
+
== How it works: ==
{{#ask:                                              #  Searches semantically for all the pages in  
+
 
   [[Category:{{{1}}}]]|format=array | name=results # the requested category, puts them in an array;
+
The <code><nowiki><section></nowiki></code> 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.
}}                                                  #
+
 
{{#loop: looper                                     #  Starts a loop,
+
The <code><nowiki>{{RT|rawdata}} </nowiki></code> instead, creates the side links by transcluding the [[Template:RT]] page, substituting the word <code>rawdata</code> in its internal code, in place of <code>{{{1}}}</code>. This is the commented content of Template:RT:
  | 0                                                 #  Going from 0 to
+
 
  | {{#arraysize: results}}                           # the amount of pages of the array, that:
+
<pre><nowiki>
  | {{#ifeq: {{FULLPAGENAME:                         #  If the pagename
+
#  Puts the trancluded sections in its own div:
       {{#arrayindex: results | {{#var:looper}}  }} #    of the current element of the array
+
<div class="side">
             }}                                       #
+
# Searches semantically for all the pages in the
  |          {{FULLPAGENAME}}                         #    is the same as the page calling the loop,
+
# requested category, puts them in an array:                             
  |                     #    It will skip the page (no self-reference);
+
{{#ask:                                   
  |          {{#lst:                                 #     Otherwise it searches through the  
+
   [[Category:{{{1}}}]]|format=array | name=results
{{#arrayindex: results | {{#var:looper}}  }} #      current page in the loop for
+
}}
  | {{{1}}}  }}                                     #     all the occurrences of labeled sections
+
# Starts a loop, going from 0 to the amount of pages
([[{{#arrayindex: results | {{#var:looper}}  }}]])   #     Adds the name of the current page in loop;
+
# in the array:
<br /><br />                                         #    Adds some space after the page;
+
{{#loop: looper
  }}                                                #   End of pagename if;
+
  | 0                                              
}}                                                   #  End of loop;
+
  | {{#arraysize: results}}
</div>                                               Closes div;
+
# If the pagename of the current element of the array  
[[category:{{{1}}}]]                                 #  Adds the page to the label category.
+
# 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}}}]]
 
</nowiki></pre>
 
</nowiki></pre>
  
 +
== Necessaire ==
  
===== Necessaire: =====
+
Currently, on top of MediaWiki and SemanticMediaWiki, the following extensions needed to be installed for the contraption to work:
Currently on top of MediaWiki and SemanticMediaWiki, the following extensions needed to be installed for the contraption to work:
 
 
* [https://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Labeled Section Transclusion]  to be able to select specific sections of the texts and make connections between them;
 
* [https://www.mediawiki.org/wiki/Extension:Labeled_Section_Transclusion Labeled Section Transclusion]  to be able to select specific sections of the texts and make connections between them;
* [https://www.mediawiki.org/wiki/Extension:ParserFunctions Parser Functions] to be able to operate statements like if in the wiki pseudo-language;
+
* [https://www.mediawiki.org/wiki/Extension:ParserFunctions Parser Functions] to be able to operate statements like <pre>if</pre> in the wiki pseudo-language;
 
* [https://www.mediawiki.org/wiki/Extension:Arrays Arrays] to create lists of objects, for example as a result of semantic queries;
 
* [https://www.mediawiki.org/wiki/Extension:Arrays Arrays] to create lists of objects, for example as a result of semantic queries;
 
* [https://www.mediawiki.org/wiki/Extension:Loops Loops] to loop between the arrays above;
 
* [https://www.mediawiki.org/wiki/Extension:Loops Loops] to loop between the arrays above;
 
* [https://www.mediawiki.org/wiki/Extension:Variables Variables] as it's needed by some of the above.
 
* [https://www.mediawiki.org/wiki/Extension:Variables Variables] as it's needed by some of the above.
  
[[category:publication]]
+
{{Revision}}
 +
[[Category:Publication]]

Latest revision as of 16:09, 2 August 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 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 appears:

From Xanadu:
Every document can contain links of any type including virtual copies ("transclusions") to any other document in the system accessible to its owner.

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.
Last Revision: 2·08·2016

What links here