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...") |
|||
(4 intermediate revisions by the same user not shown) | |||
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. --> | ||
+ | |{{#switch: {{fileext|{{{1}}}}} | png|jpg|jpeg|zip|7z|pdf={{#vardefine:refcontent|File:{{{1}}}{{#if:{{{page|}}}|, page {{{page}}}}}}}<!-- Ref is a file. --> | ||
+ | |#default={{#vardefine:refcontent|[[{{{1}}}]]}}<!-- Ref is an internal link. --> | ||
+ | }} | ||
+ | }}{{#loop:i | ||
|1 | |1 | ||
|{{#var:refcount|1}} | |{{#var:refcount|1}} | ||
− | |{{#ifeq:{{ | + | |{{#ifeq:{{#var:refcontent}}|{{#var:ref_{{#var:i}}}} |
− | |{{#vardefine:reflink|{{#var:i}}}}<!-- Match found with previously used ref. --> | + | |{{#vardefine:reflink|{{#var:i}}}}{{incvar|refuses_{{#var:reflink}}}}{{#vardefine:thisrefuse|{{#var:refuses_{{#var:reflink}}}}}}<!-- Match found with previously used ref. --> |
| | | | ||
}} | }} | ||
}}{{#if: {{#var:reflink}} | }}{{#if: {{#var:reflink}} | ||
| | | | ||
− | |{{incvar|refcount}}{{#vardefine:ref_{{#var:refcount}}|{{ | + | |{{incvar|refcount}}{{incvar|refuses_{{#var:refcount}}}}{{#vardefine:ref_{{#var:refcount}}|{{#var:refcontent}}}}{{#vardefine:reflink|{{#var:refcount}}}}{{#vardefine:thisrefuse|1}}<!-- This is a new ref. Add it to the list. --> |
− | }}<sup>[[#ref_{{#var:reflink}}|[{{#var:reflink}}]]]</sup></includeonly><noinclude> | + | }}<sup id="refback_{{#var:reflink}}_{{#var:thisrefuse}}">[[#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}} Internal ref.{{ref2|Sega Master System}} | ||
{{#var:refcount}} | {{#var:refcount}} | ||
− | + | {{refs}} | |
− | + | [[Category:Experimental templates]] | |
− | |||
</noinclude> | </noinclude> |