summaryrefslogtreecommitdiff
path: root/tmac
diff options
context:
space:
mode:
authorwlemb <wlemb>2003-04-16 23:34:20 +0000
committerwlemb <wlemb>2003-04-16 23:34:20 +0000
commitff9f8c2de0068df79ceef845737031d03b0df26e (patch)
tree7f6d194463c32fef214bd539f7e78e618b7579d4 /tmac
parent69306a6a7377a9dce9faefc1b53998959d399ab4 (diff)
downloadgroff-ff9f8c2de0068df79ceef845737031d03b0df26e.tar.gz
* tmac/hyphenex.sh: Replaced with...
* tmac/hyphenex.pl: This perl script to avoid sed compatibility nightmares.
Diffstat (limited to 'tmac')
-rw-r--r--tmac/hyphenex.pl64
-rw-r--r--tmac/hyphenex.sh88
2 files changed, 64 insertions, 88 deletions
diff --git a/tmac/hyphenex.pl b/tmac/hyphenex.pl
new file mode 100644
index 00000000..493303f2
--- /dev/null
+++ b/tmac/hyphenex.pl
@@ -0,0 +1,64 @@
+#! /usr/bin/perl
+#
+#
+# hyphenex.pl
+#
+# This small filter converts a hyphenation exception log article for
+# TUGBoat to a real \hyphenation block.
+#
+# Written by Werner Lemberg <wl@gnu.org>.
+#
+# Version 1.0 (2003/04/16)
+#
+# Public domain.
+#
+#
+# Usage:
+#
+# [perl] hyphenex.pl < tugboat-article > hyphenation-exceptions
+
+print "% Hyphenation exceptions for US English,\n";
+print "% based on the hyphenation exception log article in TUGBoat.\n";
+print "%\n";
+print "% This is an automatically generated file. Do not edit!\n";
+print "%\n";
+print "% Please contact Barbara Beeton <bnb\@ams.org>\n";
+print "% for corrections and omissions.\n";
+print "\n";
+print "\\hyphenation{\n";
+
+while (<>) {
+ next if not (m/^\\[123456]/ || m/^\\tabalign/);
+ chop;
+ s/\\[^123456\s{]+//g;
+ s/{(.*?)}/\1/g;
+ next if m/^\s*&/;
+ s/%.*//;
+ s/\s*$//;
+ s/\*$//;
+ @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";
+ @suffix_list = split(/,/, "$field[3]");
+ foreach $suffix (@suffix_list) {
+ print " $field[2]$suffix\n";
+ }
+ }
+ elsif ($field[0] eq "\\3" || $field[0] eq "\\6") {
+ @suffix_list = split(/,/, "$field[3],$field[4]");
+ foreach $suffix (@suffix_list) {
+ print " $field[2]$suffix\n";
+ }
+ }
+ else {
+ @field = split(/&\s*/);
+ print " $field[1]\n";
+ }
+}
+
+print "}\n";
+print "\n";
+print "% EOF\n";
diff --git a/tmac/hyphenex.sh b/tmac/hyphenex.sh
deleted file mode 100644
index 89d94fc7..00000000
--- a/tmac/hyphenex.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#! /bin/sh
-#
-#
-# hyphenex.sh
-#
-# This small filter converts a hyphenation exception log article for
-# TUGBoat to a real \hyphenation block.
-#
-# Written by Werner Lemberg <wl@gnu.org>.
-#
-# Version 1.3 (2003/04/15)
-#
-# Public domain.
-#
-#
-# Usage:
-#
-# sh hyphenex.sh < tugboat-article > hyphenation-exceptions
-
-cat >/tmp/sed.$$ <<SED_EOF
-1 i\\
-% Hyphenation exceptions for US English, based on the hyphenation exception\\
-% log article in TUGBoat.\\
-%\\
-% This is an automatically generated file. Do not edit!\\
-%\\
-% Please contact Barbara Beeton <bnb@ams.org> for corrections and omissions.\\
-\\
-\\\\hyphenation{
-\$ i\\
-}\\
-\\
-% EOF
-/^\\\\tabalign/ {
- s/{}//g
- s/[ ][ ]*/ /g
- s/ *\\\\[^ ][^ ]*\$//
- s/\\\\tabalign *[^ ][^ ]*.*& *\\(.*\\)\$/ \\1/p
- b
-}
-/^\\\\[123456]/ !d
-s/\\\\4/\\\\1/
-s/\\\\5/\\\\2/
-s/\\\\6/\\\\3/
-s/[ ][ ]*/ /g
-s/^/ /
-s/\\\\1 [^ ][^ ]* {\\(.*\\)}\$/\\1/
-s/\\\\2 [^ ][^ ]* {\\(.*\\) \\(.*\\),\\(.*\\),\\(.*\\)}\$/\\1\\n \\1\\2\\n \\1\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