6,566
edits
(Improved language support by autodetection from the page title if the 'lang' parameter is not supplied. The logic is copied and modified from {{LangSwitch}}.) |
(Fix and expansion for the automatic language support.) |
||
Line 1: | Line 1: | ||
<span class="plainlinks">[https://{{{lang|{{#if | <span class="plainlinks">[https://<!-- | ||
-->{{{lang|{{#if: {{#titleparts: {{PAGENAME}} | 1}} <!-- Does the page have a language prefix/language code? --> | |||
| {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} <!-- If the page does have a language prefix, use the contents of the parameter with that language code. --> | |||
}}}}}.wikipedia.org/<!-- | | en <!-- If lang is empty or undefined and there is no language prefix, use the English content. --> | ||
}}<!-- | |||
-->}}}.wikipedia.org/<!-- | |||
-->{{#if: {{{diff|}}} <!-- Is there a diff parameter and a permalink should be used? --> | -->{{#if: {{{diff|}}} <!-- Is there a diff parameter and a permalink should be used? --> | ||
| <!-- Yes there is a diff parameter, use permalink --> | | <!-- Yes there is a diff parameter, use permalink --> | ||
Line 17: | Line 19: | ||
-->{{#if: {{{oldid|}}} <!-- Is there an oldid parameter? --> | -->{{#if: {{{oldid|}}} <!-- Is there an oldid parameter? --> | ||
| <!-- Yes there is an oldid parameter --> | | <!-- Yes there is an oldid parameter --> | ||
(<span class="plainlinks">[https://{{{lang|en}}}.wikipedia.org/w/index.php?title={{urlencode:{{{ | (<span class="plainlinks">[https://<!-- | ||
-->{{{lang|{{#if: {{#titleparts: {{PAGENAME}} | 1}} <!-- Does the page have a language prefix/language code? --> | |||
| {{lc: {{#titleparts: {{PAGENAME}} | 1}} }} <!-- If the page does have a language prefix, use the contents of the parameter with that language code. --> | |||
| en <!-- If lang is empty or undefined and there is no language prefix, use the English content. --> | |||
}}<!-- | |||
-->}}}.wikipedia.org/w/index.php?title={{urlencode:{{{2|Main Page}}}|wiki}}<!-- | |||
-->{{#if: {{{diff|}}} <!-- Is there also a non-empty diff parameter? --> | -->{{#if: {{{diff|}}} <!-- Is there also a non-empty diff parameter? --> | ||
| <!-- Yes, there there also a non-empty diff parameter, show a link to the diff --> | | <!-- Yes, there there also a non-empty diff parameter, show a link to the diff --> |