Template talk:CompactTOC8

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Contents

[edit] Feature requests

[edit] Unused letters

Resolved: Done (and then some).

I want the toc not to show unincluded letters! —Preceding unsigned comment added by 77.177.31.102 (talk) 01:16, August 25, 2007 (UTC)

I can probably code that in there, but its usage will be very tedious, something like |j=no|k=no|q=no|v=no|w=no|z=no, and it would have to be manually updated; MediaWiki template and ParserFunction syntax ain't exactly PHP; it can't auto-detect such things. — SMcCandlish [talk] [cont] ‹(-¿-)› 02:35, 27 August 2007 (UTC)

[edit] An "az=no" option, and "line1" shorthand

  • If CompactTOC8 is poised to emulate/replace all other TOC templates, I think there's at least one feature missing. Currently I have to use {{OnelinerTOC}} like this:
{{OnelinerTOC|notop=y|List|See also|References|External links}}

(I don't display the result here because it would disable the discussion page's own TOC, but the result can be seen at List of mountains in Peru.)

  • To emulate it with CompactTOC8, an az=no option would be needed, like this:
{{CompactTOC8|side=yes|nobreak=yes|az=no|custom1=List|seealso=yes|refs=yes|extlinks=yes}}

(I realize I could cancel each letter separately, but that's too much trouble ;-)

  • Also, since a non-alphabet linear TOC is a common need for many list articles, maybe there could also be a new shorthand, a "line1" keyword as first param, that would perform exactly the same as the two examples above with just:
{{CompactTOC8|line1|custom1=List|seealso=yes|refs=yes|extlinks=yes}}

(I've not evaluated how complicated it would be to implement this, though.)

— Komusou talk @ 20:03, 7 October 2007 (UTC)

That all sounds sensible, but I don't understand why it would be called "line1". — SMcCandlish [talk] [cont] ‹(-¿-)› 17:44, 15 August 2008 (UTC)
PS: CompactTOC8 could easily absorb all the functionality of OnelinerTOC simply by supporting its functions, its named parameters that don't match C'TOC8s but do map to its functionality, and since C'TOC8 doesn't use any unnamed parameters, we can simply reserve them for precisely the function O'l'TOC is doing (i.e. make unnamed parms match to custom1, custom2, etc. — SMcCandlish [talk] [cont] ‹(-¿-)› 18:26, 15 August 2008 (UTC)

[edit] Explicit custom

Curently, the template does this with custom1:

Input: custom1 = foo
Output: [[#foo|foo]]

Which is generally good, but wouldn't it be possible to add somthing in to choose where the link is, and what the name is? I found an article where I would want the link to appear as [[#foo|bar]], but it is not possible to do this. I don't think implementing this change would be too difficult:

We add customname1, which when present changes the name of the link.

happypal (Talk | contribs) 18:55, 8 July 2008 (UTC)

Unless I get instruction not to do so, I'll do it in a few days with the varaible names custom1name custom2name and custom3name.happypal (Talk | contribs) 18:57, 8 July 2008 (UTC)
Sounds good to me; the more features the better. The real doozy is going to be making it work across multi-page articles! — SMcCandlish [talk] [cont] ‹(-¿-)› 17:42, 15 August 2008 (UTC)

[edit] Numeric list option

It would be cool if it could do numeric lists, to arbitary numbers (i.e. specify a range, like 0-10, or 1-213 or whatever. I've been away from parserfunction code for so long, I can't even remember if this is feasible (other than manually coding it up to a limit of numbers, I mean). — SMcCandlish [talk] [cont] ‹(-¿-)› 18:19, 15 August 2008 (UTC)

[edit] Aa - Zz

It's conceivable that some uses will need Aa Ab ... Zy Zz. — SMcCandlish [talk] [cont] ‹(-¿-)› 18:19, 15 August 2008 (UTC)

[edit] Border & background removal

One of the only remaining features supported by one or another of the CompactTOC family not supported here is the ability to do away with the border and background; I forget which one has this, but it is used on a lot of "Wikipedia:" namespace pages. — SMcCandlish [talk] [cont] ‹(-¿-)› 18:29, 15 August 2008 (UTC)

[edit] Crucial: Multi-page articles

Probably the most-needed upgrade is the ability to work in multi-page list articles. My initial thoughts on this are that there should be:

  • apage= ... zpage= (and numpage=, sympage= and numsympage=) where the value would be the page name. Like, I have a big list article that is broken up into three pages. Page 1 contains entries under numsym through K, page 2 is L through P, and page 3 is Q through Z. Page one is FoobarbazquuxA, the second FoobarbazquuxB and the third is FoobarbazquuxC. The code to add would be:
    |numsympage=FoobarbazquuxA|lpage=FoobarbazquuxB|qpage=FoobarbazquuxC
    and it would just work on all three pages, treating everything after the letter specified in a *page as being on the same page until it hits another *page parameter.
  • A shorthand, for cases where we want every single letter of the alphabet (or numbers; see feature idea above) to be on its own page, w/o having to manually do it all with apage=, bpage=, etc. Maybe somethng like this: A pagebase= and pageincrement pair, used like this (intended mainly for "Wikipedia:" namespace uses where there would be a page for every single letter; I doubt any list articles are actually that size, though someday they could be), and it would work like:
    |pagebase=Foobarbazquux|pageincrement=alpha
    (with num being the other possible value, for pagenames like Foobarbazquux1, Foobarbazquux2, etc.

Someone might be able to think of a smarter way to do it.

PS: Of course, a tedious work around for multi-page articles with only a few pages would be to do something like
...|l=|p=|...|z=|custom1=L-P|customtarget1=FoobarbazquuxB...
but customname* isn't even implemented yet, much less a customtarget* that could specify a different article entirely.

Ideas? This is actually of some importance to me, because Glossary of cue sports terms is approaching 200K and people are complaining.

SMcCandlish [talk] [cont] ‹(-¿-)› 18:19, 15 August 2008 (UTC)

[edit] Merge

I think it is almost time to go to TfD and get all the lesser templates of this sort merged into this one, and have it renamed to CompactTOC, since it not only will do everything they will, it also has simple default usage. The stumbling block would be to ensure that all parameters of the lesser templates are handled (even if not documented - some might need to be intentionally deprecated by not mentioning them) by this one. — SMcCandlish [talk] [cont] ‹(-¿-)› 18:13, 27 November 2007 (UTC)

[edit] Sept. 2007 changes needed documentation

Resolved: Documented.

Circeus and someone else have made a bunch of changes recently, and their effects are not reflected in the documentation. — SMcCandlish [talk] [cont] ‹(-¿-)› 19:09, 9 September 2007 (UTC)

They are, I'm pretty sure I didn't forget anything. I added 3 "custom" parameters (+legacy "Sec" for compatibility with other existing templates), and the letter replacement stuff. Am I forgetting anything? Circeus 19:43, 9 September 2007 (UTC)
Looks good, but I would remove the "Sec" stuff from the documentation, so people don't keep using them. — SMcCandlish [talk] [cont] ‹(-¿-)› 17:37, 15 August 2008 (UTC)

[edit] New features

I added a couple extra features, and I updated the doc:

  • Up to 5 custom tables now.
  • Custom name for custom sections:custom1name field. It is possible for the link to appear as:[[#custom1|custom1name]]
  • Linking to outside pages is possible, using custom1link field: [[custom1link|custom1]]

If this breaks anything, or if you have any question, please inform me. happypal (Talk | contribs) 08:53, 21 August 2008 (UTC)

[edit] Redirect Numbers?

OK, I see how to include an entry for numbers (num=yes), and I see how to redirect letters, but how does one redirect the number entry in the toc to a separate page? I'm trying to build a toc for an article that spans a number of pages, and I'd like to be able to access the number portion from any of those pages. Please specify the syntax. Dawynn (talk) 20:29, 16 December 2008 (UTC)

[edit] New parameters, validation & internal comments

10-Jan-2009: New parameters have been added (pre1, pre2, prebreak, sep, ...). The internal coding of the template has been expanded and documented with source-code comments, using the typical HTML form (using "<!-- -->"). Invalid parameters (such as "ref" for "refs" or "ext" for "extlinks") are detected now and rejected. See details below. -Wikid77 (talk) 10-Jan-2009

[edit] Header parameters after ABC: custom6 7 8

The new parameters custom6, custom7, custom8 (or Sec6, Sec7, Sec8) allow up to 8 section headers after the ABCDEF links. -Wikid77 (talk) 21:55, 10 January 2009 (UTC)

[edit] Header parameters before ABC: pre1 pre2 pre8

The new parameters pre1, pre2, ..., pre7, pre8 (or preSec1, preSec2, ... preSec8) allow up to 8 section headers to be listed before the ABCDEF links. This is totally new. They can be given display-names as pre1name, pre2name (or preSec1name, preSec2name etc.) to conceal a different link name, such as to another article, or an external webpage. So, the total of headers becomes:

Contents: Top pre1 pre2 pre8 A B C D E F custom1 custom2 custom8

Combining the pre1...pre8, with the custom1...custom8, allows up to 16 other header sections to be listed in the TOC. -Wikid77 (talk) 21:55, 10 January 2009 (UTC)

[edit] Separator parameter: sep

The new parameter "sep" can set the separator text between the word-headers (not between ABCDEF...). Use "sep=&middot;" to put middots between the header names. Bold middots can be set by putting 3 quotemarks before/after the middot. -Wikid77 (talk) 21:55, 10 January 2009 (UTC)

[edit] Prefix break parameter: prebreak

The new parameter "prebreak" can set the break-text after all the pre-listed headers pre1, pre2...pre8 (not between ABCDEF...). Typically, this would be one break-tag as "prebreak=<br>" but could include more text that introduces the line of "ABCDEF...". -Wikid77 (talk) 21:55, 10 January 2009 (UTC)

[edit] Validation rejects invalid parameters

For decades, some software procedures have used "parameter validation" to check for problems when passing parameters. Templates can do validation, as well, and now CompactTOC8 does. There is a section of code, at the end of the template, that warns when it finds & rejects invalid parameter names: centre, Top, ref, Ref, ext, extlink, etc. The concept is to have the template check for common typos and say whoa. It works: most invalid parameters will be a few common misspellings. Otherwise, invalid parameters are totally ignored (as typical) and users are left in the dark (neat, huh, ya right). Although some computers act by "No news is good news", today's compu-trash computers think "No news doesn't mean anything, because we ignore the slightest problem, and for years, no one will ever know what went wrong". It doesn't have to be that way, but when parameters are rejected, then text has to be fixed to avoid error messages. It is a design choice to ignore problems, beause often, the error messages are worse than the original problem. Please don't blame any wiki-developers, because unreported errors are rampant in 90% of all websites and poorly designed software, worldwide. Just help to foster parameter and data checking in future templates. -Wikid77 (talk) 21:55, 10 January 2009 (UTC)

[edit] non-Latin lists

Is there a horizontal TOC template for lists which are not in the Latin alphabet, for example List of Cyrillic digraphs?

Thanks, kwami (talk) 20:17, 23 April 2009 (UTC)

[edit] consistent opening and closing <div> tags

The following section of the template code adds an opening <div style="text-align:???"> tag when the conditional statement evaluates to false, but does not add an opening <div> tag when the conditional statement evaluates to true.

<!-- ----------------------------------- Check name/side-->
#ifeq:{{{name|}}}|no||! {{{name|{{MediaWiki:Toc}}}}}{{#ifeq:{{{side|{{#ifeq:{{{1|}}}|short1|yes|}}}}}|yes|:|}}
{{#ifeq:{{{side|{{#ifeq:{{{1|}}}|short1|yes|}}}}}|yes|{{!}}|{{!}}-}}}}
|{{#ifeq:{{{nobreak|{{#ifeq:{{{1|}}}|short1|yes|}}}}}|yes||<div style="text-align:{{{align|left}}};">}}{{

At around line 71 there is a closing </div> tag that is used regardless of the result of the conditional statement. Doesn't the conditional statement need to have an opening tag for each result to avoid cases that place a closing tag without an opening tag? It seems that the last bit of the conditional statement should be changed from:

|{{#ifeq:{{{nobreak|{{#ifeq:{{{1|}}}|short1|yes|}}}}}|yes||<div style="text-align:{{{align|left}}};">}}{{

to:

|{{#ifeq:{{{nobreak|{{#ifeq:{{{1|}}}|short1|yes|}}}}}|yes|<div>|<div style="text-align:{{{align|left}}};">}}{{

--PerkinsTaylor (talk) 23:51, 8 September 2010 (UTC)

[edit] Columns?

Is it possible to get a TOC to display in two or more columns? Mjroots (talk) 05:14, 16 September 2010 (UTC)

[edit] I need a new TOC . . .

Hello, all. I hope you are doing just fine today. Anyway, what I need is a (I think) horizontal TOC to go across the top of List of California public officials charged with crimes. Can anybody help? Sincerely, GeorgeLouis (talk) 17:14, 28 May 2011 (UTC)

[edit] Move?

Template:CompactTOC8Template:CompactTOC – Obviously, this is the only "CompactTOC" template that exists at this time. If "CompactTOC" doesn't work, why not Template:Alphabetical TOC? --George Ho (talk) 02:30, 2 March 2012 (UTC)

  • Hell yes! This was my goal and when I created this in 2007, and was actually what TfD decided was the right thing to do, I just couldn't do it because I wasn't an admin, and no one else got around to it until now. I'd suggest Template:Compact ToC for clarity, but redir from CompactTOC. — SMcCandlish   Talk⇒ ɖ∘¿¤þ   Contrib. 00:24, 3 March 2012 (UTC)
Personal tools
Namespaces

Variants
Actions
Navigation
Interaction
Toolbox