User:Wildgoosespeeder/MediaLink: Difference between revisions

From the Super Mario Wiki, the Mario encyclopedia
Jump to navigationJump to search
m (Found a red link bug. Corrected with a Parser Function.)
m (Text replacement - "({{|[Tt]em\|)[Mm]edia link" to "$1file link")
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{#ifexist: File:{{{1}}}|[[:File:{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<span style="display:none;">}}[[Media:{{{1}}}]]{{#ifexist: File:{{{1}}}|</span>}}</includeonly><noinclude>
<includeonly>{{#ifexist:File:{{{1}}}|[[:File:{{{1}}}{{#if:{{{2|}}}|{{!}}{{{2}}}}}]]<span style="display:none;">}}[[Media:{{{1}}}{{#ifexist:File:{{{1}}}||{{!}}{{#if:{{{2|}}}|{{{2}}}|File:{{{1}}}}}}}]]{{#ifexist:File:{{{1}}}|</span>}}</includeonly><noinclude>
{{DISPLAYTITLE:Template:MediaLink}}
{{User:Wildgoosespeeder/AlertForUsers}}
{{DISPLAYTITLE:Template:File link}}
{{proposal archive|2|Archive 46#%7B%7Bmedia link%7D%7D Template|<nowiki>{{file link}}</nowiki> Template|Wildgoosespeeder|January 8|green}}
==Usage==
==Usage==
Template idea for the prefix "Media:"
Template idea for the prefix <code>Media:</code>.


===Media: vs. :File:===
===Media: vs. :File:===
Line 12: Line 14:
! [[Special:UnusedFiles]] prevention
! [[Special:UnusedFiles]] prevention
! Provides a file page link
! Provides a file page link
! Provides a special link to [[Special:Upload]] if [[red link]] is detected
|-
|-
! <code>Media:</code>
! <code>Media:</code>
| [[Media:Alternate screen.png]]
| [[Media:MK8 Electrodrome Alternate Screen.png]]<br>[[Media:aeilsdfilasjdl.png]]
| [[File:Check mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:Check mark.svg|25px]]
|-
|-
! <code>:File:</code>
! <code>:File:</code>
| [[:File:Alternate screen.png]]
| [[:File:MK8 Electrodrome Alternate Screen.png]]<br>[[:File:aeilsdfilasjdl.png]]
| [[File:X mark.svg|25px]]
| [[File:X mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:Check mark.svg|25px]]
| [[File:X mark.svg|25px]]
|}
|}


Line 27: Line 32:


===Use Cases===
===Use Cases===
{{tem|MediaLink}} testing for bugs:
{{tem|file link}} testing for bugs:
{| class="wikitable"
{| class="wikitable"
! [[mediawiki.org:Main Page|MediaWiki]] parsing
! [[mw:Main Page|MediaWiki]] parsing
! Code
! Code
|-
|-
! {{{{FULLPAGENAME}}|Alternate screen.png}}
! {{{{FULLPAGENAME}}|MK8 Electrodrome Alternate Screen.png}}
| <code><nowiki>{{MediaLink|Alternate screen.png}}</nowiki></code>
| <code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png}}</nowiki></code>
|-
! {{{{FULLPAGENAME}}|MK8 Electrodrome Alternate Screen.png|}}
| <code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png|}}</nowiki></code>
|-
|-
! {{{{FULLPAGENAME}}|Alternate screen.png|}}
! {{{{FULLPAGENAME}}|MK8 Electrodrome Alternate Screen.png|test}}
| <code><nowiki>{{MediaLink|Alternate screen.png|}}</nowiki></code>
| <code><nowiki>{{file link|MK8 Electrodrome Alternate Screen.png|test}}</nowiki></code>
|-
|-
! {{{{FULLPAGENAME}}||test}}
! {{{{FULLPAGENAME}}||test}}
| <code><nowiki>{{MediaLink||test}}</nowiki></code>
| <code><nowiki>{{file link||test}}</nowiki></code>
|-
! {{{{FULLPAGENAME}}||}}
| <code><nowiki>{{file link||}}</nowiki></code>
|-
! {{{{FULLPAGENAME}}|}}
| <code><nowiki>{{file link|}}</nowiki></code>
|-
! {{{{FULLPAGENAME}} }}
| <code><nowiki>{{file link}}</nowiki></code>
|-
! {{{{FULLPAGENAME}}|aeilsdfilasjdl.png}}
| <code><nowiki>{{file link|aeilsdfilasjdl.png}}</nowiki></code>
|-
|-
! {{{{FULLPAGENAME}}|Alternate screen.png|test}}
! {{{{FULLPAGENAME}}|aeilsdfilasjdl.png|}}
| <code><nowiki>{{MediaLink|Alternate screen.png|test}}</nowiki></code>
| <code><nowiki>{{file link|aeilsdfilasjdl.png|}}</nowiki></code>
|-
|-
! {{{{FULLPAGENAME}}|aeilsdfilasjdl.png|test}}
! {{{{FULLPAGENAME}}|aeilsdfilasjdl.png|test}}
| <code><nowiki>{{MediaLink|Alternate screen.png|test}}</nowiki></code>
| <code><nowiki>{{file link|aeilsdfilasjdl.png|test}}</nowiki></code>
|}
|}


===Other===
===Other===
Uses <code>{{tem|!}}</code>. Also hides media prefix usage with <nowiki><span></nowiki> tag and a simple CSS code.
Uses <code><nowiki>{{!}}</nowiki></code>. Also hides media prefix usage with <nowiki><span></nowiki> tag and a simple CSS code. Special code implemented if a red link results from the file string specified.
</noinclude>
</noinclude>

Latest revision as of 09:01, June 4, 2024

Warning.svg
ATTENTION EDITORS If you are moving files that this page links to, you have my permission to ask a sysop to change the link. If you are replacing images that this page links to instead, please leave me a message to give me a heads-up. Thank you! Wildgoosespeeder (talk) (Stats - Contribs)
#2 • {{file link}} Template, Wildgoosespeeder (ended January 8)

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 Provides a special link to Special:Upload if red link is detected
Media: Media:MK8 Electrodrome Alternate Screen.png
Media:aeilsdfilasjdl.png
Check mark.svg X mark.svg Check mark.svg
:File: File:MK8 Electrodrome Alternate Screen.png
File:aeilsdfilasjdl.png
X mark.svg Check mark.svg X mark.svg

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

{{file link}} testing for bugs:

MediaWiki parsing Code
File:MK8 Electrodrome Alternate Screen.pngMedia:MK8 Electrodrome Alternate Screen.png {{file link|MK8 Electrodrome Alternate Screen.png}}
File:MK8 Electrodrome Alternate Screen.pngMedia:MK8 Electrodrome Alternate Screen.png {{file link|MK8 Electrodrome Alternate Screen.png|}}
testMedia:MK8 Electrodrome Alternate Screen.png {{file link|MK8 Electrodrome Alternate Screen.png|test}}
[[Media:|test]] {{file link||test}}
[[Media:|File:]] {{file link||}}
[[Media:|File:]] {{file link|}}
[[Media:{{{1}}}|File:{{{1}}}]] {{file link}}
File:aeilsdfilasjdl.png {{file link|aeilsdfilasjdl.png}}
File:aeilsdfilasjdl.png {{file link|aeilsdfilasjdl.png|}}
test {{file link|aeilsdfilasjdl.png|test}}

Other

Uses {{!}}. Also hides media prefix usage with <span> tag and a simple CSS code. Special code implemented if a red link results from the file string specified.