Template:TOCfloat: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(based on Wikipedia's "TOC left" template)
 
(adding "side" parameter, more docs)
Line 1: Line 1:
<includeonly><div style="clear:left; margin-bottom:0.5em; float:left; padding:0.5em 1.4em 0.8em 0; background:none; width:{{{width|{{{1|auto}}}}}};" {{#if:{{{limit|}}}|class="toclimit-{{{limit}}}"}}>__TOC__</div></includeonly><noinclude>Especially for articles which do not have a lede, a long Table Of Contents (TOC) can be visually unsettling -- "Hey, where's the article? There's just this long box!" Use this template where it seems appropriate to make the TOC a floating table, so the article starts next to it, not below it. Pass it a "width" parameter to specify width. You can also pass in a "limit" parameter to limit the TOC to a certain level of hierarchy; for instance, <nowiki>{{TOCfloat|limit=2}}</nowiki> would only show level 2 headers (==), keeping the table short.
<includeonly><div style="clear:left; margin-bottom:0.5em; float:{{{side|left}}}; padding:0.5em 1.4em 0.8em 0; background:none; width:{{{width|{{{1|auto}}}}}};" {{#if:{{{limit|}}}|class="toclimit-{{{limit}}}"}}>__TOC__</div></includeonly><noinclude>Especially for articles which do not have a [[wikipedia:WP:LEDE|lede]], a long Table Of Contents (TOC) can be visually unsettling -- "Hey, where's the article? There's just this long box!" Sometimes it's just the only right way to do things, as in [[Quotes/Speech]]. But for a more normal article like [[Daodan DLL]], it would look bad if the article started after the TOC. Use this template to make the TOC a floating table, so that the article starts next to it, not below it.
 
Note that this template includes the magic word <nowiki>__TOC__</nowiki>, so it can also be used to reposition the TOC; if you <u>don't</u> intend to reposition it and just want it at its default location, that means <u>you have to place this template between the lede (if there is one) and the first header</u> in the article. Optional parameters:
*"width" -- e.g., "300px" or "30%"
*"limit" -- limits the TOC to a certain level of hierarchy; for instance, <nowiki>{{TOCfloat|limit=2}}</nowiki> would only show level 2 headers (==), keeping the table short.
*"side" -- this is passed to the float property, so your only meaningful choices are "left" or "right" (default is "left")
 
[[Category:Basic formatting templates]]
[[Category:Basic formatting templates]]
</noinclude>
</noinclude>

Revision as of 14:35, 27 May 2013

Especially for articles which do not have a lede, a long Table Of Contents (TOC) can be visually unsettling -- "Hey, where's the article? There's just this long box!" Sometimes it's just the only right way to do things, as in Quotes/Speech. But for a more normal article like Daodan DLL, it would look bad if the article started after the TOC. Use this template to make the TOC a floating table, so that the article starts next to it, not below it.

Note that this template includes the magic word __TOC__, so it can also be used to reposition the TOC; if you don't intend to reposition it and just want it at its default location, that means you have to place this template between the lede (if there is one) and the first header in the article. Optional parameters:

  • "width" -- e.g., "300px" or "30%"
  • "limit" -- limits the TOC to a certain level of hierarchy; for instance, {{TOCfloat|limit=2}} would only show level 2 headers (==), keeping the table short.
  • "side" -- this is passed to the float property, so your only meaningful choices are "left" or "right" (default is "left")