Template:Task heading: Difference between revisions

From Rosetta Code
Content added Content deleted
(Add edit links to the sections headers)
(Make the headings bold, following discussion on the discussion page. Slightly decrease font size to compensate.)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><div id="{{#replace:{{{1|}}}| |_}}" style="margin:20px 0 10px 0; line-height:1.1; font-size:18px;">{{{1}}}<span class="mw-editsection"><span class="mw-editsection-bracket">[</span>[{{fullurl:{{FULLPAGENAME}}|action=edit&amp;section=0&amp;summary=%2F*%20{{#replace:{{{1|}}}| |_}}%20*%2F%20}} edit]<span class="mw-editsection-bracket">]</span></span></div></includeonly><noinclude>
<includeonly><div id="{{#replace:{{{1|Task}}}| |_}}" style="margin:20px 0 10px 0; line-height:1.1; font-size:16.5px; font-weight:bold">{{{1|Task}}}{{#ifeq:{{{1|Task}}}|Task|<span class="mw-editsection"><span class="mw-editsection-bracket">[</span>[{{fullurl:{{FULLPAGENAME}}|action=edit&amp;section=0&amp;summary=%2F*%20{{#replace:{{{1|Task}}}| |_}}%20*%2F%20}} edit]<span class="mw-editsection-bracket">]</span></span>}}</div></includeonly><noinclude>
This template can be used to show a header inside the introduction of a task page (i.e. the part above the TOC), in order to break up long task descriptions into multiple sections.


This template can be used to show a heading (which won't affect the table of contents) above the task description on a [[:Category:Programming Tasks|task page]].
The header is styled exactly the same way as the header of the TOC, which makes it look nice and tidy.


Multiple headings can also be used to break longer task descriptions up into logical subsections (see example below).
;Usage:
: The first argument is the header title to show.


===Advantages===
;Example:

In the past, some Rosettacode editors have used the definition header syntax (e.g. <code>;Task:</code>) to to create such headings.<br>
Using this template instead, has the following advantages:

* It is styled more appropriately for a heading.
*: <small>''(i.e. larger font, and more spacing.)''</small>

* It has an edit link.
*: <small>''(Only for the main "Task" heading, because due to technical limitations, it can't give you a specific subsection of the task to edit - it gives you the whole task description, or more precisely, everything above the first real heading.)''</small>

* It has a link anchor.
*: <small>''(E.g. to link to the "See also" section, you can write <tt><nowiki>[[#See_also]]</nowiki></tt>. Note that spaces have to be replaced by underscores.)''</small>

===Usage===

The first and only argument is the title of the heading to show.<br>
If it is not specified, it defaults to the word "Task".

{| class=wikitable
|-
! Usage example
! Renders as
|-
| style="vertical-align:top; padding:1em" |
<pre style="border:none; margin:0; padding:0">
{{task heading}}


<pre>
{{introheader|The task}}
...
...

{{introheader|Test cases}}
{{task heading|Test cases}}

...
...
{{introheader|See also}}
...
</pre>


{{task heading|See also}}
Which renders as:


...
: {{introheader|The task}}
</pre>
: ...
| style="vertical-align:top; padding:0 1em" |
: {{introheader|Test cases}}
{{task heading}}
: ...
...
: {{introheader|See also}}
{{task heading|Test cases}}
: ...
...
{{task heading|See also}}
...
|}


{{template}}</noinclude>
{{template}}</noinclude>

Latest revision as of 10:19, 23 August 2016


This template can be used to show a heading (which won't affect the table of contents) above the task description on a task page.

Multiple headings can also be used to break longer task descriptions up into logical subsections (see example below).

Advantages

In the past, some Rosettacode editors have used the definition header syntax (e.g. ;Task:) to to create such headings.
Using this template instead, has the following advantages:

  • It is styled more appropriately for a heading.
    (i.e. larger font, and more spacing.)
  • It has an edit link.
    (Only for the main "Task" heading, because due to technical limitations, it can't give you a specific subsection of the task to edit - it gives you the whole task description, or more precisely, everything above the first real heading.)
  • It has a link anchor.
    (E.g. to link to the "See also" section, you can write [[#See_also]]. Note that spaces have to be replaced by underscores.)

Usage

The first and only argument is the title of the heading to show.
If it is not specified, it defaults to the word "Task".

Usage example Renders as
{{task heading}}

...

{{task heading|Test cases}}

...

{{task heading|See also}}

...

...

Test cases

...

See also

...



This is a template. There are many others. See Category:RCTemplates for a complete list of templates.