Difference between revisions of "Template:Cite"

From AlchemistryWiki
Jump to navigation Jump to search
m
Line 1: Line 1:
<includeonly>
+
<includeonly>{{#if: {{#pos:<noinclude>{{#tag:ref||name={{{1}}} }}</noinclude>|Cite error|0}}<!--
{{#if: {{#pos:<noinclude>{{#tag:ref||name={{{1}}} }}</noinclude>|Cite error|0}}  
+
  -->|{{#if:{{{2}}}<!--
  | {{#tag:ref|{{{2}}} - {{URL |{{{3}}}| Find at Cite-U-Like}}| name={{{1}}} }}  
+
  -->|{{#if:{{{3}}}<!--
  | {{#tag:ref||name={{{1}}} }} }}
+
  -->|{{#tag:ref|{{{2}}} - {{URL |{{{3}}}| Find at Cite-U-Like}}| name={{{1}}} }}<!--
</includeonly><!--
+
  -->|{{#tag:ref|{{{2}}} | name={{{1}}} }}<!--
 +
  -->}}<!--
 +
  -->|{{#tag:ref||name={{{2}}} }}<!--Should Throw error
 +
  -->}}<!--
 +
  -->|{{#tag:ref||name={{{1}}} }}<!--
 +
-->}}</includeonly><!--
  
 
--><noinclude>
 
--><noinclude>

Revision as of 09:45, 24 September 2012

USAGE:

{{Cite | SHORTCUT NAME TO USE LATER | FULL NORMAL CITATION | CITE-U-LIKE LINK}}

It should be noted that this page does have a "references" at the bottom of it, but that is not part of the template, you will need to include a "<references />" at the end of your document

If you have already used this reference name once, then you can simply use the {{Cite | REF NAME}}

For those of you wanting to see how and why this works, please check the following pages (in no particular order): String Parsing, Parser Logic, Magic words for refs inside templates, includeonly and noinclude, And understanding that the <!-- ... -> is the html equivalent of a comment and without it, the extra whitespace would be parsed into the template as well. The noinclude inside the #pos word is to ensure the citation is not done twice.

TEST This is a self consistent Test[1] ...and this is a break test [2] ...and a generic reftest[3]

  1. fullcite - Find at Cite-U-Like
  2. {{{2}}} - [{{{3}}} Find at Cite-U-Like]
  3. Cite error: Invalid <ref> tag; no text was provided for refs named breakme