User:Wildgoosespeeder/MediaLink: Difference between revisions
From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
m (Undo revision 2114118 by Wildgoosespeeder (talk)) |
m (Found a red link bug. Corrected with a Parser Function.) |
||
Line 1: | Line 1: | ||
<includeonly>[[:File:{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<span style="display:none;">[[Media:{{{1}}}]]</span></includeonly><noinclude> | <includeonly>{{#ifexist: File:{{{1}}}|[[:File:{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<span style="display:none;">}}[[Media:{{{1}}}]]{{#ifexist: File:{{{1}}}|</span>}}</includeonly><noinclude> | ||
{{DISPLAYTITLE:Template:MediaLink}} | {{DISPLAYTITLE:Template:MediaLink}} | ||
==Usage== | ==Usage== | ||
Line 42: | Line 42: | ||
|- | |- | ||
! {{{{FULLPAGENAME}}|Alternate screen.png|test}} | ! {{{{FULLPAGENAME}}|Alternate screen.png|test}} | ||
| <code><nowiki>{{MediaLink|Alternate screen.png|test}}</nowiki></code> | |||
|- | |||
! {{{{FULLPAGENAME}}|aeilsdfilasjdl.png|test}} | |||
| <code><nowiki>{{MediaLink|Alternate screen.png|test}}</nowiki></code> | | <code><nowiki>{{MediaLink|Alternate screen.png|test}}</nowiki></code> | ||
|} | |} |
Revision as of 17:31, January 2, 2017
Usage
Template idea for the prefix "Media:"
Media: vs. :File:
Both prefixes display a link instead of embedding the image itself but there are some key differences:
Prefix | Sample | Special:UnusedFiles prevention | Provides a file page link |
---|---|---|---|
Media:
|
Media:Alternate screen.png | ||
:File:
|
File:Alternate screen.png |
That's what this template addresses by bring the best of both worlds together. This template should be used in main articles only!
Use Cases
{{MediaLink}} testing for bugs:
MediaWiki parsing | Code |
---|---|
Media:Alternate screen.png | {{MediaLink|Alternate screen.png}}
|
Media:Alternate screen.png | {{MediaLink|Alternate screen.png|}}
|
[[Media:]] | {{MediaLink||test}}
|
Media:Alternate screen.png | {{MediaLink|Alternate screen.png|test}}
|
Media:aeilsdfilasjdl.png | {{MediaLink|Alternate screen.png|test}}
|
Other
Uses {{!}}
. Also hides media prefix usage with <span> tag and a simple CSS code.