git.iko.soy/typeable/pandoc
on master help sign in
CI: validate JATS table output
commit56f607b50b1bdff6762f46160c99615535f20abd authorAlbert Krewinkel <albert@zeitkraut.de> dateWed 18 Nov 2020, 17:31 (6 years ago) parent0306eec
1 file changed+30−6
.github/workflows/format-validation.yml+30−6
.github/workflows/format-validation.yml+30−6
@@ -9,6 +9,7 @@ on:
99 - 'test/writer.jats_articleauthoring'
1010 - 'test/writer.jats_publishing'
1111 - 'test/writer.jats_archiving'
12+ - 'test/tables.jats_archiving'
1213 pull_request:
1314 branches:
1415 - '*'
@@ -17,6 +18,7 @@ on:
1718 - 'test/writer.jats_articleauthoring'
1819 - 'test/writer.jats_publishing'
1920 - 'test/writer.jats_archiving'
21+ - 'test/tables.jats_archiving'
2022
2123jobs:
2224 jats:
@@ -31,19 +33,16 @@ jobs:
3133 - articleauthoring
3234 - publishing
3335 - archiving
34− file:
35− - writer
36− # tables are not supported yet, the files contain only snippets.
3736 steps:
3837 - name: Checkout
3938 uses: actions/checkout@v2
4039
41− - name: Validate
40+ - name: Validate writer output
4241 run: |
43− filename=test/${{ matrix.file }}.jats_${{ matrix.tagset }}
42+ filename=test/writer.jats_${{ matrix.tagset }}
4443 printf "Validating file %s\n" "$filename"
4544 json="$(curl --form "xml=@${filename}" --silent "$VALIDATOR_URL")"
46− err_count="$(echo "$json" | jq '.errors | length')"
45+ err_count="$(printf '%s' "$json" | jq '.errors | length')"
4746 if [ "$err_count" -eq 0 ]; then
4847 printf "File was validated successfully.\n"
4948 exit 0
@@ -51,3 +50,28 @@ jobs:
5150 printf "Validator report:\n%s" "$json"
5251 exit 1
5352 fi
53+
54+ - name: Validate tables
55+ # Archiving has the simplest template, so we only check with that.
56+ if: matrix.tagset == 'archiving'
57+ run: |
58+ tmpl="$(cat <<EOF
59+ <?xml version="1.0" encoding="utf-8" ?>
60+ <!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.2 20190208//EN"
61+ "JATS-archivearticle1.dtd">
62+ <article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
63+ <front><article-meta></article-meta></front>
64+ <body>%s</body></article>
65+ EOF
66+ )"
67+ jats_file="$(mktemp jats-tables.XXXXX)"
68+ printf "$tmpl" "$(cat test/tables.jats_archiving)" > "$jats_file"
69+ json="$(curl --form "xml=@${jats_file}" --silent "$VALIDATOR_URL")"
70+ err_count="$(printf "%s" "$json" | jq '.errors | length')"
71+ if [ "$err_count" -eq 0 ]; then
72+ printf "Table output is valid when used as body content.\n"
73+ exit 0
74+ else
75+ printf "Validator report:\n%s" "$json"
76+ exit 1
77+ fi