Template:Htab-box

From Wikinews, the free news source you can write!
Jump to navigation Jump to search
[edit] Template-info.svg Template documentation

See also: {{Picture select}}

Usage:[edit]

{{Htab-box|1=
first tab
some content
|2=
second tab
some content
[and so on...]
}}

Tab titles[edit]

You can also use title<tab number>=foo to override the normal title. The way tab titles are figured out:

  1. The title<tab number>= parameter is looked at first. If its blank:
  2. We look for section headings. (==something==)
    1. The biggest header there is used (==A== vs ===B===, A is used)
    2. if there is a tie, first one we see is used
      • Note: this means that any section headers are invisible when tabber is used (they are still visible to non-js users/when printed) use <h2 style="display:block">something</h2> if you want title to be visible regardless.
  3. As a last resort, The tabs are automatically numbered if no title can be found

Example using title<#>= parameter

{{Htab-box|1=
<h2 style="display:block">first tab</h2>
some content
|title1=First box
|2=
<h2 style="display:block">second tab</h2>
some content
[and so on...]
|title2=second box
}}

Supports upto 11 tabs. Most common usage would be:

{{htab-box
|{{Canada|orient=horiz}}
|{{NAFTA infobox|orient=horiz}}
}}

Replacing {{Canada|orient=horiz}} and {{NAFTA infobox|orient=horiz}} with appropriate infobox template names (look here for a more complete list).

caveats and bugs[edit]

  • Maximum 11 tabs (but if you need more, its a simple edit to this template)
  • Tabs are not rounded in Internet Explorer and Opera. (This could be fixed by doing something messy with images. Tabs still look acceptable in my opinion)
  • Titles:
    • Assumes that your headline is a title of a tab, so doesn't display (this could be changed)
      • use alternative syntax:<h2 style="display:block">foo</h2> (change the 2 to the number of equal signs you'd use in normal syntax)

The max 11 tabs is a limit to this template, not the tab system, and can be expanded as needed. I don't consider that an issue. The tab title issues are problems with adapting the tabber code to the wiki. They require minor changes to js (I should get around to fixing them sometime soon). In the meanwhile i don't think it will be an issue.