Template:Clean URL: Difference between revisions
Robertbaxter (talk | contribs) No edit summary |
Robertbaxter (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
<!-- This should probably become a Lua module at some point, the #if chaining is going to get cumbersome if too many more patterns are added --><includeonly><!-- | <!-- This should probably become a Lua module at some point, the #if chaining is going to get cumbersome if too many more patterns are added --><noinclude> | ||
This template cleans up the display of external URLs, to simplify how they are shown on the wiki. | |||
== Usage == | |||
The URL should be passed as the only parameter of template. | |||
<pre>{{clean URL|https://www.riso.co.jp/}}</pre> | |||
{{clean URL|https://www.riso.co.jp/}} | |||
=== Pattern recognition === | |||
Certain domains are recognized by this template, with custom simplification. | |||
==== Instagram ==== | |||
<pre>{{clean URL|https://www.instagram.com/risokagaku/}}</pre> | |||
{{clean URL|https://www.instagram.com/risokagaku/}} | |||
==== Archive.org ==== | |||
<pre>{{clean URL|https://web.archive.org/web/19990508115212/http://www4.mediagalaxy.co.jp/riso/}}</pre> | |||
{{clean URL|https://web.archive.org/web/19990508115212/http://www4.mediagalaxy.co.jp/riso/}} | |||
</noinclude><includeonly><!-- | |||
-->{{#ifexpr:{{#invoke:String|find|{{lc:{{{1|}}}}}|instagram.com}}>0 | -->{{#ifexpr:{{#invoke:String|find|{{lc:{{{1|}}}}}|instagram.com}}>0 | ||
|[{{{1|}}} @{{#rmatch:{{{1|}}}|/^(?:https?:\/\/)?(?:www\.)?(?:instagram.com\/)(.+?)\/?$/|\1}}] | |[{{{1|}}} @{{#rmatch:{{{1|}}}|/^(?:https?:\/\/)?(?:www\.)?(?:instagram.com\/)(.+?)\/?$/|\1}}] | ||
|{{#ifexpr:{{#invoke:String|find|{{lc:{{{1|}}}}}| | |{{#ifexpr:{{#invoke:String|find|{{lc:{{{1|}}}}}|archive.org}}>0 | ||
|[{{{1|}}} \[archived\]] | |[{{{1|}}} \[archived\]] | ||
|[{{{1|}}} {{#rmatch:{{{1|}}}|/^(?:https?:\/\/)?(?:www\.)?(.+?)\/?$/|\1}}] | |[{{{1|}}} {{#rmatch:{{{1|}}}|/^(?:https?:\/\/)?(?:www\.)?(.+?)\/?$/|\1}}] | ||
}} | }} | ||
}}</includeonly> | }}</includeonly> |
Revision as of 17:35, 17 December 2024
This template cleans up the display of external URLs, to simplify how they are shown on the wiki.
Usage
The URL should be passed as the only parameter of template.
{{clean URL|https://www.riso.co.jp/}}
Pattern recognition
Certain domains are recognized by this template, with custom simplification.
{{clean URL|https://www.instagram.com/risokagaku/}}
Archive.org
{{clean URL|https://web.archive.org/web/19990508115212/http://www4.mediagalaxy.co.jp/riso/}}