-
-
Save strn/f5c6d9c5242fdc9c49d09f21ecad1ffa to your computer and use it in GitHub Desktop.
Convert TeX hyphenation file to KOreader form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INFILE="$1" | |
cat <<EOF | |
<?xml version="1.0" encoding="utf8"?> | |
<!-- | |
Taken and converted from: | |
--> | |
<HyphenationDescription> | |
EOF | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
# Skip comments and other TeX constructs | |
if [[ "${line}" =~ }.*|\\.*|%.* ]]; then | |
continue | |
fi | |
lnew=$(echo ${line} | sed -e 's#\.# #g;s#\-#5#g') | |
echo " <pattern>${lnew}</pattern>" | |
done < "${INFILE}" | |
echo "</HyphenationDescription>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment