Difference between revisions of "Template:Main page image/sandbox"
Jump to navigation
Jump to search
test>ProcrastinatingReader |
test>ProcrastinatingReader (braces will get you every time) |
||
| Line 1: | Line 1: | ||
<div class="thumbinner mp-thumb" style="background: transparent; border: none; padding: 0; max-width: {{#invoke:Sandbox/ProcrastinatingReader/test|width|{{Remove file prefix|{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}{{#ifeq:{{{border|}}}|yes|+2}}}}px;"> | <div class="thumbinner mp-thumb" style="background: transparent; border: none; padding: 0; max-width: {{#invoke:Sandbox/ProcrastinatingReader/test|width|{{Remove file prefix|{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}{{#ifeq:{{{border|}}}|yes|+2}}}}px;"> | ||
| − | [[File:<!--if {{{image}} begins with File:/Image: remove it-->{{Remove file prefix|{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}{{#ifeq:{{{border|}}}|yes|{{!}}border|}}|<!-- generate width -->{{!}}{{#invoke:Sandbox/ProcrastinatingReader/test|width|{{Remove file prefix|{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}px <!-- title (use caption, alt text or non-default link target if not available) -->{{#if:{{{title|}}} | {{!}}{{{title}}} | {{#if:{{{caption|{{{2|}}}}}} | {{!}}{{{caption|{{{2|}}}}}} | {{!}}{{{alt|}}}}}}} <!-- alt text (use caption, title or image name if not available) --> {{#if:{{{alt|}}} | {{!}}alt={{{alt}}}}} <!--add link if exists-->{{#if:{{{link|}}} | {{#ifeq:{{remove file prefix|{{{link}}}}}|{{remove file prefix|{{{image}}}}}| <!--do nothing if {{{link}}} and {{{image}}} are the same-->| {{!}}link=File:{{remove file prefix|{{{link}}}}} }}<!--end #ifeq for link/image comparison--> }}<!--end #if for link-->]]{{#if: {{{caption|{{{2|<noinclude>Caption goes here.</noinclude>}}}}}}| | + | [[File:<!--if {{{image}} begins with File:/Image: remove it-->{{Remove file prefix|{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}{{#ifeq:{{{border|}}}|yes|{{!}}border|}}|<!-- generate width -->{{!}}{{#invoke:Sandbox/ProcrastinatingReader/test|width|{{Remove file prefix|{{{image|{{{1<noinclude>|Example-serious.jpg</noinclude>}}}}}}}}}}px <!-- title (use caption, alt text or non-default link target if not available) -->{{#if:{{{title|}}} | {{!}}{{{title}}} | {{#if:{{{caption|{{{2|}}}}}} | {{!}}{{{caption|{{{2|}}}}}} | {{!}}{{{alt|}}}}}}} <!-- alt text (use caption, title or image name if not available) --> {{#if:{{{alt|}}} | {{!}}alt={{{alt}}}}} <!--add link if exists-->{{#if:{{{link|}}} | {{#ifeq:{{remove file prefix|{{{link}}}}}|{{remove file prefix|{{{image}}}}}| <!--do nothing if {{{link}}} and {{{image}}} are the same-->| {{!}}link=File:{{remove file prefix|{{{link}}}}} }}<!--end #ifeq for link/image comparison--> }}<!--end #if for link-->]]{{#if: {{{caption|{{{2|<noinclude>Caption goes here.</noinclude>}}}}}}| |
<div class="thumbcaption" style="padding: 0.25em 0; word-wrap: break-word; {{#if:{{{caption align|}}} | text-align: {{{caption align}}};}}">{{{caption|{{{2|<noinclude>Caption goes here.</noinclude>}}}}}}</div>}}</div> | <div class="thumbcaption" style="padding: 0.25em 0; word-wrap: break-word; {{#if:{{{caption align|}}} | text-align: {{{caption align}}};}}">{{{caption|{{{2|<noinclude>Caption goes here.</noinclude>}}}}}}</div>}}</div> | ||
<noinclude> | <noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> | ||
Revision as of 09:59, 20 July 2020
<div class="thumbinner mp-thumb" style="background: transparent; border: none; padding: 0; max-width: Script error: No such module "Sandbox/ProcrastinatingReader/test".px;">
Caption goes here.
| This is the template sandbox page for Template:Main page image (diff). See also the companion subpage for test cases. |
This module provides utility for wrappers of {{Main page image}}.
Usage
{{#invoke:Main page image|width|ImageTitle}} Get image width from ImageTitle.
ImageTitle must not contain the namespace prefix (eg "File:"). You can use Template:T to strip it, if it exists, when sanitising template params. Example: {{#invoke:Main page image|width|{{Remove file prefix|{{{image}}}}}}}
| The above documentation is transcluded from Template:Main page image/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |
