diff options
author | Norbert Preining <norbert@preining.info> | 2021-09-18 03:00:49 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-09-18 03:00:49 +0000 |
commit | fb07ccd098248248795fb851a3a6479ecafaaa47 (patch) | |
tree | e71e612d8d6e10042e2186172639dd7f8228f9c9 /support/latex2nemeth/contrib/nemeth2odt | |
parent | aefe346b16163823efeac108a7da42e91e53e5c7 (diff) |
CTAN sync 202109180300
Diffstat (limited to 'support/latex2nemeth/contrib/nemeth2odt')
-rw-r--r-- | support/latex2nemeth/contrib/nemeth2odt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/support/latex2nemeth/contrib/nemeth2odt b/support/latex2nemeth/contrib/nemeth2odt new file mode 100644 index 0000000000..9777f9322f --- /dev/null +++ b/support/latex2nemeth/contrib/nemeth2odt @@ -0,0 +1,30 @@ +#!/bin/bash +#get a random name first of 8 chars +tmpdir=`cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8` + +#make a folder +mkdir $tmpdir + +#get the base name of the fole to convert +file=`basename "$1" .nemeth` + +#convert nemeth from utf16 to utf8 +iconv -f utf-16 -t utf-8 "$1" > $file.txt + +#convert txt file to odt +libreoffice --headless --convert-to odt $file.txt 1>/dev/null + +# odt is setup with a bultintemplate for convertions +#from text, that uses Liberation Mono font. +#we need DejaVu Serif. We change the font and repack +#the odt file +unzip -qq -d $tmpdir $file.odt +rm -f $file.odt +find $tmpdir -type f | xargs sed -i 's/Liberation Mono/DejaVu Serif/g' +( cd $tmpdir; zip -qq -r ../$file.odt . ) + +#cleanup +/bin/rm -rf $tmpdir $file.txt + + + |