Difference between revisions of "Template:Float toc"

From The iPhone Wiki
Jump to: navigation, search
m (added margin)
Line 1: Line 1:
  +
<includeonly>{{#if: {{{1}}} |</includeonly>
{| border="0" style="float:{{{1|{{{align|{{{float|right}}}}}}}}}; margin:5px;"
 
  +
{| border="0" style="float:{{{1<noinclude>|right</noinclude>}}}; margin:5px;"
 
|-
 
|-
 
|| __TOC__
 
|| __TOC__
 
|-
 
|-
|}<noinclude>
+
|}<includeonly>
  +
| <span style="color:red;">'''ERROR''': Usage of {{<nowiki/>[[Template:float toc|float toc]]}} without parameter</span>}}</includeonly><noinclude>
 
== Purpose ==
 
== Purpose ==
This template floats the table of contents to the right of the page. It is useful on pages with lots of sections.
+
This template floats the table of contents to the right of the page. It is useful on pages with lots of sections or pages. It can also be useful for pages with a long summary as the table of contents is always placed below the summary and above the first heading unless an explicit <code>__<nowiki/>TOC__</code> or <code>__<nowiki/>NOTOC__</code> is placed.
  +
  +
If you float the table of contents to the left, be sure to place a {{<nowiki/>[[Template:clear|clear]]}} below the summary above the first heading (even if the summary is ridiculously long. If you have a good reason to no use the {{<nowiki/>[[Template:clear|clear]]}} template, leave the reasoning in a comment block (<code>&lt;!-- derp reason --&gt;</code>) in place of the template.
   
 
== Usage ==
 
== Usage ==
  +
=== Right ===
<nowiki>{{float toc}}</nowiki>
 
  +
{{float <nowiki/>toc|right}}
 
Result: Above
 
Result: Above
  +
=== Left ===
<nowiki>{{float toc|(float)}}</nowiki>
 
  +
{{float <nowiki/>toc|left}}
You can use <nowiki>{{float toc|left}}, {{float toc|align=left}}, {{float toc|left}}</nowiki> to float the table to the left.
 
  +
Result: TOC floated to the left of the summary
 
== Shortcuts ==
 
*<nowiki>{{</nowiki>[[Template:float|float]]<nowiki>}}</nowiki>
 
 
</noinclude>
 
</noinclude>

Revision as of 20:39, 24 December 2012

Purpose

This template floats the table of contents to the right of the page. It is useful on pages with lots of sections or pages. It can also be useful for pages with a long summary as the table of contents is always placed below the summary and above the first heading unless an explicit __TOC__ or __NOTOC__ is placed.

If you float the table of contents to the left, be sure to place a {{clear}} below the summary above the first heading (even if the summary is ridiculously long. If you have a good reason to no use the {{clear}} template, leave the reasoning in a comment block (<!-- derp reason -->) in place of the template.

Usage

Right

{{float toc|right}}

Result: Above

Left

{{float toc|left}}

Result: TOC floated to the left of the summary