-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·77 lines (58 loc) · 1.9 KB
/
run
File metadata and controls
executable file
·77 lines (58 loc) · 1.9 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
set -eu
cd $(dirname $0)
book_name=$1
work_dir=$(mktemp -d -t obp-gen-xml-XXXXXX)
out_dir="${OUTDIR:-./}"
cleanup () {
local rv=$?
rm -rf -- "$work_dir"
exit $rv
}
trap cleanup EXIT
convert () {
# Run the python script and XSL file of the XML-last repo
cd $work_dir
xref_schema=`python3 src/extract_schema_version.py "$book_name".xml`
echo "running XML-before-transformation.py"
python3 XML-before-transformation.py
echo "running Transform-to-XML-section_tailored.xsl"
python3 src/tailor_xslt.py \
Transform-to-XML-section.template \
Transform-to-XML-section_tailored.xsl \
--version $xref_schema
saxonb-xslt -s:Transform-to-XML-section_tailored.xsl \
-xsl:Transform-to-XML-section_tailored.xsl \
-o:Transform-to-XML-section_tailored.xsl \
-ext:on
echo "running Transform-to-XML-book_tailored.xsl"
python3 src/tailor_xslt.py \
Transform-to-XML-book.template \
Transform-to-XML-book_tailored.xsl \
--version $xref_schema \
--include_file filename_includes
saxonb-xslt -s:Transform-to-XML-book_tailored.xsl \
-xsl:Transform-to-XML-book_tailored.xsl \
-xi:on \
-ext:on
echo "running XML-after-transformation.py"
python3 XML-after-transformation.py
# Create a zip archive of the XML edition
find . -name '*.zip' | while read file; do
filename=$(basename -- ${file%.*})
zip -rq ${filename}.xml.zip XML-edition/
echo "created ./${filename}.xml.zip"
done
}
echo "Copy relevant files to work directory"
cp ${book_name}.epub $work_dir
cp ${book_name}.xml $work_dir
cp -r xslt/. $work_dir
cp -r src/ $work_dir
(convert)
cp $work_dir/${book_name}.xml.zip $out_dir/.
# Validate entire-book.xml and produce a report
#xmllint --schema $work_dir/schemas/tei_simplePrint_OBP_custom.xsd \
# --noout \
# $work_dir/XML-edition/entire-book.xml \
# 2> $out_dir/entire-book.log