Debian Codegraph @

texmf-dist/source/generic/hyphenex/hyphenex.sh

raw
1 #! /bin/sh
2 #
3 # hyphenex.sh
4 #
5 # This small filter converts a hyphenation exception log article for
6 # TUGBoat to a real \hyphenation block.
7 #
8 # Written by Werner Lemberg <[email protected]>.
9 #
10 # Version 1.5 (2008/05/20)
11 #
12 # Public domain.
13 #
14 #
15 # Usage:
16 # sh hyphenex.sh < tugboat-article > hyphenation-exceptions
17
18 cat >/tmp/sed.$$ <<SED_EOF
19 1 i\\
20 % Hyphenation exceptions for US English,\\
21 % based on hyphenation exception log articles in TUGboat.\\
22 %\\
23 % Copyright 2021 TeX Users Group.\\
24 % You may freely use, modify and/or distribute this file.\\
25 %\\
26 % This is an automatically generated file. Do not edit!\\
27 %\\
28 % Please contact the TUGboat editorial staff <[email protected]>\\
29 % for corrections and omissions.\\
30 \\
31 \\\\hyphenation{
32 \$ i\\
33 }\\
34 \\
35 % EOF
36 /^\\\\tabalign/ {
37 s/{}//g
38 s/[ ][ ]*/ /g
39 s/ *\\\\[^ ][^ ]*\$//
40 s/\\\\tabalign *[^ ][^ ]*.*& *\\(.*\\)\$/ \\1/p
41 b
42 }
43 /^\\\\[123456]/ !d
44 s/\\\\4/\\\\1/
45 s/\\\\5/\\\\2/
46 s/\\\\6/\\\\3/
47 s/[ ][ ]*/ /g
48 s/^/ /
49 s/\\\\1 [^ ][^ ]* {\\(.*\\)}\$/\\1/
50 s/\\\\2 [^ ][^ ]* {\\(.*\\) \\(.*\\),\\(.*\\),\\(.*\\)}\$/\\1\\n \\1\\2\\n \\1\\3\\n \\1\\4/
51 s/\\\\2 [^ ][^ ]* {\\(.*\\) \\(.*\\),\\(.*\\)}\$/\\1\\n \\1\\2\\n \\1\\3/
52 s/\\\\2 [^ ][^ ]* {\\(.*\\) \\(.*\\)}\$/\\1\\n \\1\\2/
53 s/\\\\3 [^ ][^ ]* {\\(.*\\) \\(.*\\) \\(.*\\)}\$/\\1\\2\\n \\1\\3/
54 s/\\\\1 [^ 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