# -man-specific stuff for tc2html

# this helps to map -man macros onto tc2hmtl concepts

# Names are removed before being redefined.  Some of these names are
# aliased (by groff), and redefining them would also redefine the aliases.

imm remove-name n TH
req TH parse-macro-args eol \
		break center 0 fill adjust b \
		push-string ".H*title\n" \
		font "R" push-string "$1 manual page\n" \
		push-string '.H*toc*title "Table of Contents" x\n'

imm remove-name n SH
req SH parse-macro-args eol \
		break center 0 fill adjust b \
		push-string ".H*header 2\n" \
		push-string ".H*atoc 1\n" \
		font "R" push-string "$*" \
		push-string ".H*aend\n" \
		push-string ".H*header*end\n"

imm remove-name n SS
req SS parse-macro-args eol \
		break center 0 fill adjust b \
		push-string ".H*header 3\n" \
		font "R" push-string "$*" \
		push-string ".H*header*end\n"

imm remove-name n LP
req LP parse-macro-args eol \
		break center 0 fill adjust b \
		push-string ".H*para\n" \
		font "R"

imm remove-name n PP
req PP parse-macro-args eol \
		push-string ".LP\n"

# write indented paragraphs as a definition list
imm remove-name n IP
req IP parse-macro-args eol \
		break center 0 fill adjust b \
		push-string ".H*dterm\n" font "R" \
		push-string "$1\n" \
		push-string ".H*ddesc\n"

imm remove-name n TP
req TP eol \
		break center 0 fill adjust b \
		push-string ".H*dterm\n" font "R" \
		input-trap 1 H*TP*capture

# have to define H*TP*capture this way because the input-trap macro must
# really be a macro, not a troffcvt request.
imm push-string ".de H*TP*capture\n.H*ddesc\n..\n"

# Be careful.  Not all -man implementations seem to support .DS/.DE...

imm remove-name n DS
req DS parse-macro-args eol \
		break nofill \
		push-string ".H*disp\n" \
		push-string ".H*disp*indent 3\n" \
		font "R"

imm remove-name n DE
req DE parse-macro-args eol \
		break center 0 fill \
		push-string ".H*disp*end\n" \
		font "R"

imm remove-name n RS
req RS parse-macro-args eol \
		break \
		push-string ".H*shift*right\n"

imm remove-name n RE
req RE parse-macro-args eol \
		break \
		push-string ".H*shift*left\n"
