From 1d11921f2976256828f5a0d56b503097523039ef Mon Sep 17 00:00:00 2001 From: bmah Date: Fri, 16 Feb 2007 02:10:12 +0000 Subject: Add support for auto-generating hardware notes entries in a manner consistent with the new MI-style hardware notes document. man2hwnotes.pl now defaults to generating entities for the MI-style hardware notes (i.e. hardware/article.sgml). A new -c option causes it to generate entities for the older MD-style hardware notes (i.e. hardware/common/dev.sgml). The Makefile infrastructure supplies the -c option to man2hwnotes.pl now unless the HWNOTES_MI Makefile variable is defined, so compatiblity is preserved for hardware notes translations that aren't converted to the new organization yet. As translations convert, they should define HWNOTES_MI in their hardware/Makefile. When all the relevant translations catch up, the compatibility goop in share/mk/doc.relnotes.mk and share/sgml/Makefile can be removed. Thanks go to simon@ for help with the backwards compatiblity mechanism. Tested with: en_US.ISO8859-1, zh_CN.GB2312 --- release/doc/share/misc/man2hwnotes.pl | 28 ++++++++++++++++++++++------ release/doc/share/mk/doc.relnotes.mk | 7 ++++++- release/doc/share/sgml/Makefile | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) (limited to 'release') diff --git a/release/doc/share/misc/man2hwnotes.pl b/release/doc/share/misc/man2hwnotes.pl index c355ac9..75b1af2 100644 --- a/release/doc/share/misc/man2hwnotes.pl +++ b/release/doc/share/misc/man2hwnotes.pl @@ -40,7 +40,7 @@ # arguments to the .It command, only the argument will be printed. # Usage: -# man2hwnotes.pl [-l] [-d 0-6] [-a ] [-o ] +# man2hwnotes.pl [-cl] [-d 0-6] [-a ] [-o ] # [ ...] use strict; @@ -55,6 +55,7 @@ my $archlist_file = "dev.archlist.txt"; my %archlist; # Globals +my $compat_mode = 0; # Enable compat for old Hardware Notes style my $debuglevel = 0; my $only_list_out = 0; # Should only lists be generated in the output? my @out_lines; # Single lines @@ -62,10 +63,13 @@ my @out_dev; # Device entities # Getopt my %options = (); -if (!getopts("a:d:lo:",\%options)) { +if (!getopts("a:cd:lo:",\%options)) { die("$!: Invalid command line arguments in ", __LINE__, "\n"); } +if (defined($options{c})) { + $compat_mode = 1; +} if (defined($options{d})) { $debuglevel = $options{d}; } @@ -367,9 +371,17 @@ sub flush_out { $entity_name = add_txt_ent(${$mdocvars}{parabuf}); ${$mdocvars}{parabuf} = ""; if(defined($archlist{${$mdocvars}{Nm}})) { - $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; + if ($compat_mode) { + $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; + } else { + $para_arch = '[' . $archlist{${$mdocvars}{Nm}} . '] '; + } + } + if ($compat_mode) { + $out = "&".$entity_name.";"; + } else { + $out = "".$para_arch."&".$entity_name.";"; } - $out = "&".$entity_name.";"; dlog(4, "Flushing parabuf"); add_sgmltag($mdocvars, $out); @@ -384,8 +396,12 @@ sub add_listitem { $entity_name = add_txt_ent(${$mdocvars}{parabuf}); ${$mdocvars}{parabuf} = ""; - if(defined($archlist{${$mdocvars}{Nm}})) { - $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; + if ($compat_mode) { + if(defined($archlist{${$mdocvars}{Nm}})) { + $para_arch = ' arch="' . $archlist{${$mdocvars}{Nm}} . '"'; + } + } else { + $listitem = "&".$entity_name.";"; } $listitem = "&".$entity_name.";"; dlog(4, "Adding '$listitem' to out_dev"); diff --git a/release/doc/share/mk/doc.relnotes.mk b/release/doc/share/mk/doc.relnotes.mk index 2fe30d7..95d1e49 100644 --- a/release/doc/share/mk/doc.relnotes.mk +++ b/release/doc/share/mk/doc.relnotes.mk @@ -43,9 +43,14 @@ DEV-AUTODIR= ${RELN_ROOT:S/${.CURDIR}/${.OBJDIR}/}/share/sgml CLEANFILES+= ${DEV-AUTODIR}/dev-auto.sgml ${DEV-AUTODIR}/catalog-auto MAN2HWNOTES_CMD=${RELN_ROOT}/share/misc/man2hwnotes.pl +.if defined(HWNOTES_MI) +MAN2HWNOTES_FLAGS= +.else +MAN2HWNOTES_FLAGS= -c +.endif # Dependency that the article makefiles can use to pull in # dev-auto.sgml. ${DEV-AUTODIR}/catalog-auto ${DEV-AUTODIR}/dev-auto.sgml: ${MAN4PAGES} \ ${ARCHLIST} ${MAN2HWNOTES_CMD} - cd ${RELN_ROOT}/share/sgml && make dev-auto.sgml + cd ${RELN_ROOT}/share/sgml && make MAN2HWNOTES_FLAGS=${MAN2HWNOTES_FLAGS} dev-auto.sgml diff --git a/release/doc/share/sgml/Makefile b/release/doc/share/sgml/Makefile index 6860cb2..e15b141 100644 --- a/release/doc/share/sgml/Makefile +++ b/release/doc/share/sgml/Makefile @@ -6,7 +6,7 @@ RELN_ROOT?= ${.CURDIR}/../.. .include "${DOC_PREFIX}/share/mk/doc.project.mk" dev-auto.sgml: ${MAN4PAGES} ${ARCHLIST} ${MAN2HWNOTES_CMD} catalog-auto - ${PERL} ${MAN2HWNOTES_CMD} -a ${ARCHLIST} -o ${.TARGET} ${MAN4PAGES} + ${PERL} ${MAN2HWNOTES_CMD} ${MAN2HWNOTES_FLAGS} -a ${ARCHLIST} -o ${.TARGET} ${MAN4PAGES} catalog-auto: ${ECHO_CMD} 'PUBLIC "-//FreeBSD//ENTITIES Auto Generated Device Lists//EN"' \ -- cgit v1.1