Help:Contents: Difference between revisions

From The Jolly Contrarian
Jump to navigation Jump to search
Line 23: Line 23:


====Auto-taxonomising templates====
====Auto-taxonomising templates====
Say I want to create a series of templates with a given naming convention, I can make a template to do this with dynamic inputs that WSD could specify to get the right one. For example, I can create [[Template:ISDAclause]] which contains the following: <nowiki>[[Template: ISDA 2002 Schedule {{{1}}} {{{2}}} {{{3}}} {{{4}}} {{{5}}}]]</nowiki> where  
Say I want to create a series of templates with a given naming convention, I can make a template to do this with dynamic inputs that WSD could specify to get the right one. For example, I can create [[Template:ISDAclause]] which contains the following: <nowiki>[[Template: {{{1}}} {{{2}}} {{{3}}} {{{4}}} {{{5}}} {{{6}}} {{{7}}} {{{8}}}]]</nowiki> where  
* <nowiki>{{{1}}}</nowiki> is "client" (eg Barclays)  
* <nowiki>{{{1}}}</nowiki> is Publisher
* <nowiki>{{{2}}}</nowiki> is counterparty type;  
* <nowiki>{{{2}}}</nowiki> is Edition;
* <nowiki>{{{3}}}</nowiki> is eligible jurisdiction;
* <nowiki>{{{3}}}</nowiki> is Document;
* <nowiki>{{{4}}}</nowiki> is clause reference; and  
* <nowiki>{{{4}}}</nowiki> is Client (e.g. Barclays)  
* <nowiki>{{{5}}}</nowiki> is status
* <nowiki>{{{5}}}</nowiki> is Counterparty type;  
* <nowiki>{{{6}}}</nowiki> is eligible jurisdiction;
* <nowiki>{{{7}}}</nowiki> is clause reference; and  
* <nowiki>{{{8}}}</nowiki> is status


Therefore, writing: '''<nowiki>{{ISDAclause|Barclays|Corporate|All|5(a)(vii)|Preferred}}</nowiki>''' will render as {{ISDAclause|Barclays|Corporate|All|5(a)(vii)|Preferred}}. Navigating to this page to deposit the relevant text is therefore enforced. This page name  on the which page you contain the provision you want to call…
Therefore, writing: '''<nowiki>{{ISDAclauseTest|ISDA|2002|Schedule|Barclays|Corporate|All|5(a)(vii)|Preferred1}}</nowiki>''' will render as {{ISDAclauseTest|ISDA|2002|Schedule|Barclays|Corporate|All|5(a)(vii)|Preferred1}}.  
 
From there it is a snip to create compound templates to further enforce/ease workflow:
 
<nowiki>{{BarclaysISDA2002SchedulePreferred|COUNTERPARTY|CLAUSE}}</nowiki> is <nowiki>{{ISDAclauseTest|ISDA|2002|Schedule|Barclays|{{{1}}}|{{{2}}}|Preferred}}</nowiki>
 
and so on.

Revision as of 08:54, 16 July 2012

MediaWiki has a form of markup text behind it that does '''bold''' and [[hyperlinks]] and so on). It also allows you to call Templates – which are a special type of page – by using {{double}} curly brackets for notation.

Example

Let's say Template:Example1 contains the text:

The cat sat on the mat.  

To call the content of Template:Example1 on another page you insert {{Example1}}. This renders on the main page as:

The cat sat on the mat.

Enhanced things you can do with Templates

Embedding named or numbered variables in templates

You can do this by enclosing them in {{{triple}}} curly brackets. So, if Template:Example2 reads:

The {{{1}}} {{{2}}} on the {{{3}}}. 

Inserting {{Example2|Frog|stood|Hippopotamus}}, will render as:

The Frog stood on the Hippopotamus.

Embedding templates in templates

You can do this by using curly quotes on a template page to call another template. So, if Template:Example3 reads

The {{{1}}} rolled over and lit a {{{2}}}. {{Example2|{{{1}}}|sat|sofa}}

Inserting {{Example3|dog|cigarette}} will render as:

The dog rolled over and lit a cigarette. The dog sat on the sofa.

Auto-taxonomising templates

Say I want to create a series of templates with a given naming convention, I can make a template to do this with dynamic inputs that WSD could specify to get the right one. For example, I can create Template:ISDAclause which contains the following: [[Template: {{{1}}} {{{2}}} {{{3}}} {{{4}}} {{{5}}} {{{6}}} {{{7}}} {{{8}}}]] where

  • {{{1}}} is Publisher
  • {{{2}}} is Edition;
  • {{{3}}} is Document;
  • {{{4}}} is Client (e.g. Barclays)
  • {{{5}}} is Counterparty type;
  • {{{6}}} is eligible jurisdiction;
  • {{{7}}} is clause reference; and
  • {{{8}}} is status

Therefore, writing: {{ISDAclauseTest|ISDA|2002|Schedule|Barclays|Corporate|All|5(a)(vii)|Preferred1}} will render as Template:ISDAclauseTest.

From there it is a snip to create compound templates to further enforce/ease workflow:

{{BarclaysISDA2002SchedulePreferred|COUNTERPARTY|CLAUSE}} is {{ISDAclauseTest|ISDA|2002|Schedule|Barclays|{{{1}}}|{{{2}}}|Preferred}}

and so on.