Re: Table of contents added to pages, yay!

Well, we could check __NOTOC__ and set a no-toc class on the root element accordingly ;)

Lea Verou
W3C developer relations
http://w3.org/people/all#leahttp://lea.verou.me ✿ @leaverou






On May 10, 2013, at 12:57, David Kirstein wrote:

> Ah okay, didn't know that. Makes sense. :)
> 
> Hmm, I just don't want to jeopardize anything, if we later decide to use the internal TOC somehow. I'm still in favor of __NOTOC__ to hide the TOC, but I don't think there are any additional indicators of whether this flag is set or not, in the source, if we remove the #toc table completely from the output, for every page. Maybe, when we're at it, we could modify MW in a way that such an info gets emitted and the script can then check for that.
> 
> -fro
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Lea Verou [mailto:lea@w3.org] 
> Gesendet: Freitag, 10. Mai 2013 11:18
> An: David Kirstein
> Cc: 'Doug Schepers'; 'Eliot Graff'; public-webplatform@w3.org
> Betreff: Re: Table of contents added to pages, yay!
> 
> Hi David,
> 
> Doug is actually looking to remove MW TOCs from our pages, since they make the page heavier. E.g. the border-radius TOC was 2.75KB, more than my script even! And it's on every page...
> 
> Cheers,
> Lea
> 
> Lea Verou
> W3C developer relations
> http://w3.org/people/all#leahttp://lea.verou.me ✿ @leaverou
> 
> 
> 
> 
> 
> 
> On May 10, 2013, at 12:05, David Kirstein wrote:
> 
>> Hi,
>> 
>> the actual problem is, that the language bar has "clear: both;" and the client TOC has "float: right;". That will probably affect other pages, that have translations, too.
>> 
>> Removing the clear from the language bar would fix the issue, that the content is pushed down, but that doesn't work for Main_Page because of the 9 content blocks (which also float). But as Lea said, we don't need a TOC for Main_Page. (I hope there aren't other pages, that use float-stuff in their content)
>> 
>> Also, there are other divs / messages that have clear set, even MW internal ones like .mw-warning-with-logexcerpt (warnings box on preview if, for example, something is protected). Maybe that won't be an issue though, as we normally don't encounter these.
>> 
>> The TOC also interferes with our flags: http://docs.webplatform.org/wiki/css/properties/transition-timing-function
>> (but those might get restyled anyway?!)
>> 
>> That's why I always try to avoid using float. :>
>> 
>> And for the no TOC thing, MW has a magic word __NOTOC__ that hides the MW-generated TOC for a page. I suggest we use that to specify that we don't want a TOC for a specific page. The script would then check if the MW TOC is there (table with id and class "toc"), as #toc won't get emitted if __NOTOC__ is used.
>> [MW only adds #toc{display:none} but doesn't actually remove the TOC if a user has disabled TOC display in his preferences, which is the default in our install]
>> 
>> But all in all, I like our new TOCs very much! :)
>> 
>> -fro
>> 
>> 
>> -----Ursprüngliche Nachricht-----
>> Von: Lea Verou [mailto:lea@w3.org] 
>> Gesendet: Freitag, 10. Mai 2013 02:55
>> An: Doug Schepers
>> Cc: Eliot Graff; public-webplatform@w3.org
>> Betreff: Re: Table of contents added to pages, yay!
>> 
>> A no-toc class sounds great.
>> 
>> Lea Verou
>> W3C developer relations
>> http://w3.org/people/all#leahttp://lea.verou.me ✿ @leaverou
>> 
>> 
>> 
>> 
>> 
>> 
>> On May 10, 2013, at 03:37, Doug Schepers wrote:
>> 
>>> Hi, Lea-
>>> 
>>> For pages that don't need a TOC, like that one, how about we add a "no_toc" class somewhere in the page, which your script can search for? If it finds that class, it doesn't generate the TOC.
>>> 
>>> Regards-
>>> -Doug
>>> 
>>> On 5/9/13 8:32 PM, Eliot Graff wrote:
>>>> Probably don’t need a TOC for that type of page (my guess is there will
>>>> be more than one of these and they should be short enough not to warrant
>>>> it).
>>>> 
>>>> Sleep well!
>>>> 
>>>> *From:*Lea Verou [mailto:lea@w3.org]
>>>> *Sent:* Thursday, May 9, 2013 5:29 PM
>>>> *To:* Eliot Graff
>>>> *Cc:* public-webplatform@w3.org
>>>> *Subject:* Re: Table of contents added to pages, yay!
>>>> 
>>>> Oh damn, that’s pretty serious. :( Thanks for spotting! Will get to it
>>>> first thing tomorrow (it's currently 3:30am here).
>>>> 
>>>> Do we even need a TOC on that page?
>>>> 
>>>> Lea Verou
>>>> 
>>>> W3C developer relations
>>>> 
>>>> http://w3.org/people/all#leahttp://lea.verou.me ✿ @leaverou
>>>> 
>>>> 
>>>> 
>>>> On May 10, 2013, at 03:23, Eliot Graff wrote:
>>>> 
>>>> 
>>>> 
>>>>  Looks wonderful, Lea.
>>>> 
>>>>  I think the main page has an issue with the TOC pushing the layout
>>>>  down.http://docs.webplatform.org/wiki/Main_Page
>>>> 
>>>>  Thank you so much for taking this on!!!!!!!
>>>> 
>>>>  Eliot
>>>> 
>>>>  *From:*Lea Verou [mailto:lea@w3.org]
>>>>  *Sent:*Thursday, May 9, 2013 5:02 PM
>>>>  *To:*public-webplatform@w3.org <mailto:public-webplatform@w3.org>
>>>>  *Subject:*Table of contents added to pages, yay!
>>>> 
>>>>  Hi all,
>>>> 
>>>>  I recently came up with the idea of having a client-side generated
>>>>  Table Of Contents (TOC). In coordination with Doug, I wrote a script
>>>>  to generate it and deployed it to WPD. This has the benefit of being
>>>>  smaller (1.5KB) than a server-side TOC and cachable and most
>>>>  importantly, it solved the issues we had with the headings. Hope you
>>>>  like it.
>>>> 
>>>>  We had to remove the width: 100%; from tables to avoid them being
>>>>  pushed down by the TOC, so please keep an eye out for table
>>>>  rendering issues.
>>>> 
>>>>  Here you can see an example:
>>>>  http://docs.webplatform.org/wiki/css/properties/border-radius
>>>> 
>>>>  This was a long outstanding bug, so it’s exciting to finally have
>>>>  solved it!
>>>> 
>>>>  Cheers,
>>>> 
>>>>  Lea
>>>> 
>>>>  Lea Verou
>>>> 
>>>>  W3C developer relations
>>>> 
>>>>  http://w3.org/people/all#leahttp://lea.verou.me ✿ @leaverou
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

Received on Friday, 10 May 2013 11:34:02 UTC