Difference between revisions of "Template:References"

From SEQwiki
Jump to: navigation, search
(Improving template to let it work properly in arbitrary namespaces (not just MAIN))
(Add altmetric score to template)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
<noinclude>This template is added to a page to add references to the page.
 
<noinclude>This template is added to a page to add references to the page.
 +
 +
== TODO ==
 +
Rewrite using multiple instance templates!
  
  
Line 5: Line 8:
  
 
== Template code ==
 
== Template code ==
</noinclude><includeonly>
+
</noinclude><includeonly> <!-- Make a list of references -->
 
<H2> References </H2>
 
<H2> References </H2>
 
{{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]]
 
{{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]]
Line 17: Line 20:
 
}}
 
}}
  
{{#stripnewlines: <!-- This function suppresses whitespace in the output -->
+
{{#stripnewlines:
 +
 
 +
<!-- The #stripnewlines function above suppresses
 +
    vertical white-space in the output, which is nice. -->
 +
 
 +
<!-- We pull in citation, reference counts, and altmetrics from
 +
    the underlying Reference pages -->
  
 
{{#set: Number of citations = {{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]]
 
{{#set: Number of citations = {{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]]
 
     |? Number of citations
 
     |? Number of citations
     | format=sum
+
     |format=sum
     | default=0
+
     |default=0
 
   }}
 
   }}
 
}}
 
}}
  
 
{{#set: Number of references = {{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]] [[Number of citations::+]]
 
{{#set: Number of references = {{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]] [[Number of citations::+]]
     | format=count
+
     |format=count
     | default=0
+
     |default=0
 
   }}
 
   }}
 
}}
 
}}
  
 +
{{#set: Altmetric score = {{#ask: [[Category:Reference]] [[Reference describes::{{FULLPAGENAME}}]]
 +
    |? Altmetric score
 +
    |format=sum
 +
    |default=0
 +
  }}
 
}}
 
}}
  
 +
 +
}} <!-- close #stripnewlines -->
 +
 +
<!-- Create links to add references -->
 
To add a reference for {{FULLPAGENAME}}, enter the PubMed ID in the field below and click 'Add'.
 
To add a reference for {{FULLPAGENAME}}, enter the PubMed ID in the field below and click 'Add'.
 
{{#forminput: form=Reference
 
{{#forminput: form=Reference
   | size=10
+
   |size=10
   | default value=19002165
+
   |default value=19002165
   | button text=Add  
+
   |button text=Add  
   | query string=Reference[reference describes]={{FULLPAGENAME}}
+
   |query string=Reference[reference describes]={{FULLPAGENAME}}
 
}}
 
}}
 
</includeonly>
 
</includeonly>

Latest revision as of 13:24, 24 August 2015

This template is added to a page to add references to the page.

TODO

Rewrite using multiple instance templates!

Template code