diff options
author | Bruce A. Mah <bmah@FreeBSD.org> | 2007-02-16 02:10:12 +0000 |
---|---|---|
committer | Bruce A. Mah <bmah@FreeBSD.org> | 2007-02-16 02:10:12 +0000 |
commit | aebd3138602f6720eef5dd6298b6939ea02494d5 (patch) | |
tree | e01b734c47dfd4d6779f06e7ec4559e2faaa651d /release/doc/share/misc | |
parent | 9be403be00c81822eb3bcb90f1752a42f56783db (diff) | |
download | src-aebd3138602f6720eef5dd6298b6939ea02494d5.tar.gz src-aebd3138602f6720eef5dd6298b6939ea02494d5.zip |
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
Notes
Notes:
svn path=/head/; revision=166778
Diffstat (limited to 'release/doc/share/misc')
-rw-r--r-- | release/doc/share/misc/man2hwnotes.pl | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/release/doc/share/misc/man2hwnotes.pl b/release/doc/share/misc/man2hwnotes.pl index c355ac956f74..75b1af2072fd 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 <archlist file>] [-o <outputfile>] +# man2hwnotes.pl [-cl] [-d 0-6] [-a <archlist file>] [-o <outputfile>] # <manualpage> [<manualpage> ...] 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 = "<para".$para_arch.">&".$entity_name.";</para>"; + } else { + $out = "<para>".$para_arch."&".$entity_name.";</para>"; } - $out = "<para".$para_arch.">&".$entity_name.";</para>"; 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 = "<listitem><para>&".$entity_name.";</para></listitem>"; } $listitem = "<listitem><para".$para_arch.">&".$entity_name.";</para></listitem>"; dlog(4, "Adding '$listitem' to out_dev"); |