summaryrefslogtreecommitdiff
path: root/obsolete/language/thai/thailatex/hyphen/diff-dicts.sh
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-05-03 03:02:51 +0000
committerNorbert Preining <norbert@preining.info>2020-05-03 03:02:51 +0000
commitd78de17ddf0443233483fd98f40802cae5aa87c5 (patch)
tree1b7128cc505808a09c18e158288d6c3cdcf5c2fb /obsolete/language/thai/thailatex/hyphen/diff-dicts.sh
parent8626a9c3cb5dc8d02d779d5b5b1e3933d5626f43 (diff)
CTAN sync 202005030302
Diffstat (limited to 'obsolete/language/thai/thailatex/hyphen/diff-dicts.sh')
-rwxr-xr-xobsolete/language/thai/thailatex/hyphen/diff-dicts.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/obsolete/language/thai/thailatex/hyphen/diff-dicts.sh b/obsolete/language/thai/thailatex/hyphen/diff-dicts.sh
new file mode 100755
index 0000000000..a6490c1364
--- /dev/null
+++ b/obsolete/language/thai/thailatex/hyphen/diff-dicts.sh
@@ -0,0 +1,45 @@
+#/bin/sh
+
+# Compare dictionary with original libthai source
+#
+# It takes libthai dict source dir as the argument, then scans all dicts
+# under that dir and try hyphenating them, and finally compares the
+# results with current source.
+#
+# For each dict, the new source is created as *.new, and the diffs as *.diff.
+#
+# Usage diff-dicts.sh {libthai-dict-src-dir}
+
+if [ $# -ne 1 ]; then
+ echo "Usage: diff-dicts.sh {libthai-dict-src-dir}"
+ exit 1
+fi
+
+DICTS=`echo tdict-*.txt`
+DIR=$1
+
+for d in ${DICTS}; do
+
+ cat > odict.tex << EOT
+\\documentclass{article}
+\\usepackage[thai]{babel}
+\\usepackage[utf8x]{inputenc}
+
+\\begin{document}
+EOT
+
+ sed -e 's/.*/\\showhyphens{&}/' ${DIR}/$d >> odict.tex
+
+ cat >> odict.tex << EOT
+\\end{document}
+EOT
+
+ NEWDICT=$d.new
+ pdflatex odict.tex \
+ | grep '^\[\]' | cut -d' ' -f3 | iconv -f tis-620 -t utf-8 > ${NEWDICT}
+
+ diff -u $d ${NEWDICT} > $d.diff
+
+ rm odict.tex odict.aux odict.log
+done
+