Template:Dmbox/doc

From IoTWiki
< Template:Dmbox
Revision as of 20:07, 16 November 2017 by Angad (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

{{#ifeq:doc |doc

    | 

{{#ifeq:show |show

         | {{#invoke:Message box|mbox}}
        }}{{#if: |
         |   {{#ifexist:Template:Dmbox
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}
        }}
    | 
   }}

{{#invoke:Message box|ombox}} {{#invoke:Infobox|infobox}}

This is the {{Dmbox}} ([D]isambiguation footer [m]essage [box]) meta-template.

It is used to build disambiguation and set index article boxes, such as {{Disambiguation}} and {{Shipindex}}.

This template works similarly to {{Ambox}} and mostly uses the same parameters. The main differences are that this box uses the disambiguation style and only has two "type" settings.

Usage[edit]

Simple usage example:

{{dmbox | text = Some text.}}
{{#ifeq:|none | | }}

{{#if:

|

}}

{{#switch:

| | disambig | setindex =

| #default =
This message box is using an invalid "type=" parameter and needs fixing.

}}{{#ifeq:|disambig|__DISAMBIG__|}}{{#switch: | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}

{{dmbox | type = setindex | text = Some text.}}
{{#ifeq:|none | | }}

{{#if:

|

}}

{{#switch:setindex

| | disambig | setindex =

| #default =
This message box is using an invalid "type=setindex" parameter and needs fixing.

}}{{#ifeq:setindex|disambig|__DISAMBIG__|}}{{#switch:setindex | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}


Complex example:

{{dmbox
| type      = setindex
| image     = {{nowrap| [[Image:Schooner.svg|30px]] [[Image:DAB list gray.svg|30px]] }}
| textstyle=color: red; font-weight: bold; font-style: normal;
| text      = The message body text.
}}
{{#ifeq: 30px 30px |none | | }}

{{#if:

|

}}

{{#switch:setindex

| | disambig | setindex =

| #default =
This message box is using an invalid "type=setindex" parameter and needs fixing.

}}{{#ifeq:setindex|disambig|__DISAMBIG__|}}{{#switch:setindex | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}


Some other parameter combinations:

{{#ifeq:|none | | }}

{{#if:

|

}}

{{#switch:

| | disambig | setindex =

| #default =
This message box is using an invalid "type=" parameter and needs fixing.

}}{{#ifeq:|disambig|__DISAMBIG__|}}{{#switch: | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}

{{#ifeq:none|none | | }}

{{#if:

|

}}

{{#switch:

| | disambig | setindex =

| #default =
This message box is using an invalid "type=" parameter and needs fixing.

}}{{#ifeq:|disambig|__DISAMBIG__|}}{{#switch: | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}

{{#ifeq:|none | | }}

{{#if:33px

|

}}

{{#switch:setindex

| | disambig | setindex =

| #default =
This message box is using an invalid "type=setindex" parameter and needs fixing.

}}{{#ifeq:setindex|disambig|__DISAMBIG__|}}{{#switch:setindex | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}

{{#ifeq:|none | | }}

{{#if:33px

|

}}

{{#switch:setindex

| | disambig | setindex =

| #default =
This message box is using an invalid "type=setindex" parameter and needs fixing.

}}{{#ifeq:setindex|disambig|__DISAMBIG__|}}{{#switch:setindex | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}

Parameters[edit]

List of all parameters:

{{dmbox
| type  = disambig / setindex
| image = none / [[Image:Some image.svg|40px]]
| imageright = [[Image:Some image.svg|40px]]
| style=CSS values
| textstyle=CSS values
| text  = The message body text. 
| nocat = {{{nocat|}}} / true
}}

type

If no type parameter is given the template defaults to type disambig.
disambig = Makes it so the {{disambig editintro}} is displayed when editing a page with this template on. (Means that this template internally sets the CSS id "disambigbox". The id is used by the javascript in MediaWiki:Common.js to determine if a page is a disambiguation page or not.) And adds Category:All disambiguation pages and Category:All article disambiguation pages.
setindex = Does not trigger the {{disambig editintro}} when editing a page. (Because this instead sets the CSS id "setindexbox".) And adds Category:All set index articles.

nocat

true = Stops this template from categorizing. Useful for instance when only testing or demonstrating this template. Templates that use this template should forward nocat, so they too understand nocat. So always add this:
nocat = {{{nocat|}}}

image

No parameter = If no image parameter is given, the template uses the default disambig or setindex image, depending on the type parameter.
An image = Should be an image with usual wiki notation. 30px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
image = [[Image:Schooner.svg|30px]]
none = Means that no image is used.

imageright

No parameter = If no imageright parameter is given then no image is shown on the right side.
An image = Should be an image with usual wiki notation. 30px - 50px width are usually about right depending on the image height to width ratio. (But the message box can handle images of any size.) For example:
imageright = [[Image:Nuvola apps bookcase.png|40px]]
Anything = Any other object that you want to show on the right side.

style

Optional CSS values used by the entire message box table. Without quotation marks " " but with the ending semicolons ;. For example:
style=margin-bottom: 0.2em;

textstyle

Optional CSS values used by the text cell. For example:
textstyle=text-align: center;

text

The message body text. This message box has italic text as default, thus no need to manually set that.

Technical details[edit]

This template currently uses hard coded styles and class names. Later it will only use CSS classes making it easier to skin. (In the meantime it can be skinned by using the "!important" keyword.)

If you need to use special characters in the text parameter then you need to escape them like this:

{{dmbox
| text  = <div>
Equal sign = and a start and end brace { } work fine as they are. 
But here is a pipe {{!}} and two end braces <nowiki>}}</nowiki>. 
And now a pipe and end braces <nowiki>|}}</nowiki>.
</div>
}}
{{#ifeq:|none | | }}

{{#if:

|

}}

{{#switch:

| | disambig | setindex =

| #default =
This message box is using an invalid "type=" parameter and needs fixing.

}}{{#ifeq:|disambig|__DISAMBIG__|}}{{#switch: | setindex =

 {{#invoke:Category handler|main}}

| disambig | #default =

 {{#invoke:Category handler|main}}

}}


Internally, this meta-template uses HTML markup instead of wiki markup for the table code. That is the usual way we make meta-templates since wiki markup has several drawbacks. For instance it makes it harder to use parser functions and special characters in parameters.

For more technical details see the talk page. Since this template works almost exactly like {{ambox}}, {{tmbox}}, {{imbox}}, {{cmbox}} and {{ombox}} their talk pages and related pages might also contain more details.

See also[edit]

There are seven metatemplates in the Module:Message box family:

  • {{Ambox}}, for messageboxes on article pages.
  • {{Cmbox}}, for messageboxes on category pages.
  • {{Imbox}}, for messageboxes on file (image) pages.
  • {{Tmbox}}, for messageboxes on talk pages.
  • {{Fmbox}}, for header and footer messageboxes.
  • {{Ombox}}, for messageboxes on other types of page.
  • {{Mbox}}, for messageboxes that are used in different namespaces and change their presentation accordingly.

Closely related metatemplates:

  • {{Asbox}}, for messageboxes in article stubs.
  • {{Dmbox}}, for messageboxes on disambiguation or set-index pages.
  • {{#if: |}}{{#if: | |{{#if:|<code style="border:none;background:transparent;">}} }}{{#if: |}}{{#if: |}}{{#if: | |{{}}{{#if: |subst:}}{{#if: |}}{{#if: || {{#if: |{}}[[:{{#ifeq:I|: |Ivory messagebox |{{#switch:
                        |  = Template:{{#if:Ivory messagebox|Ivory messagebox|Dmbox/doc}}
                        | #default = {{#if:Ivory messagebox|Ivory messagebox|Template:Dmbox/doc}}
                     }}}}|}}{{#if: |{}}{{#if:Ivory messagebox|Ivory messagebox|{{#ifeq:Template|Template|Dmbox/doc|Template:Dmbox/doc}}}}{{#if: |}}}{{#if: | |]]{{#if: |}}}}}{{#if: |}}{{#if: |}}{{#if: |}}{{#ifeq:¬|¬ | ||{{{2}}}}}{{#ifeq:¬|¬ | ||{{{3}}}}}{{#ifeq:¬|¬ | ||{{{4}}}}}{{#ifeq:¬|¬ | ||{{{5}}}}}{{#ifeq:¬|¬ | ||{{{6}}}}}{{#ifeq:¬|¬ | ||{{{7}}}}}{{#ifeq:¬|¬ | ||{{{8}}}}}{{#ifeq:¬|¬ | ||{{{9}}}}}{{#ifeq:¬|¬ | ||{{{10}}}}}{{#ifeq:¬|¬ | ||{{{11}}}}}{{#if: ||…}}{{#if: |}}{{#if: | |}}}}{{#if: |}}{{#if: |}}{{#if: |}}, a simple full-width box with default ivory background intended to frame important messages or notices.

Other pages: