TC2HTML-TOC(1)

πŸ“¦
version 1.04 Β· 2 versions
, in debian bookworm, ubuntu noble

πŸŽ€ NAME πŸŽ€

tc2html-toc β€” the table-of-contents processor for tc2html, bestie. It literally just moves your TOC to where it belongs. That's the whole job. Iconic behavior honestly.


✨ SYNTAX ✨

tc2html-toc file ...

yeah that's it. you hand it files, it does the thing. no cap.


πŸ’… DESCRIPTION πŸ’…

okay so context, because you need the lore:

tc2html is a postprocessor for troffcvt that spits out Hypertext Markup Language (HTML). and tc2html can generate a table of contents (TOC). but here's the tea β€” you can't know all the TOC entries until you've read the entire input document. so tc2html ends up writing the TOC near the end of the HTML document. awkward. tragic. not the vibe.

so to fix that whole situation, tc2html-toc goes through tc2html output, finds the table of contents, and moves it to the correct location. slay.

lowkey important: tc2html-toc gets invoked for you automatically if you use troff2html (which also invokes tc2html). but if you run tc2html manually? then you have to run tc2html-toc manually too. no shortcuts, bestie. 🫢


🌈 how tc2html and tc2html-toc gossip with each other 🌈

they cooperate via these conventions, and you need to know all of them:

if tc2html writes a TOC, it surrounds them with these two HTML comments:

<!-- TOC BEGIN -->
<!-- TOC END -->

if you want to explicitly say where the TOC goes, you can do that by invoking the .H*toc*title request in the document. that request writes a TOC title followed by this HTML comment:

<!-- INSERT TOC HERE -->

and there's more β€” macro package redefinitions used with tc2html can make a guess about where the TOC should live when there's no explicit location marker. to do that, a redefinition can write this advisory marker comment:

<!-- INSERT TOC HERE, MAYBE -->

for example: redefinitions for the -man macros can write an advisory location for the TOC once the .TH macro invocation has been seen. ✨


πŸ¦‹ so what does it actually do with all that πŸ¦‹

given all these conventions, tc2html-toc reads the input and examines it for the TOC and the TOC location.

if no TOC is found, the input is written unchanged to the output. periodt.

otherwise, these locations get used to reposition the TOC β€” and the ones listed first take priority:

  • The position of the TOC location marker.
  • The position of the advisory TOC location marker.
  • The beginning of the <BODY> part of the document.

πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ WHO-TO-BLAME πŸ‘‘

Paul DuBois, dubois@primate.wisc.edu.

(genuinely iconic of him to be this findable πŸ’–)


πŸ’€ DIAGNOSTICS πŸ’€

tc2html-toc exits with an error if it discovers that the TOC location marker lies within the TOC itself. yeah. it said not today. 🚩

and that's the whole page, bestie β€” straight out of the General Commands Manual, section 1, page TC2HTML-TOC(1), footer and all, no date in sight, and it's giving very "I read the source so you don't have to." go move some tables of contents. mwah. πŸ’…πŸŒΈ

πŸ“¦ where this page comes from