Template:Callout: Difference between revisions

From Space Station 14 Wiki
(stacked option improv)
(moved to lua)
 
Line 2: Line 2:
--><templatestyles src="Template:Callout/styles.css" /><!--
--><templatestyles src="Template:Callout/styles.css" /><!--


-->{{#switch: {{#vardefineecho: callout_type|{{lc: {{{1}}}}}<!--/vardefine-->}}
-->{{#invoke:Callout|generate_callout}}</includeonly><noinclude>
|info =
{{#vardefine: callout_header|Info}}
{{#vardefine: callout_strip_color|var(--action-color)}}
 
|warning =
{{#vardefine: callout_header|Warning}}
{{#vardefine: callout_strip_color|yellow}}
 
|danger =
{{#vardefine: callout_header|Danger}}
{{#vardefine: callout_strip_color|var(--danger-color)}}
 
|tip =
{{#vardefine: callout_header|Tip}}
{{#vardefine: callout_strip_color|var(--green-color)}}
 
|example =
{{#vardefine: callout_header|Example}}
{{#vardefine: callout_strip_color|#f92672}}
 
|{{error|unknown type{{colon}} {{{1}}}}}
}}<!--
 
# override the header label if needed
-->{{#if: {{#vardefineecho: callout_header_override|{{{header|{{{h|}}}}}}}}
|{{#vardefine: callout_header|{{#var:callout_header_override}}}}
}}<!--
 
-->{{#vardefine: callout_align
|{{lc: {{{align|{{{a|left}}}}}}}}
}}<!--
 
--><div class="
        callout-wrapper
        {{#ifeq: {{yesno|{{{stacked|0}}}}}|yes|stacked-notice}}
        {{{wrapper class|}}}
    "
    style="
    justify-content: {{#var:callout_align}};
">
<div class="callout {{#ifeq: {{#var:callout_align}}|center|callout-banner}}" style="
    /* size of the left border 'strip' */
--strip-size: 10px;
   
        border-color: {{#var: callout_strip_color}};
       
clip-path: polygon(
0 0,
100% 0,
100% 100%,
calc(var(--strip-size) / 2) 100%,
0 calc(100% - var(--strip-size) / 2)
);
><!--
        --><div class="callout-images"><!--
            -->{{#if: {{#vardefineecho: image_1|{{{image1|{{{image|{{{i|}}}<!--/2-->}}}<!--/1-->}}}}}
            |[[File:{{#var:image_1}}|80px]]
            }}<!--
           
            -->{{#if: {{#vardefineecho: image_2|{{{image2|{{{i2|}}}<!--/1-->}}}}}
            |[[File:{{#var:image_2}}|80px]]
            }}<!--
        --></div><!--
       
        --><div class="callout-header-content-container"><!--
            --><div class="callout-header">{{#var:callout_header}}</div><!--
           
--><div class="callout-content-container"><!--
--><div class="callout-content">{{{2}}}</div><!--
--></div><!--
        --></div><!--
--></div><!--
--></div></includeonly><noinclude>
{{docs|bb=
{{docs|bb=
{{uses lua|Callout}}
{{uses template styles}}
{{uses template styles}}
}}
}}

Latest revision as of 11:37, 1 September 2024

Template documentation
view or edit this documentation about template documentation
Uses Lua module
This template uses Lua module:
Uses template styles
This template uses template styles found in:

Examples

Types

Caption text
Type Syntax Result
Info {{Callout|Info|An informative message.}}
Info
An informative message.
Warning {{Callout|Warning|Something to be warned about.}}
Warning
Something to be warned about.
Danger {{Callout|Danger|The clown is closing in.}}
Danger
The clown is closing in.
Tip {{Callout|Tip|When walking over slippery surfaces, hold {{button|Shift}} to slow down and not slip (in most cases).}}
Tip
When walking over slippery surfaces, hold Shift to slow down and not slip (in most cases).
Example {{Callout|Example|An example for something.}}
Example
An example for something.

Header label

{{Callout|Info|header=Notice|Bla-bla-bla, lorem ipsum...}}
or
{{Callout|Info|h=Notice|Bla-bla-bla, lorem ipsum...}}

Notice
Bla-bla-bla, lorem ipsum...

or

Notice
Bla-bla-bla, lorem ipsum...

Alignment

Left

The default.

Center

{{Callout|Info|align=center|Bla-bla-bla, lorem ipsum...}}
or
{{Callout|Info|a=center|Bla-bla-bla, lorem ipsum...}}

Info
Bla-bla-bla, lorem ipsum...

or

Info
Bla-bla-bla, lorem ipsum...

Right

{{Callout|Info|align=right|Bla-bla-bla, lorem ipsum...}}

Info
Bla-bla-bla, lorem ipsum...

Images

{{Callout
| Info
| header = Work in Progress
| align = center
| This page is unfinished.
| image = Wired Frame.png
| image2 = Wrench.png
}}

Work in Progress
This page is unfinished.

Stacked callouts

Sets the callout to a predefined width, making all callouts with the same class appear with the same width.

Callouts will be stacked to the right and will require {{clear}} after to not overflow with the content that goes after.

{{Callout|stacked=1|Info|An informative message. An informative message. An informative message.}}
{{Callout|stacked=1|Info|Bla-bla-bla, lorem ipsum... Bla-bla-bla, lorem ipsum... Bla-bla-bla, lorem ipsum... Bla-bla-bla, lorem ipsum...}}
{{Clear}}

Info
An informative message. An informative message. An informative message.
Info
Bla-bla-bla, lorem ipsum... Bla-bla-bla, lorem ipsum... Bla-bla-bla, lorem ipsum... Bla-bla-bla, lorem ipsum...

Wrapper classes

Allows to add custom classes to the wrapper element.

{{Callout|wrapper class=hello|Info|An informative message.}}

Info
An informative message.

A template for producing various notices.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Type1

Type of the callout. Select from the suggested values. Any casing is supported.

Suggested values
Info Warning Danger Example Tip
Linerequired
Content2

Content of the callout.

Stringrequired
Header labelheader h

Header text of the callout. By default, depends on the type.

Linesuggested
Alignalign a

Alignment of the callout. When "Center" is used, the callout will span almost across the full width of a page. If "Stacked?" is enabled, this option is ignored.

Suggested values
Left Center Right
Default
Left
Linesuggested
Imageimage image1 i

An image to add inside the callout at the start.

Filesuggested
Second imageimage2 i2

A second image to add inside the callout to the left, after the first one.

Filesuggested
Stacked?stacked

If set, the callout will have a predefined constant width, which would be the same for all callouts with this option set. Useful for making notice callouts that "stack" on top of each other.

Auto value
0
Booleanoptional
Wrapper classwrapper class

Extra class names to assign to the callout wrapper element. Use space to separate multiple classes.

Lineoptional