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:hxname2idwill 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. πβ¨π
π¦ where this page comes from
- alpine 3.24: html-xml-utils-doc 8.7-r0 Β· W3C
- arch rolling: html-xml-utils 8.8-1 Β· W3C
- debian bookworm: html-xml-utils 7.7-1.1 Β· W3C
- debian trixie: html-xml-utils 7.7-1.1+b1 Β· W3C
- fedora 43: html-xml-utils 8.6-2.fc41 Β· W3C AND BSD-3-Clause
- fedora 44: html-xml-utils 8.7-1.fc44 Β· W3C AND BSD-3-Clause
- nixos 26.05: html-xml-utils 8.7
- nixpkgs unstable: html-xml-utils 8.7
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- opensuse-leap 16.0: html-xml-utils 8.6-bp160.1.12 Β· W3C
- ubuntu jammy: html-xml-utils 7.7-1.1 Β· W3C
- ubuntu noble: html-xml-utils 7.7-1.1build2 Β· W3C
- ubuntu questing: html-xml-utils 7.7-1.1build2
- ubuntu resolute: html-xml-utils 7.7-1.3 Β· W3C
- ubuntu stonking: html-xml-utils 7.7-1.3 Β· W3C
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms