Template:Custominfobox/doc: Difference between revisions

From GlyGen Wiki
Jump to navigation Jump to search
(Created page with "== Common parameters == The box below shows the most common parameters that are accepted by <code><nowiki>{{Warning}}</nowiki></code> template. The purpose of each is describe...")
 
No edit summary
Line 117: Line 117:
{{para|detail=|<nowiki>detail</nowiki>}}
{{para|detail=|<nowiki>detail</nowiki>}}


Type <code><nowiki>{{customeinfobox|detail=the information on this page is inaccurate}}</nowiki></code>
Type <code><nowiki>{{Custominfobox|detail=the information on this page is inaccurate}}</nowiki></code>


This code will add period at the end of your message. <code><nowiki>{{#ifeq:{{{punctuation|{{{period|}}}}}}|no||.}}</nowiki></code>  
This code will add period at the end of your message. <code><nowiki>{{#ifeq:{{{punctuation|{{{period|}}}}}}|no||.}}</nowiki></code>  
:results in
:results in
{{customeinfobox|detail=the information on this page is inaccurate|date=May 2019}}
{{Custominfobox|detail=the information on this page is inaccurate|date=May 2019}}
=== ''signature'' ===
=== ''signature'' ===
To add your name you have to use <code><nowiki>signature=</nowiki></code>parameter.
To add your name you have to use <code><nowiki>signature=</nowiki></code>parameter.

Revision as of 17:22, 22 November 2019

Common parameters

The box below shows the most common parameters that are accepted by {{Warning}} template. The purpose of each is described below.

{{Custominfobox
| type       = serious/content/style/merge/move/blank/warning/delete/speedy/protection/notice by default
| image      = none/blank/[[Image:Some image.svg|40px]]
| imageright = [[Image:Some image.svg|40px]]
| text       = The message body text
| message    = warning/expand/attention
| detail     = with: my details
| signature  = Your Name
| date       = {{CURRENTMONTHNAME}} {{CURRENTYEAR}}
}}

pass template Warning

Type {{customeinfobox}}

results in

Type {{Custominfobox|date={{CURRENTMONTHNAME}} {{CURRENTYEAR}}}}

results in

type

The type parameter defines the colour of the left bar, and the image that is used by default. The type is chosen not on aesthetics but is based on the type of issue that the template describes. The seven available types and their default images are shown below.

If no type parameter is given the template defaults to |type=notice.

image

You can choose a specific image to use for the template by using the image parameter. Images are specified using the standard syntax for inserting files in Wikipedia (see Wikipedia:Manual of Style/Images#How to place an image.) Widths of 40-50px are typical.

  • No parameter = means that no image parameter is given and template uses a default image. In this case |type = notice.
  • An image = usual width of an image is 40px - 50px.
  • none = means that no image is used.
  • blank = means that no image is used but an empty area the same size as a default image is used, which means that text in the message box gets aligned well with other article message boxes. (See examples above.)

For example:

  • {{POV}} specifies |image=[[File:Unbalanced scales.svg|40px|link=|alt=]] and looks like this:

imageright

message

text
detail

To add your specific detail message, you have to call parameter |detail=

Type {{Custominfobox|detail=the information on this page is inaccurate}}

This code will add period at the end of your message. {{#ifeq:{{{punctuation|{{{period|}}}}}}|no||.}}

results in

signature

To add your name you have to use signature=parameter. Type {{Custominfobox|signature=Tatiana}}

results in

date

Default values

If you transclude a template that expects parameters but do not provide their arguments, in this way: {{{Custominfobox}}} in the numbered parameters example above you would get the following:

Warning: There is a problem with this page.

In the parameters example above you would get the following:

Warning: There is a problem with this page with {{{detail}}}. {{{date}}}.

Since no arguments were passed in, the template presents the parameters themselves, instead of their respective values. In these cases, it may be useful to define default values for the parameters, i.e. values that will be used if no value is passed in. For example, if the template contents are changed to:

'''Warning:''' There is a problem with this page with: {{{detail}}}. {{{date|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}}.

then {{{date|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}}. defines that if no argument is provided for parameter {{{date}}}, then the value CURRENTDATE which is <small>''May 2019.''</small> will be used.

Similarly, {{{detail}}}, doesn't provide defaults parameter, that means no value will be added.

Now, transcluding the template again without passing any argument results in the following:

Warning: There is a problem with this page. May 2019.

Memo

Assign a parameter

{{#if:{{{with|{{{for|{{{signature|}}}}}}}}}|{{{with|{{{for|{{{signature}}}}}}}}}}}

Assign a parameter with default value

{{#if:|{{{date|}}}|<small>''({{{date|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}})''</small>}} code style

Custominfobox template code

<!--{{Custominfobox}} begin-->
<table style="{{{style|}}}" class="metadata plainlinks ambox {{#switch:{{{type|}}}
  | serious  = ambox-delete
  | content  = ambox-content
  | style    = ambox-style
  | merge    = ambox-merge
  | move     = ambox-move
  | warning  = ambox-content
  | delete   = ambox-delete
  | speedy   = ambox-speedy
  | protection = ambox-protection
  | notice   = ambox-notice
  | #default = ambox-notice
}}">
<tr>
<td class="mbox-image" {{#ifeq:{{{image|}}}|none|style="padding:0 !important"}}>
{{#ifeq:{{{image}}}|none
  | <!-- no image cell; empty cell necessary for text cell to have 100% width -->
  | <div style="width:52px;"> {{#switch:{{{image|{{{type|}}}}}}
    | serious  = [[Image:Stop hand nuvola.svg|40px]]
    | content  = [[Image:Emblem-important.svg|40px]]
    | style    = [[Image:Broom icon.svg|40px]]
    | merge    = [[Image:Merge-split-transwiki default.svg]]
    | move     = [[Image:Ambox_move.png|40px]]
    | blank    = [[Image:Spacer.gif]]
    | warning  = [[File:Ambox warning orange.svg|40px]]
    | delete   = [[File:Ambox warning red.svg|40px]]
    | speedy   = [[File:Ambox warning red.svg|40px]]
    | protection = [[Image:Ambox_protection.png|40px]]
    | notice   = [[Image:Info non-talk.png|40px]]
    | #default = {{{image|[[Image:Info non-talk.png|40px]]}}}
  }}</div>
}}</td>
<td class="mbox-text">{{#if:|{{{text|}}}|{{{text|
{{#switch:{{{message|{{{message|}}}}}}
    | warning  = '''Warning:''' There is a problem with this page
    | expand   = This section '''needs expansion''' 
    | attention = '''Attention:''' This page requires attention
    | #default = ''This is a difault message''
 }}}}}}}{{#if:{{{with|{{{for|{{{detail|}}}}}}}}}
 |  with: {{{with|{{{for|{{{detail}}}}}}}}}}}{{#ifeq:{{{punctuation|{{{period|}}}}}}|no||.}} {{#if:{{{with|{{{for|{{{signature|}}}}}}}}}|''{{{with|{{{for|{{{signature}}}}}}}}}''}} {{#if:{{{with|{{{for|{{{date|}}}}}}}}}|''<small>({{{with|{{{for|{{{date}}}}}}}}})</small>''}}</td>
{{#if:{{{imageright|}}}|
  <td class="mbox-imageright"><div style="width:52px;"> {{{imageright}}} </div></td>
}}
</tr>
</table><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude><noinclude>