Difference between revisions of "Ref2"

From Sega Retro

(Created page with "<includeonly>{{#vardefine:reflink|}}{{#loop:i |1 |{{#var:refcount|1}} |{{#ifeq:{{{1}}}|{{#var:ref_{{#var:i}}}} |{{#vardefine:reflink|{{#var:i}}}}<!-- Match found with previou...")
 
Line 1: Line 1:
<includeonly>{{#vardefine:reflink|}}{{#loop:i
+
<includeonly>{{#vardefine:reflink|}}{{#if: {{#pos:{{{1}}}|http://}}{{#pos:{{{1}}}|https://}}{{#pos:{{{1}}}|ftp://}}
 +
|{{#vardefine:refcontent|{{{1}}}}}<!-- Ref is a link. Use text as-is. -->
 +
|{{#vardefine:refcontent|File:{{{1}}}{{#if:{{{page|}}}|, page {{{page}}}}}}}<!-- Ref is a file. -->
 +
}}{{#loop:i
 
|1
 
|1
 
|{{#var:refcount|1}}
 
|{{#var:refcount|1}}
|{{#ifeq:{{{1}}}|{{#var:ref_{{#var:i}}}}
+
|{{#ifeq:{{#var:refcontent}}|{{#var:ref_{{#var:i}}}}
 
  |{{#vardefine:reflink|{{#var:i}}}}<!-- Match found with previously used ref. -->
 
  |{{#vardefine:reflink|{{#var:i}}}}<!-- Match found with previously used ref. -->
 
  |
 
  |
Line 8: Line 11:
 
}}{{#if: {{#var:reflink}}
 
}}{{#if: {{#var:reflink}}
 
|
 
|
|{{incvar|refcount}}{{#vardefine:ref_{{#var:refcount}}|{{{1}}}}}{{#vardefine:reflink|{{#var:refcount}}}}<!-- This is a new ref. Add it to the list. -->
+
|{{incvar|refcount}}{{#vardefine:ref_{{#var:refcount}}|{{#var:refcontent}}}}{{#vardefine:reflink|{{#var:refcount}}}}<!-- This is a new ref. Add it to the list. -->
 
}}<sup>[[#ref_{{#var:reflink}}|[{{#var:reflink}}]]]</sup></includeonly><noinclude>
 
}}<sup>[[#ref_{{#var:reflink}}|[{{#var:reflink}}]]]</sup></includeonly><noinclude>
  
 
==Usage==
 
==Usage==
This is an example.{{ref2|http://google.com}} And another example.{{ref2|http://en.wikipedia.org}} Same as first.{{ref2|http://google.com}}
+
This is an example.{{ref2|http://google.com}} And another example.{{ref2|http://en.wikipedia.org}} Same as first.{{ref2|http://google.com}} Third.{{ref2|http://sonicretro.org}}
 +
 
 +
This is a fileref.{{ref2|CVG UK 090.pdf|page=12}} Fileref without page.{{ref2|Sonic1 title.png}}
  
 
{{#var:refcount}}
 
{{#var:refcount}}
# {{#var:ref_1}}
+
{{refs}}
# {{#var:ref_2}}
 
# {{#var:ref_3}}
 
 
</noinclude>
 
</noinclude>

Revision as of 10:33, 19 August 2016


Usage

This is an example.[1] And another example.[2] Same as first.[1] Third.[3]

This is a fileref.[4] Fileref without page.[5]

5

  1. Expression error: Unexpected > operator. http://google.com
  2. Expression error: Unexpected > operator. http://en.wikipedia.org
  3. Expression error: Unexpected > operator. http://sonicretro.org
  4. Expression error: Unexpected > operator. File:CVG UK 090.pdf, page 12Media:CVG UK 090.pdf
  5. Expression error: Unexpected > operator. File:Sonic1 title.pngMedia:Sonic1 title.png