From a2643aec47a253d5ad30d0c18823b8b2bced3cdf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 10 Dec 2007 18:23:42 +0000 Subject: hyphenex in texmf-dist git-svn-id: svn://tug.org/texlive/trunk@5750 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/hyphenex/README | 2 + .../texmf-dist/source/generic/hyphenex/hyphenex.pl | 81 +++++++++++++++++++ .../texmf-dist/source/generic/hyphenex/hyphenex.sh | 92 ++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 Master/texmf-dist/source/generic/hyphenex/README create mode 100644 Master/texmf-dist/source/generic/hyphenex/hyphenex.pl create mode 100644 Master/texmf-dist/source/generic/hyphenex/hyphenex.sh (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/generic/hyphenex/README b/Master/texmf-dist/source/generic/hyphenex/README new file mode 100644 index 00000000000..015cdd20203 --- /dev/null +++ b/Master/texmf-dist/source/generic/hyphenex/README @@ -0,0 +1,2 @@ +Scripts to generate hyphenation exceptions from tub, written +by Werner Lemberg. This material is public domain. \ No newline at end of file diff --git a/Master/texmf-dist/source/generic/hyphenex/hyphenex.pl b/Master/texmf-dist/source/generic/hyphenex/hyphenex.pl new file mode 100644 index 00000000000..7cc546634f7 --- /dev/null +++ b/Master/texmf-dist/source/generic/hyphenex/hyphenex.pl @@ -0,0 +1,81 @@ +#! /usr/bin/env perl +# +# +# hyphenex.pl +# +# This small filter converts a hyphenation exception log article for +# TUGBoat to a real \hyphenation block. +# +# Written by Werner Lemberg . +# +# Version 1.2 (2007/11/16) +# +# Public domain. +# +# +# Usage: +# +# [perl] hyphenex.pl < tugboat-article > hyphenation-exceptions + +# print header +print "% Hyphenation exceptions for US English,\n"; +print "% based on hyphenation exception log articles in TUGboat.\n"; +print "%\n"; +print "% Copyright 2007 TeX Users Group.\n"; +print "% You may freely use, modify and/or distribute this file.\n"; +print "%\n"; +print "% This is an automatically generated file. Do not edit!\n"; +print "%\n"; +print "% Please contact the TUGboat editorial staff \n"; +print "% for corrections and omissions.\n"; +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; + # 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"; diff --git a/Master/texmf-dist/source/generic/hyphenex/hyphenex.sh b/Master/texmf-dist/source/generic/hyphenex/hyphenex.sh new file mode 100644 index 00000000000..14bd729b985 --- /dev/null +++ b/Master/texmf-dist/source/generic/hyphenex/hyphenex.sh @@ -0,0 +1,92 @@ +#! /bin/sh +# +# +# hyphenex.sh +# +# This small filter converts a hyphenation exception log article for +# TUGBoat to a real \hyphenation block. +# +# Written by Werner Lemberg . +# +# Version 1.4 (2007/11/16) +# +# Public domain. +# +# +# Usage: +# +# sh hyphenex.sh < tugboat-article > hyphenation-exceptions + +cat >/tmp/sed.$$ <\\ +% for corrections and omissions.\\ +\\ +\\\\hyphenation{ +\$ i\\ +}\\ +\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