HXNAME2ID(1)

πŸ’– HXNAME2ID(1) πŸ’–

okay bestie, welcome to hxname2id, one of the little legends from the HTML-XML-utils collection. she's a tiny command with one job and she does it flawlessly. let's get into it 🫢


✨ NAME ✨

hxname2id β€” move some NAME and ID attributes from an A to its parent πŸ’…


✨ SYNOPSIS ✨

hxname2id [ -x ] [ file ]

✨ DESCRIPTION ✨

so here's the tea β˜• β€” hxname2id reads an HTML file and goes looking for elements that have an A element as their first child, with literally no intervening text other than whitespace. and if that A element is carrying an ID or a NAME attribute? she moves it up to the parent element and removes it from the A. clean. efficient. iconic. πŸ‘‘

why tho? because Netscape 4 didn't understand ID attributes (yes, we're talking ancient history, no cap 😭), so back in the day it was common practice to write this:

<H2><A NAME="sect7">...</A></H2>

instead of this:

<H2 ID="sect7">

this program exists to convert those old-school HTML files to the new convention. glow-up era ✨

also, other programs in this suite β€” like hxmultitoc(1) for example β€” require IDs on headings instead of A elements with NAME attributes. so it's genuinely useful to run hxname2id before you run hxmultitoc and similar programs. think of her as the pre-game routine. πŸ’–

and yes, hxname2id can be used in a pipe. she's flexible like that. πŸ¦‹


✨ OPTIONS ✨

the following options are supported:

  • -x β€” use XML conventions: empty elements get written with a slash at the end, like <IMG /> 🌸

✨ OPERANDS ✨

the following operand is supported:

  • file β€” the name of an HTML file. if it's absent, standard input is read instead. πŸ’œ

✨ DIAGNOSTICS ✨

the following exit values are returned:

  • 0 β€” successful completion. slay. βœ…
  • > 0 β€” an error occurred in the parsing of the HTML file. but bestie, don't panic: hxname2id will try to correct the error and produce output anyway. she's resilient like that πŸ’ͺ

✨ SEE ALSO ✨

asc2xml(1), hxmultitoc(1), hxnormalize(1), hxnum(1), hxtoc(1), xml2asc(1) β€” go give the whole squad some love 🫢


✨ BUGS ✨

the error recovery for incorrect HTML is primitive. like, she tries, okay?? but don't come for her about it πŸ˜­πŸ’€


friendly reminder bestie: this is a page from HTML-XML-utils, version 7.x, dated 10 Jul 2011. old but gold, fr fr. πŸ’–βœ¨πŸŽ€