Difference between revisions of "Template:Ambox"

From Nottinghack Wiki
Jump to navigation Jump to search
(Created page with "{{#ifeq:{{{subst}}}|SUBST |{{#if:{{{name|}}} |{{error|Template {{tlx|{{{name}}}}} has been incorrectly substituted.}} }}[[Category:Pages with incorrectly substituted template...")
 
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#ifeq:{{{subst}}}|SUBST
+
<table class="metadata plainlinks ambox {{#switch:{{{type|}}} <!-- all styles present in CSS? -->
|{{#if:{{{name|}}}
+
| speedy    = ambox-speedy
   |{{error|Template {{tlx|{{{name}}}}} has been incorrectly substituted.}}
+
| delete    = ambox-delete
}}[[Category:Pages with incorrectly substituted templates]]
+
| content    = ambox-content
}}{{#ifeq:{{{small}}}|left
+
| style      = ambox-style
|{{Ambox/core
+
| move      = ambox-move
  |small     = left
+
| protection = ambox-protection
   |type      = {{{type|}}}
+
| notice    <!-- notice = default -->
  |image      = {{#if:{{{smallimage|}}}
+
| #default  = ambox-notice
  |{{{smallimage}}}
+
}}" style="{{{style|}}} margin-bottom:5px;">
  |{{{image|}}}
+
<tr>
 +
{{#switch:{{{image|}}}
 +
| blank    <!-- Fall back to "none", since deprecated. -->
 +
| none = <td class="mbox-empty-cell"></td>   <!-- No image. Cell with some width or padding necessary for text cell to have 100% width. -->
 +
| #default =
 +
  <td class="mbox-image"><div style="width: 52px;"> <!-- all styles present in CSS? -->
 +
  {{#if:{{{image|}}}
 +
  | {{{image}}}
 +
  | [[File:{{#switch:{{{type|}}}
 +
    | speedy    = Ambox speedy deletion.png
 +
    | delete    = Ambox deletion.png
 +
    | content    = Ambox content.png
 +
    | style     = Edit-clear.png
 +
    | move      = Ambox move.png
 +
    | protection = Ambox protection.png
 +
    | notice          <!-- notice = default -->
 +
    | #default   = Ambox notice.png
 +
    }} | 40x40px |link=|alt=]]
 +
  }}</div>
 +
  </td>
 +
}}
 +
<td class="mbox-text" style="{{{textstyle|}}}"> {{{text}}} </td>
 +
{{#if:{{{imageright|}}}
 +
| {{#ifeq:{{{imageright|}}}|none
 +
  | <!-- No image. -->
 +
  | <td class="mbox-imageright"><div style="width: 52px;"> {{{imageright}}} </div></td>
 
   }}
 
   }}
  |imageright = {{#if:{{{smallimageright|}}}
+
}}
  |{{{smallimageright}}}
+
</tr>
  |{{{imageright|}}}
+
</table><!--
  }}
+
Detect and report usage with faulty "type" parameter:
   |style     = {{{style|}}}
+
-->{{#switch:{{{type|}}}
  |textstyle  = {{{textstyle|}}}
+
|   <!-- No type fed, is also valid input -->
  |text      = {{#if:{{{smalltext|}}}
+
| speedy
  |{{{smalltext}}}
+
| delete
  |{{{text}}}
+
| content
  }}
+
| style
}}
+
| move
|{{Ambox/core
+
| protection
  |type      = {{{type|}}}
+
| notice    = <!-- Do nothing, valid "type" -->
  |image      = {{{image|}}}
+
| #default   = <div style="text-align: center;">This message box is using an invalid "type={{{type|}}}" parameter and needs fixing.</div>[[Category:Message box parameter needs fixing|Main{{FULLPAGENAME}}]]<!-- Sort on namespace -->
  |imageright = {{{imageright|}}}
+
}}<noinclude>__NOTOC__
  |style      = {{{style|}}}
+
==Documentation==
  |textstyle  = {{{textstyle|}}}
+
=== Examples ===
  |text      = {{{text}}}
+
 
  |date      = {{#ifeq:{{FULLROOTPAGENAME}}|Template:{{PAGENAME:{{{name}}}}}
+
Simple usage example:
  |{{#ifeq:{{{date|¬}}}|¬||{{CURRENTMONTHNAME}} {{CURRENTYEAR}}}}
+
 
  {{{date|}}}
+
<pre>
  }}
+
{{ambox | text = Some text.}}
}}
+
</pre>
}}{{cat handler
+
 
  |main={{#if:{{{cat|}}}
+
{{ambox | text = Some text.}}
  |{{#if:{{{date|}}}
+
 
  |[[Category:{{{cat}}} {{{preposition|from}}} {{{date}}}]]{{#ifexist:Category:{{{cat}}} {{{preposition|from}}} {{{date}}}|
+
Complex example:
    |[[Category:Articles with invalid date parameter in template]]
+
 
  }}
+
<pre>
  |[[Category:{{#if:{{{undated|}}}
+
{{ambox
    |{{{undated}}}
+
| type      = style
    |{{{cat}}}
+
| image      = [[File:Emblem-question-yellow.svg|40px|alt=Question mark]]
  }}]]
+
| textstyle  = color: red; font-weight: bold; font-style: italic;
  }}
+
| text      = Text for a big box, for the top of articles.
}}{{#if:{{{all|}}}
+
}}
  |[[Category:{{{all}}}]]
+
</pre>
}}
+
 
|template={{#ifeq:{{BASEPAGENAME}}|{{SUBPAGENAME}}|[[Category:Article message boxes]]}}
+
=== Article message box type examples ===
}}{{#ifeq:{{FULLPAGENAME}}|Template:{{PAGENAME:{{{name}}}}}
+
 
|{{documentation}}<!-- Transclude documentation on template page -->
+
The following examples use different '''type''' parameters but use no image parameters thus they use the default images for each type. These are taken from Wikipedia so may not be a perfect match for the Nottinghack Wiki.
}}<noinclude>
+
 
 +
{{ambox
 +
| type  = speedy
 +
| text  = type=<u>speedy</u> – Speedy deletion issues.
 +
}}
 +
{{ambox
 +
| type  = delete
 +
| text  = type=<u>delete</u> – Deletion issues.
 +
}}
 +
{{ambox
 +
| type = content
 +
| text  = type=<u>content</u> – Content issues.
 +
}}
 +
{{ambox
 +
| type  = style
 +
| text  = type=<u>style</u> – Style issues.
 +
}}
 +
{{ambox
 +
| type  = notice
 +
| text  = type=<u>notice</u> – Article notices.
 +
}}
 +
{{ambox
 +
| type  = move
 +
| text  = type=<u>move</u> – Merge, split and transwiki proposals.
 +
}}
 +
{{ambox
 +
| type  = protection
 +
| text  = type=<u>protection</u> – Protection notices.
 +
}}
 +
 
 +
===Resources ===
 +
This template uses styles stored in [[MediaWiki:Common.css]]
  
{{Documentation}}
+
[[Category:Page Action Templates]]
<!-- Add categories and interwikis to the /doc subpage, not here! -->
+
[[Category:Utility Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 17:59, 8 May 2019

Documentation

Examples

Simple usage example:

{{ambox | text = Some text.}}

Complex example:

{{ambox
| type       = style
| image      = [[File:Emblem-question-yellow.svg|40px|alt=Question mark]]
| textstyle  = color: red; font-weight: bold; font-style: italic;
| text       = Text for a big box, for the top of articles.
}}

Article message box type examples

The following examples use different type parameters but use no image parameters thus they use the default images for each type. These are taken from Wikipedia so may not be a perfect match for the Nottinghack Wiki.

Resources

This template uses styles stored in MediaWiki:Common.css