Template talk:Horizontal TOC/Archive 1

Latest comment: 2 years ago by Lentower in topic Rows
Archive 1

List TOC

See {{List TOC}}. ---— Gadget850 (Ed) talk 13:55, 28 February 2012 (UTC)

Can we kill the numbers and replace them with bullets?

Title says it all... The numbers are a mess with a horizontal TOC, whereas bullets would make such TOC's readable and comparable to the mass of templated TOCs being deleted right now. - ʄɭoʏɗiaɲ τ ¢ 19:40, 3 March 2012 (UTC)

See {{List TOC}}. ---— Gadget850 (Ed) talk 19:45, 3 March 2012 (UTC)
Whoa... No, that will not do :S... It just lists the letters of the alphabet. This template lists the specific sections, but the numbers are pointless in the horizontal format. - ʄɭoʏɗiaɲ τ ¢ 21:25, 3 March 2012 (UTC)
It does more than that, and the talk page discusses further development. What are you looking for? ---— Gadget850 (Ed) talk 21:29, 3 March 2012 (UTC)
Ideally I want to replicate the custom template TOC I had that was deleted. At List of north-south roads in Toronto, the TOC listed each section header in a horizontal format, separated by just a bullet (no number)... essentially this template, but without the numbers. - ʄɭoʏɗiaɲ τ ¢ 01:25, 4 March 2012 (UTC)
Add |nonum=1 (Thanks to Chris). Edokter (talk) — 20:26, 8 September 2012 (UTC)
Sigh... Yet another of my finds credited to someone else :(. I'll add that in with KML. - Floydian τ ¢ 23:45, 8 September 2012 (UTC)
Sorry about that, I just saw Chris adding nonum yo the template. Edokter (talk) — 09:32, 9 September 2012 (UTC)

How add 'Options' section title?

Greetings, Today I attempted (being Bold) to add an 'Options' section title onto this page. Purpose is to illustrate how the horizontal TOC would look like here. Being somewhat new to Wikipedia, and having done only Navbox Templates so far, I thought this would be an easy change - no luck. So I did the 'Undo' to remove my attempts. If another editor more qualified could make this change? Regards, JoeHebda (talk) 15:08, 28 March 2015 (UTC)

@JoeHebda: I'm not quite sure what you're asking here. Are you looking to add examples of what the table of contents would look like given certain options? If so, probably the easiest way to do that is to add some empty, different level headers in the documentation page to increase the TOC naturally. As the template results are generated by the __TOC__ Magic Word then finding an alternative, manual solution to spoof the output is going to be a pain in the bum. SFB 19:53, 28 March 2015 (UTC)
@Sillyfolkboy:Yes, I attempted to add one simple example of what the table of contents would look like with more than one section name. I had added a ==Options== section title, thinking it would add to the top Content as an example, instead of just the one section title. My simple change did not work, so I (1) did Undo, (2) Asking for help here, mostly because I'm clueless of how to make that work. JoeHebda (talk) 23:09, 28 March 2015 (UTC)
@JoeHebda: There is no way to put multiple TOCs on a single page so I've gone with the easiest method of linking to historical example versions of the documentation. You can probably craft more elegant, stripped-down examples in this way (or create individual test case sub-pages), but as far as I'm aware you're not going to be able to do a visual comparison of multiple TOC options on one page. Another choice open to you would be to screenshot each example TOC and make a composite image for use on the documentation. It depends how much effort you want to go to. Hope this helps! SFB 23:38, 28 March 2015 (UTC)
@Sillyfolkboy:Thanks, the linking to documentation is a good solution to showing the examples.   JoeHebda (talk) 18:57, 30 March 2015 (UTC)

Columns

An alternative TOC that I'd like to see would be one that shows the TOC entries in columns, so it would read top to bottom rather than left to right, but would limit the length of the overall TOC by having multiple columns of some selectable width. Is such a thing doable with a TOC that works generically (like this one) on whatever headings happen to be in the article, rather than on some predetermined set of TOC entries (like {{TOC US states}}, where adding columns would seem more straight-forward)? —Salton Finneger (talk) 14:42, 1 December 2015 (UTC)

Salton Finneger, the issue is that the backend software wraps the TOC in a div container. we would need to inject a css statement into that inner div to create columns. this would be possible using javascript or adding a class to MediaWiki:Common.css. but, it seems as though if you went with MediaWiki:Common.css, you would need a different class for each number of columns (or column width). hence, you would be able to support say two-columns and three-columns or say 20em columns, but you would need to predict that in advance. the javascript method would be more flexible, but adding more site-wide javascript is going to need some level of consensus. I could probably make a script for you which would automatically generate multicolumn tocs, but getting that into the side-wide javascript would be more challenging. Frietjes (talk) 18:56, 2 December 2015 (UTC)

Suggest version of Horizontal TOC that doesn't display section numbers.

A removal of section numbers would facilitate display similar to Template:Compact ToC which, in it's basic form, displays:

One difficulty with this alphabetised documents comes when the first section title is something other than "0-9" or "a". Users may click on the apparent options presented and find that the navigation does not lead them to the apparently promised information. "0-9", "a" and other options will be presented in blue. This may even mean that Users may not find content under titles after "B" because a user may believe it to be in another document.

Another option might be to develop a form of Template:Compact ToC that doesn't display letters of the alphabet not used.

GregKaye 13:17, 13 September 2017 (UTC)

GregKaye are you asking for |nonum=yes or something else (see the documentation and this edit)? Frietjes (talk) 14:16, 6 November 2017 (UTC)

An option to disable the parentheses

Could an option be added to disable the parentheses? Just ignore the level depth and have every entry separated only by the bullet. --Gonnym (talk) 08:38, 12 July 2019 (UTC)

Gonnym, not without changes to hlist in MediaWiki:Common.css. Frietjes (talk) 13:25, 12 July 2019 (UTC)
Thanks for pointing me in the right direction. --Gonnym (talk) 13:30, 12 July 2019 (UTC)

Code is in the sandbox and can be seen on the /testcases. --Gonnym (talk) 18:48, 12 July 2019 (UTC)

How to override the overall TOC depth limit on a page?

{{Template:Horizontal TOC|nonum=yes}}

The horizontal TOC only shows up in the preview when I try to insert it into the Asia section of the Panama Papers.

Nothing shows up after publishing it: See diff.

Is there a way to override the overall TOC depth limit on the page?: {{TOC limit|3}}

So that individual sections can override it? --Timeshifter (talk) 07:15, 21 August 2018 (UTC)

User:Timeshifter, this template does support |limit=. Frietjes (talk) 13:26, 12 July 2019 (UTC)
User:Frietjes. Is there a way to get this template to only add a horizontal TOC just for one section of an article? Such as the Asia section of Panama Papers? I don't want the horizontal TOC template to default remove the top TOC for that section. Please give me an example if you can. Will another template do this? -- Timeshifter (talk) 17:03, 12 July 2019 (UTC)
User:Timeshifter, this particular template operates on the entire TOC, not just the TOC for a section. I don't know of any way to automatically extract the TOC for a section. the only methods require manually listing the sections, e.g. using {{Compact ToC}}. Frietjes (talk) 13:18, 13 July 2019 (UTC)
User:Frietjes. Does it work without replacing or removing the main TOC at the top of an article? In other words one can create custom TOCs for sections, but without effecting the main TOC? -- Timeshifter (talk) 14:53, 13 July 2019 (UTC)
Timeshifter this template is basically just a wrapper for {{flatlist|__TOC__}} with some extra CSS styling. so, whatever the magic word __TOC__ expands into is what is included. hence, if you used this within a section in an article, you would get the entire TOC for the entire page, not just the TOC for a section. it is possible to keep it from removing the main TOC, but you would still have a copy of the entire TOC for the entire page in the section where you used this template. with {{Compact ToC|allowtoc=yes|letters=no|custom1=}} you manually specify the list of entries in the custom parameters, and it does not suppress the top level toc. Frietjes (talk) 14:59, 13 July 2019 (UTC)
Frietjes. Thanks. I bookmarked this talk page. It would be nice if an automatic section TOC existed. -- Timeshifter (talk) 17:33, 13 July 2019 (UTC)

Bug in CSS

The CSS has a trivial bug -- align-right style is just a duplicate of align-left. I do not have the rights to fix it, please can somebody do it for me. GhostInTheMachine (talk) 09:26, 17 November 2019 (UTC)

Template-protected edit request on 4 March 2020

There is "{{MediaWiki:Toc}}" in source code, but there should be "{{int:toc}}" instead. If there had been this first input, it wouldn't depend on the user's interface language. Keyacom (💬 | 🖊) 13:43, 4 March 2020 (UTC)

  Not done: please make your requested changes to the template's sandbox first; see WP:TESTCASES. Izno (talk) 01:24, 5 March 2020 (UTC)

Bug report: Reversion to vertical layout

I've found that if there are too many sections to fit in. one line, then this template won't work properly (example).LaundryPizza03 (d) 19:29, 3 November 2020 (UTC)

Never mind, ignore this. –LaundryPizza03 (d) 19:50, 3 November 2020 (UTC)

Combine vertical level 2 and horizontal level 3

Is it possible to make a TOC where level 2 headers are vertical but level 3 and higher are horizontal, either to the right of or below the level 2? It could improve many articles where:

  • A default TOC is too long
  • {{TOC limit|2}} omits too much
  • Horizontal TOC is hard to navigate
  • Making and maintaining a manual TOC is a lot of work

Examples:

PrimeHunter (talk) 11:10, 9 April 2021 (UTC)

I think that Winning streak could have {{TOC limit|2}}, but how about the effect you get by adding .toclevel-2 {display: inline;}? — GhostInTheMachine talk to me 11:32, 9 April 2021 (UTC)
That looks great. If you think the Winning streak TOC is long then see before I added {{TOC limit|3}}. PrimeHunter (talk) 11:46, 9 April 2021 (UTC)
Strewth! GhostInTheMachine talk to me 12:11, 9 April 2021 (UTC)

Parens not always attached to following numbers

At List of Algerian football players in foreign leagues, I'm seeing something that looks roughly like this:

1 The history of Algerian players in Europe • 2 Gallery     (
2.1 Algerian descent players played for other national teams) • 3 European League     (
etc.

The opening parentheses that should be attached to a following number are instead on the previous line. – Jonesey95 (talk) 03:58, 20 October 2021 (UTC)

Rows

(Thanks to Salton Finneger whose language I partly reused.)
An alternative TOC (or a parameter added to this one|sectionperrow=yes|no?) that I'd like to see would be one that shows the TOC entries in rows, one section with its subsections per row. If a row wraps, the wrapped line(s) should be indented a few picas(another paramameter |indentwrap=yes|no?). Can this be done with TOCa that works generically (like this one) on whatever headings happen to be in the article, rather than on some predetermined set of TOC entries (like {{TOC US states}}}? — Lentower (talk) 20:59, 27 February 2022 (UTC)