Template:Media link: Difference between revisions

m
no edit summary
m (Text replacement - "(mediawiki\.org|MediaWiki\.org|Mediawiki\.org|Mediawiki\.Org|MediaWiki\.Org|MEDIAWIKI\.ORG|mediaWiki\.org|mediaWiki\.Org):" to "mww:")
mNo edit summary
 
(6 intermediate revisions by 4 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}}}||{{!}}{{#if:{{{2|}}}|{{{2}}}|File:{{{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>
==Usage==
== Usage ==
Template idea for the prefix <code>Media:</code>.
Template idea for the prefix <code>Media:</code>.


===Media: vs. :File:===
=== Media: vs. :File: ===
Both prefixes display a link instead of embedding the image itself but there are some key differences:
Both prefixes display a link instead of embedding the image itself but there are some key differences:


Line 11: Line 11:
! [[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
! Provides a special link to [[Special:Upload]] if a [[red link]] has been detected
|-
|-
! <code>Media:</code>
! <code>Media:</code>
Line 26: Line 26:
|}
|}


That's what this template addresses by bring the best of both worlds together. This template should be used in '''main articles only'''!
This template addresses these differences by bringing the best of both worlds together. Please note that this template should be used in '''main articles only'''.


===Use Cases===
=== Use cases ===
{{tem|media link}} testing for bugs:
{{tem|media link}} testing for bugs:
{| class="wikitable"
{| class="wikitable"
! [[mww:Main Page|MediaWiki]] parsing
! [[mw:Main Page|MediaWiki]] parsing
! Code
! Code
|-
|-
Line 65: Line 65:
|}
|}


===Other===
=== Other ===
Uses <code>{{tem|!}}</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.
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.
 
[[Category:Formatting templates]]
[[Category:Formatting templates]]
[[Category:Media templates]]</noinclude>
[[Category:Media templates]]</noinclude>