Template talk:Horizontal TOC
Please place new discussions at the bottom of the talk page. |
This is the talk page for discussing improvements to the Horizontal TOC template. |
|
Archives: 1Auto-archiving period: 180 days |
This template was considered for deletion on 2019 July 12. The result of the discussion was "redirect". |
Vector 2022 sticky table of contents
[edit]In the future when sticky table of contents are enabled this template may become obsolete and historical for skin Vector 2022. Thingofme (talk) 13:15, 31 May 2022 (UTC)
Center alignment
[edit]@TheDJ and Izno: the |align=center
does not work (pointed out by Sanglahi86). as far as I can tell, left and right align do work. I modified the CSS for align center in Template:Horizontal TOC/sandbox/styles.css, which works for me, but I am not a css expert. adding display:table
worked as well, but I am assuming that display:flex
is the better way to fix this? Frietjes (talk) 14:29, 11 July 2022 (UTC)
- Well, Vector 22 makes this something of a moot point for the majority of desktop, and mobile doesn't care about these templates.
- Anyway, fixed with moving the margins to the .toc element instead which is where they should have been the entire time. Izno (talk) 16:53, 11 July 2022 (UTC)
Remove heading
[edit]It would be good if there was an option to remove the Contents heading (and the [hide] link) — GhostInTheMachine talk to me 21:22, 11 July 2022 (UTC)
- That wouldn't clearly indicate the purpose of the table of contents... so, why? Izno (talk) 21:59, 11 July 2022 (UTC)
- It sounds like at that point, you're asking for personal preference. I do not doubt there's CSS to add to your MyPage/skin.css to make it work. – The Grid (talk) 13:25, 21 July 2022 (UTC)
Only display sections after the TOC
[edit]At List of Lebanon international footballers born outside Lebanon, is there a way to only display the countries (Armenia, Australia, Brazil, ...) without having to show the sections above "Players", and the ones below "Venezuela" (List of countries, see also, ...)? Thanks in advance, Nehme1499 12:10, 31 July 2022 (UTC)
- @Nehme1499: You made quite a hack with {{Compact TOC}} but it's poorly suited for this. I made {{Table TOC}} last year but haven't documented it. The name implies use to link anchors in a table like List of aircraft carrier operations during World War II#List of named operations involving aircraft carriers but it also works for sections. I have used it in the article and also added
{{TOC limit|2}}
to get a normal TOC after the lead.[1] {{Table TOC}} requires manual updating to change links. There is no automatic solution. PrimeHunter (talk) 00:05, 1 August 2022 (UTC)- Thanks for the solution! Definitely much cleaner than what I did. Nehme1499 00:12, 1 August 2022 (UTC)
Unbalanced spacing
[edit]This template seems to produce unbalanced spacing inside parentheses under certain circumstances - see Timeline of quantum computing and communication as an example - there's a space after each opening parenthesis, but not one before each closing parenthesis. DH85868993 (talk) 05:57, 28 November 2023 (UTC)
- Pinging Izno, who made the most recent change. This happens when
|nonum=
is set. The numbers are removed, but the whitespace following each number is still present. – Jonesey95 (talk) 14:26, 28 November 2023 (UTC)
Not my fault :) and not something that can actually be fixed. Right now the structure of a TOC item is the following:
<a href="..."><span class="tocnumber">3.1</span> <span class="toctext">1980</span></a>
|nonum=
hides the tocnumber by CSS, so, without that there:
<a href="..."> <span class="toctext">1980</span></a>
HTML treats whitespace on the inside of a tag before other content as significant, so that space between > and < doesn't get removed, causing this 'issue'. As you might note, there is no whitespace after the toctext span, so there is no issue with closing parentheses.
There is some CSS that I think would help but it is a long way from being available to us (first it needs to be implemented in the major browsers and then it needs to be made available in WP:TemplateStyles).
This could probably be corrected by a request in Phabricator to move the space into the number, or we can wait for the CSS to become available (in N years timeframe). I do not know how likely it would be implemented if you ask to move the space. (Thanks for asking about this, I've seen this around and thought it was weird but never investigated.) Izno (talk) 00:33, 29 November 2023 (UTC)
- Could we do something hacky like feeding the output of the template into a string replacement template that swapped " ( " for " ("? – Jonesey95 (talk) 01:54, 29 November 2023 (UTC)
- No, all that any (Lua) system would see is the keyword that adds the toc (
__TOC__
) or a strip marker for the same. It is not something we have access to change. Izno (talk) 01:59, 29 November 2023 (UTC)
- No, all that any (Lua) system would see is the keyword that adds the toc (