Відмінності між версіями «Шаблон:Mbox»

Матеріал з Аероскан Сервіс
Перейти до: навігація, пошук
(make msg and first numerical argument alternatives to text)
Рядок 1: Рядок 1:
<span style="white-space: nowrap;">{{{|{{{1}}}}}}</span><noinclude>
+
<includeonly><table class="metadata plainlinks" style="{{{style|width: 80%; margin: 0 auto; border-collapse: collapse; background: #f8fcff; border: 1px solid #aaa;}}} border-left: 10px solid {{#switch:{{{type|}}}
----
+
  | warning  = #b22222
This template prevents line breaks during HTML mathematics. It is a practical alternative to excessive use of [[non-breaking space]]s (&#38;nbsp;).
+
  | serious  = #b22222
 +
  | content  = #f28500
 +
  | style    = #f4c430
 +
  | merge    = #9932cc
 +
  | notice  = #1e90ff
 +
  | growth  = #228b22
 +
  | idea    = yellow
 +
  | #default = #1e90ff
 +
}};">
 +
<tr><td style="width: 52px; padding: 2px 0px 2px 0.5em; text-align: center;">
 +
{{#if:{{{image|}}}
 +
  | [[Image:{{{image}}}|40px]]
 +
  | [[Image:{{#switch:{{{type|}}}
 +
    | warning  = Stop hand nuvola.svg
 +
    | serious  = Stop hand nuvola.svg
 +
    | content  = Emblem-important.svg
 +
    | style    = Applications-office.svg
 +
    | merge    = Merge-split-transwiki default.svg
 +
    | notice  = Information icon.svg
 +
    | growth  = Nuvola Green Plus.svg
 +
    | idea    = Ktip.svg
 +
    | blank    = <!-- empty image cell -->
 +
    | #default = <!-- empty image cell -->
 +
  }}|40px]]
 +
}}
 +
</td><td style="color: #000000;">
 +
{{{1|{{{msg|{{{text|''Enter Text''}}}}}}}}}
 +
</td style="padding: 0.25em 0.5em;">
 +
{{#if:{{{imageright|}}}|
 +
  <td class="ambox-imageright"> {{{imageright}}} </td>
 +
}}
 +
</tr>
 +
</table></includeonly><noinclude>
  
==Use==
+
== Usage ==
In a math article, included math such as
+
 
<pre>''f'': ''X'' × ''Y'' → [0, 1]</pre>
+
This template is used to create other templates with a consistent visual style. Messages will be color coded to demonstrate their type and severity. The types of message are described as:
may end up broken between lines.  This can be fixed using nonbreaking spaces:
+
 
<pre>''f'':&#38;nbsp;''X''&#38;nbsp;×&#38;nbsp;''Y''&#38;nbsp;→&#38;nbsp;[0,&#38;nbsp;1]</pre>
+
<nowiki>{{mbox|type=<TYPE>|text=<TEXT>}}</nowiki>
However, this results in cumbersome source code which can be difficult to edit.  Using this template, the same result can be achieved with:
+
 
<pre>{{mbox| ''f'': ''X'' × ''Y'' → [0, 1]}}</pre>
+
Where <TYPE> can be one of the following:
 +
 
 +
{{msg:mbox|type=warning|text=warning}}
 +
{{msg:mbox|type=content|text=content}}
 +
{{msg:mbox|type=style|text=style}}
 +
{{msg:mbox|type=merge|text=merge}}
 +
{{msg:mbox|type=notice|text=notice}}
 +
{{msg:mbox|type=growth|text=growth}}
 +
{{msg:mbox|type=idea|text=idea}}
 +
 
 +
the default images can be suppressed by specifying "image=blank", or "image=<IMAGE>", where <IMAGE> is a replacement image link.
  
===Dealing with equations===
 
Because of Wikipedia limitations on templates, mbox doesn't function as stated above if the math contains an equals sign.  In this case, the following syntax should be used:
 
<pre>{{mbox|= 2''x'' + 3''y'' + 5''z'' = 7}}</pre>
 
Using |= instead of | also works for non-equations.
 
[[Category:Mathematics templates|{{PAGENAME}}]]
 
 
</noinclude>
 
</noinclude>

Версія за 14:07, 19 вересня 2007


Usage

This template is used to create other templates with a consistent visual style. Messages will be color coded to demonstrate their type and severity. The types of message are described as:

{{mbox|type=<TYPE>|text=<TEXT>}}

Where <TYPE> can be one of the following:

This message box is using an invalid "type=warning" parameter and needs fixing.
This message box is using an invalid "type=merge" parameter and needs fixing.
This message box is using an invalid "type=growth" parameter and needs fixing.
This message box is using an invalid "type=idea" parameter and needs fixing.

the default images can be suppressed by specifying "image=blank", or "image=<IMAGE>", where <IMAGE> is a replacement image link.