-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathodt2tei.sh
More file actions
53 lines (44 loc) · 954 Bytes
/
odt2tei.sh
File metadata and controls
53 lines (44 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Transform OpenOffice.odt in tei.xml
# Required unzip and xsltproc
here=`dirname $0`
# pass an odt filepath
# 1) unzip odt
# 2) merge some files (especially to get the metas)
# 3) xml normalization on odt.xml
# 4) the beef, transform odt xml in tei
# 5) normalize tei
# 6) Your step ? ex : | xsltproc tei_philo3.xsl -\
odt_tei() {
if [ -z $1 ]
then
echo " ERROR: odt_tei() an odt filepath is needed"
return 1
fi
#name=$(basename "$1");
basepath=${1%.*}
echo $1 \> $basepath.xml
unzip -p $1 meta.xml styles.xml content.xml \
| sed -E -f $here/odtx.sed \
| sed '/^$/d' \
| xsltproc $here/odt_tei.xsl -\
| sed -E -f $here/tei.sed \
> $basepath.xml
return 0
}
usage() {
echo "USAGE: "
echo " ./odt_tei.sh path/to/file.odt"
exit 0
}
if [ "$#" -eq 0 ]
then
usage
fi
# process script arguments
for f in $*
do
#will echo all the variable passes as parameters
odt_tei $f
done
exit $?