CVSROOT: /cvs Module name: src Changes by: schwa...@cvs.openbsd.org 2020/03/12 18:31:06
Modified files: usr.bin/mandoc : Makefile html.c html.h main.c man_html.c man_term.c man_validate.c mdoc_html.c mdoc_term.c mdoc_validate.c read.c tag.c tag.h tree.c regress/usr.bin/mandoc: Makefile.inc regress/usr.bin/mandoc/man/IP: Makefile empty.in empty.out_ascii empty.out_lint literal.out_html regress/usr.bin/mandoc/man/TP: Makefile literal.out_html vert.out_html regress/usr.bin/mandoc/mdoc: Makefile regress/usr.bin/mandoc/mdoc/Cm: Makefile regress/usr.bin/mandoc/mdoc/Dv: Makefile regress/usr.bin/mandoc/mdoc/Em: Makefile regress/usr.bin/mandoc/mdoc/Er: Makefile regress/usr.bin/mandoc/mdoc/Ev: Makefile regress/usr.bin/mandoc/mdoc/Fl: Makefile regress/usr.bin/mandoc/mdoc/Fo: Makefile regress/usr.bin/mandoc/mdoc/Ic: Makefile regress/usr.bin/mandoc/mdoc/Li: Makefile regress/usr.bin/mandoc/mdoc/Ms: Makefile regress/usr.bin/mandoc/mdoc/No: Makefile punct.out_lint regress/usr.bin/mandoc/mdoc/Sy: Makefile Added files: usr.bin/mandoc : term_tag.c term_tag.h regress/usr.bin/mandoc: copyless regress/usr.bin/mandoc/man/IP: empty.out_html empty.out_tag tag.in tag.out_ascii tag.out_html tag.out_tag regress/usr.bin/mandoc/man/TP: tag.in tag.out_ascii tag.out_html tag.out_tag regress/usr.bin/mandoc/mdoc/Cm: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Dv: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Em: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Er: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Ev: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Fl: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Fo: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Ic: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Li: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Ms: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/No: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Sy: tag.in tag.out_ascii tag.out_html tag.out_markdown tag.out_tag regress/usr.bin/mandoc/mdoc/Tg: Makefile warn.in warn.out_ascii warn.out_html warn.out_lint warn.out_markdown warn.out_tag Log message: Split tagging into a validation part including prioritization in tag.{h,c} and {mdoc,man}_validate.c and into a formatting part including command line argument checking in term_tag.{h,c}, html.c, and {mdoc|man}_{term|html}.c. Immediate functional benefits include: * Improved prioritization of automatic tags for .Em and .Sy. * Avoiding bogus automatic tags when .Em, .Fn, or .Sy are explicitly tagged. * Explicit tagging of .Er and .Fl now works in HTML output. * Automatic tagging of .IP and .TP now works in HTML output. But mainly, this patch provides clean earth to build further improvements on. Technical changes: * Main program: Write a tag file for ASCII and UTF-8 output only. * All formatters: There is no more need to delay writing the tags. * mdoc(7)+man(7) formatters: No more need for elaborate syntax tree inspection. * HTML formatter: If available, use the "string" attribute as the tag. * HTML formatter: New function to write permalinks, to reduce code duplication. Style cleanup in the vicinity while here: * mdoc(7) terminal formatter: To set up bold font for children, defer to termp_bold_pre() rather than calling term_fontpush() manually. * mdoc(7) terminal formatter: Garbage collect some duplicate functions. * mdoc(7) HTML formatter: Unify <code> handling, delete redundant functions. * Where possible, use switch statements rather than if cascades. * Get rid of some more Yoda notation. The necessity for such changes was first discussed with kn@, but i didn't bother him with a request to review the resulting -673/+782 line patch.