Template:LinkLexicon: Difference between revisions

From LifeWiki
Jump to navigation Jump to search
Let's try and use {{#switch:}} instead of nested {{#ifeq:}}'s.
remove "www." from URLs, as they are no longer canonical
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#switch: {{{style|listitem}}}  
<includeonly>{{#switch: {{{style|listitem}}}  
| listitem = * [http://www.conwaylife.com/ref/lexicon/{{{filename|{{{1}}}}}} {{{name|{{{patternname|{{PAGENAME}}}}}}}}] at the Life Lexicon
| listitem = * [https://conwaylife.com/ref/lexicon/{{{filename|{{{1}}}}}} {{{name|{{{patternname|{{PAGENAME}}}}}}}}] at the [[Life Lexicon]]
| raw      = [http://www.conwaylife.com/ref/lexicon/{{{filename|{{{1}}}}}} {{{name|{{{patternname|{{{filename|{{{1}}}}}}}}}}}}]
| raw      = [https://conwaylife.com/ref/lexicon/{{{filename|{{{1}}}}}} {{{name|{{{patternname|{{{filename|{{{1}}}}}}}}}}}}]
}} [[Category:Pages that link to the Life Lexicon]]</includeonly><noinclude>This is a template for including links to the '''[http://www.conwaylife.com/ref/lexicon/lex_home.htm Life Lexicon]''' in the "External Links" section of an article. It can take three parameters:
}} [[Category:Pages that link to the Life Lexicon]]</includeonly><noinclude>This is a template for including links to the '''[https://conwaylife.com/ref/lexicon/lex_home.htm Life Lexicon]''' in the "External Links" section of an article. It can take three parameters:


* ''filename'', which specifies the HTML file (including anchor) that will be linked to on the Life Lexicon;
* ''filename'', which specifies the HTML file (including anchor) that will be linked to on the Life Lexicon;
* ''patternname'' (alternatively: ''name''), which specifies the name of the pattern as it will appear in the link text (default: name of the current article for style=listitem, or filename for style=raw);
* ''patternname'' (alternatively: ''name''), which specifies the name of the pattern as it will appear in the link text (default: name of the current article for style=listitem, or filename for style=raw);
* ''style'', which specifies how to format the link (style=listitem or style=raw; default: listitem)
* ''style'', which specifies how to format the link (style=listitem or style=raw; default: listitem)
'''Note''': if the Life Lexicon entry being linked to starts with a digit (i.e. the page being linked to is lex_1.htm), then the anchor should be prefixed with <tt>a-</tt>. When in doubt, view the HTML source for the Lexicon page you're linking to, and check what the exact anchor to use is.


Here is a simple example of its usage:
Here is a simple example of its usage:
Line 12: Line 14:
'''You type:'''
'''You type:'''


<tt><nowiki>{{LinkLexicon|filename=lex_1.htm#a1234|patternname=1-2-3-4}}</nowiki></tt>
<tt><nowiki>{{LinkLexicon|filename=lex_1.htm#a-1234|patternname=1-2-3-4}}</nowiki></tt>


'''You see:'''
'''You see:'''


* [http://www.conwaylife.com/ref/lexicon/lex_1.htm#a1234 1-2-3-4] at the Life Lexicon
* [https://conwaylife.com/ref/lexicon/lex_1.htm#a-1234 1-2-3-4] at the [[Life Lexicon]]


'''You type:'''
'''You type:'''


<tt><nowiki>{{LinkLexicon|filename=lex_1.htm#a1234|patternname=1-2-3-4|style=raw}}</nowiki></tt>
<tt><nowiki>{{LinkLexicon|filename=lex_1.htm#a-1234|patternname=1-2-3-4|style=raw}}</nowiki></tt>


'''You see:'''
'''You see:'''


[http://www.conwaylife.com/ref/lexicon/lex_1.htm#a1234 1-2-3-4]
[https://conwaylife.com/ref/lexicon/lex_1.htm#a-1234 1-2-3-4]


==See also==
==See also==

Latest revision as of 12:41, 3 February 2022

This is a template for including links to the Life Lexicon in the "External Links" section of an article. It can take three parameters:

  • filename, which specifies the HTML file (including anchor) that will be linked to on the Life Lexicon;
  • patternname (alternatively: name), which specifies the name of the pattern as it will appear in the link text (default: name of the current article for style=listitem, or filename for style=raw);
  • style, which specifies how to format the link (style=listitem or style=raw; default: listitem)

Note: if the Life Lexicon entry being linked to starts with a digit (i.e. the page being linked to is lex_1.htm), then the anchor should be prefixed with a-. When in doubt, view the HTML source for the Lexicon page you're linking to, and check what the exact anchor to use is.

Here is a simple example of its usage:

You type:

{{LinkLexicon|filename=lex_1.htm#a-1234|patternname=1-2-3-4}}

You see:

You type:

{{LinkLexicon|filename=lex_1.htm#a-1234|patternname=1-2-3-4|style=raw}}

You see:

1-2-3-4

See also