Template:Rule/doc: Difference between revisions

From Wikisource
Jump to navigation Jump to search
Content deleted Content added
m Reverted edits by 71.46.56.20 (talk) to last revision by Namoroka
Tags: Rollback Mobile edit Mobile web edit Advanced mobile edit
mNo edit summary
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{documentation subpage}}
{{documentation subpage}}
{{high-use|361000}}
{{templatestyles|Template:Rule/styles.css}}


==Usage==
==Usage==
Line 15: Line 17:
{{rule}}{{rule}}
{{rule}}{{rule}}


[[Template:Double rule]] may be used as shorthand for this.


===Width===
===Width===
Line 35: Line 38:


===Alignment===
===Alignment===
In rare cases where the left or right alignment is required, the ''align'' parameter may be used.
In rare cases where the left or right alignment is required, the {{parameter|align}} parameter may be used.


For example
{{doc example|content=
<pre>
<nowiki>{{rule|6em|align=left}}</nowiki>
{{rule|6em|align=left}}</pre>
produces
produces


{{rule|6em|align=left}}
{{rule|6em|align=left}}
}}

=== Top/bottom margins ===

If the rule has wider padding around it, this can be set with {{parameter|margin_tb}}:

{{doc example|content=
<pre>
{{center|
Foo
{{rule|margin_tb=2em}}
Bar
}}
</pre>
produces
{{center|
Foo
{{rule|margin_tb=2em}}
Bar
}}
}}

===Class===

{{class notice|class=.wst-rule}}


===Style===
===Style===
Line 47: Line 76:


For example
For example
<nowiki>{{rule|width=12em|height=1em|style=background-color:orange;border:1px solid black}}</nowiki>
<nowiki>{{rule|width=12em|height=1em|style=background-color:orange;color:inherit;border:1px solid black}}</nowiki>


produces
produces


{{rule|width=12em|height=1em|style=background-color:orange;border:1px solid black}}
{{rule|width=12em|height=1em|style=background-color:orange;color:inherit;border:1px solid black}}


==Redirects==
==Redirects==
Line 58: Line 87:
==See also==
==See also==


* {{tl|section end rule}} for a semantic rule at the end of a section
* {{tl|separator}} for a row of dots
* {{tl|separator}} for a row of dots
* {{tl|custom rule}} for a customized decorative rule

* {{tl|Custom rule}} for a customized decorative rule
* {{tl|longdash}} for an inline long dash
* {{tl|bar}} for an inline, user specified length of the dash

* {{tl|Longdash}} for an inline long dash

* {{tl|Bar}} for an inline, user specified length of the dash


<includeonly>
<includeonly>
[[Category:Formatting templates|{{PAGENAME}}]]
[[Category:Formatting templates|{{PAGENAME}}]]
</includeonly>
</includeonly>
<templatedata>
{
"params": {
"1": {
"aliases": [
"width"
],
"label": "width",
"description": "width of rule. (CSS 'units specifcations should be used)",
"suggested": true,
"type": "string"
},
"class": {
"label": "class",
"description": "CSS classes to apply to the created HR element.",
"type": "string"
},
"color": {
"label": "color",
"description": "color that should be applied to the rule, CSS style color specifications should be used.",
"type": "string"
},
"align": {
"label": "align",
"description": "(Option) Aligns the rule with the left or right of the containing content.",
"suggestedvalues": [
"left",
"right"
],
"type": "string"
},
"margin_tb": {
"label": "margin_tb",
"description": "Vary the vertical spacing around the rule. (uses CSS unit specifcations.)",
"type": "string"
},
"height": {
"label": "height",
"description": "Varies the vertical height of the rule (Uses CSS units)",
"type": "string",
"aliases": [
"2"
]
},
"style": {
"label": "style",
"description": "Additional CSS styles to be applied to the 'rule' ",
"type": "string"
}
},
"description": "Adds a horizontal rule to content.",
"format": "inline"
}
</templatedata>

Latest revision as of 17:44, 8 July 2024

Usage

[edit]

This template inserts a black horizontal rule. It should be used in transcriptions in preference to wiki syntax "----", which inserts a rule but in a lighter colour. Furthermore there can be no certainty that the rendering of "----" will not change in the future. Please check for any [X]HTML 5 issues as well.

For example

{{rule}}

produces


The common case of a double-rule can be achieved by

{{rule}}{{rule}}

which produces



Template:Double rule may be used as shorthand for this.

Width

[edit]

A width may optionally be provided, in em or by % in which case a black horizontal rule of that width is centered on the line.

For example

{{rule|width=12em}}

and

{{rule|12em}}

both produce


Height

[edit]

Height is provided by the named height parameter:

{{rule|height=3px}}

Alignment

[edit]

In rare cases where the left or right alignment is required, the align parameter may be used.

Example

{{rule|6em|align=left}}

produces


Top/bottom margins

[edit]

If the rule has wider padding around it, this can be set with margin_tb:

Example

{{center|
Foo
{{rule|margin_tb=2em}}
Bar
}}

produces

Foo


Bar

Class

[edit]

This template applies the class(es)
.wst-rule
that can be targeted with a work's index styles.css using page styles

Style

[edit]

Finally, any desired special HTML styling may be applied through the style parameter.

For example

{{rule|width=12em|height=1em|style=background-color:orange;color:inherit;border:1px solid black}}

produces


Redirects

[edit]

See also

[edit]
  • {{section end rule}} for a semantic rule at the end of a section
  • {{separator}} for a row of dots
  • {{custom rule}} for a customized decorative rule
  • {{longdash}} for an inline long dash
  • {{bar}} for an inline, user specified length of the dash


Adds a horizontal rule to content.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
width1 width

width of rule. (CSS 'units specifcations should be used)

Stringsuggested
classclass

CSS classes to apply to the created HR element.

Stringoptional
colorcolor

color that should be applied to the rule, CSS style color specifications should be used.

Stringoptional
alignalign

(Option) Aligns the rule with the left or right of the containing content.

Suggested values
left right
Stringoptional
margin_tbmargin_tb

Vary the vertical spacing around the rule. (uses CSS unit specifcations.)

Stringoptional
heightheight 2

Varies the vertical height of the rule (Uses CSS units)

Stringoptional
stylestyle

Additional CSS styles to be applied to the 'rule'

Stringoptional