Difference between revisions of "Template:FormatResourceTitle"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
  
 
'''Parameters:'''
 
'''Parameters:'''
* <code><nowiki>|title=</nowiki></code> - the resource, e.g. Sebastien (2016).
+
* <code><nowiki>|title=</nowiki></code> - the title of the resource, e.g. "The Laws of Scientific Change".
 
   
 
   
 
</noinclude><includeonly><!--
 
</noinclude><includeonly><!--
 
-->{{#if: {{{title|}}}|<!--
 
-->{{#if: {{{title|}}}|<!--
-->{{#vardefine: varLength|{{#len:{{{title|}}}}} }}<!--
+
  -->{{#vardefine: varEndChar|{{#sub:{{{title}}}|-1}} }}<!--
-->
 
Length: {{#var:varLength}}
 
 
 
<!--
 
  -->{{#vardefine: varEndChar|{{#sub:{{{title}}}|{{#var:varLength}}-1|1}} }}<!--
 
-->
 
End Char: {{#var:varEndChar}}
 
 
 
<!--
 
 
  -->{{#switch: {{#var:varEndChar}} <!--
 
  -->{{#switch: {{#var:varEndChar}} <!--
   -->|.={{{title}}}<!--
+
   -->|&#33;<!--
   -->|?={{{title}}}<!--
+
   -->|&#46;<!--
   -->|!={{{title}}}<!--
+
   -->|&#63;={{{title}}}<!--
 
   -->|#default={{{title}}}&#46;<!--
 
   -->|#default={{{title}}}&#46;<!--
 
  -->}}<!-- switch
 
  -->}}<!-- switch

Latest revision as of 14:00, 13 April 2017

Use this template to properly format the title of the resource. If the resource title doesn't end with a period, question mark, or exclamation mark, a period is added to the title.

NOTE: As any "printing" template, it doesn't store any values anywhere, but merely prints them on the page.

Parameters:

  • |title= - the title of the resource, e.g. "The Laws of Scientific Change".