diff options
author | wlemb <wlemb> | 2003-04-17 07:41:51 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2003-04-17 07:41:51 +0000 |
commit | 8874e67498a2dca711dee19cd9bdf129888b30f9 (patch) | |
tree | 2528a6fe124ab1f83883834c4ca2aa5adbbb805f /tmac/hyphenex.pl | |
parent | ff9f8c2de0068df79ceef845737031d03b0df26e (diff) | |
download | groff-8874e67498a2dca711dee19cd9bdf129888b30f9.tar.gz |
Add comments.
Remove nested paired braces also.
Diffstat (limited to 'tmac/hyphenex.pl')
-rw-r--r-- | tmac/hyphenex.pl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tmac/hyphenex.pl b/tmac/hyphenex.pl index 493303f2..310f9b06 100644 --- a/tmac/hyphenex.pl +++ b/tmac/hyphenex.pl @@ -8,7 +8,7 @@ # # Written by Werner Lemberg <wl@gnu.org>. # -# Version 1.0 (2003/04/16) +# Version 1.1 (2003/04/17) # # Public domain. # @@ -17,6 +17,7 @@ # # [perl] hyphenex.pl < tugboat-article > hyphenation-exceptions +# print header print "% Hyphenation exceptions for US English,\n"; print "% based on the hyphenation exception log article in TUGBoat.\n"; print "%\n"; @@ -28,37 +29,50 @@ print "\n"; print "\\hyphenation{\n"; while (<>) { + # retain only lines starting with \1 ... \6 or \tabalign next if not (m/^\\[123456]/ || m/^\\tabalign/); + # remove final newline chop; + # remove all TeX commands except \1 ... \6 s/\\[^123456\s{]+//g; - s/{(.*?)}/\1/g; + # remove all paired { ... } + 1 while s/{(.*?)}/\1/g; + # skip lines which now have only whitespace before `&' next if m/^\s*&/; + # remove comments s/%.*//; + # remove trailing whitespace s/\s*$//; + # remove trailing `*' (used as a marker in the document) s/\*$//; + # split at whitespace @field = split(' '); if ($field[0] eq "\\1" || $field[0] eq "\\4") { print " $field[2]\n"; } elsif ($field[0] eq "\\2" || $field[0] eq "\\5") { print " $field[2]\n"; + # handle multiple suffixes separated by commata @suffix_list = split(/,/, "$field[3]"); foreach $suffix (@suffix_list) { print " $field[2]$suffix\n"; } } elsif ($field[0] eq "\\3" || $field[0] eq "\\6") { + # handle multiple suffixes separated by commata @suffix_list = split(/,/, "$field[3],$field[4]"); foreach $suffix (@suffix_list) { print " $field[2]$suffix\n"; } } else { + # for `&', split at `&' with trailing whitespace @field = split(/&\s*/); print " $field[1]\n"; } } +# print trailer print "}\n"; print "\n"; print "% EOF\n"; |