Difference between revisions of "Template:Section depth"

From relax wiki
Jump to navigation Jump to search
(Fixed the example.)
(Fix for the default value of the 'base' parameter in the #switch: statement.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#switch: {{{default|1}}}
+
{{#switch: {{{base|}}}
 
| 1 = {{#switch: {{{dyn|}}} | 1 = = | 2 = == | 3 = === | ==}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = = | 2 = == | 3 = === | ==}}
 
| 1 = {{#switch: {{{dyn|}}} | 1 = = | 2 = == | 3 = === | ==}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = = | 2 = == | 3 = === | ==}}
 
| 2 = {{#switch: {{{dyn|}}} | 1 = == | 2 = === | 3 = ==== | ===}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = == | 2 = === | 3 = ==== | ===}}
 
| 2 = {{#switch: {{{dyn|}}} | 1 = == | 2 = === | 3 = ==== | ===}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = == | 2 = === | 3 = ==== | ===}}
 
| 3 = {{#switch: {{{dyn|}}} | 1 = === | 2 = ==== | 3 = ===== | ====}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = === | 2 = ==== | 3 = ===== | ====}}
 
| 3 = {{#switch: {{{dyn|}}} | 1 = === | 2 = ==== | 3 = ===== | ====}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = === | 2 = ==== | 3 = ===== | ====}}
 
| 4 = {{#switch: {{{dyn|}}} | 1 = ==== | 2 = ===== | 3 = ====== | =====}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = ==== | 2 = ===== | 3 = ====== | =====}}
 
| 4 = {{#switch: {{{dyn|}}} | 1 = ==== | 2 = ===== | 3 = ====== | =====}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = ==== | 2 = ===== | 3 = ====== | =====}}
 +
| {{#switch: {{{dyn|}}} | 1 = = | 2 = == | 3 = === | ==}} {{{heading}}} {{#switch: {{{dyn|}}} | 1 = = | 2 = == | 3 = === | ==}}
 
}}<noinclude>
 
}}<noinclude>
  
Line 17: Line 18:
  
 
  <nowiki>{{</nowiki>''section depth''
 
  <nowiki>{{</nowiki>''section depth''
  &#124; default =
+
  &#124; base    =
  &#124; level  =
+
  &#124; dyn    =
 
  &#124; heading =
 
  &#124; heading =
 
  <nowiki>}}</nowiki>
 
  <nowiki>}}</nowiki>
Line 30: Line 31:
 
=== Example ===
 
=== Example ===
  
  <nowiki>{{section depth|level=3|default=4|heading=This is a level 6 heading}}</nowiki>
+
  <nowiki>{{section depth|dyn=3|base=4|heading=This is a level 6 heading}}</nowiki>
  
{{section depth|level=3|default=4|heading=This is a level 6 heading}}
+
{{section depth|dyn=3|base=4|heading=This is a level 6 heading}}
  
 
}}
 
}}
 +
</noinclude>

Latest revision as of 09:31, 16 October 2015

{{{heading}}}

Template documentation

The Section depth template

Goal

To allow for dynamically changing the depth of headings.


Usage

{{section depth
| base    =
| dyn     =
| heading =
}}
base 
The base depth which defaults to 1.
dyn 
The obligatory dynamic heading depth.
heading 
The heading text.

The final heading depth is calculated as default - 1 + dyn.

Example

{{section depth|dyn=3|base=4|heading=This is a level 6 heading}}
This is a level 6 heading