(no subject)
May. 24th, 2004 03:59 pm# this is kind of painful using only BREs
nroff -man "$1" | sed 's/&/\&/g;
s/</\</g;
s/>/\>/g;
s/@/\@/g;
s!\(.\)^H\1!<b>\1</b>!g;
s!\(&[#0-9a-z][0-9a-z]*;\)^H\1!<b>\1</b>!g;
s!_^H\(.\)!<i>\1</i>!g;
s!_^H\(&[#0-9a-z][0-9a-z]*;\)!<i>\1</i>!g;
s!</\([bi]\)><\1>!!g'
(^H means a single character 8, not the two characters ^ and H.)
(no subject)
Date: 2004-05-24 08:10 am (UTC)(Not that the scary sed script isn't cool and probably better written.)
(no subject)
Date: 2004-05-24 08:18 am (UTC)There's any number of manpage-to-HTML scripts. In the context at hand though I didn't want to introduce any unnecessary build dependencies - so no Perl, no sed beyond POSIX sed (e.g. GNU sed can do alternation using \| which would save me some repetition). Hence the remark about BREs.
Although I notice that awk uses EREs (and the autoconfery introduces an awk dependency, and who the hell doesn't have awk anyway) so perhaps I could have used that.
(no subject)
Date: 2004-05-24 08:51 am (UTC)(no subject)
Date: 2004-05-24 09:08 am (UTC)(no subject)
Date: 2004-05-24 09:19 am (UTC)(no subject)
Date: 2004-05-24 09:47 am (UTC)