Skip to content

Commit

Permalink
Merge pull request #63 from openjournals/validate-jats
Browse files Browse the repository at this point in the history
Validate expected JATS output
  • Loading branch information
tarleb authored May 31, 2024
2 parents 18fcdd9 + 58ff688 commit b1d58e7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: JATS validation

on:
push:
paths:
- 'test/expected-paper.jats/paper.jats'
pull_request:
paths:
- 'test/expected-paper.jats/paper.jats'

jobs:
build:
name: Verify expected JATS
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install XML validator
run: |
sudo apt install libxml2-utils
- name: Test image
run: |
make validate-jats
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
/example/paper.jats
/example/paper.crossref
/example/paper.preprint.tex

# JATS schema files
/test/JATS-Publishing-1-2-MathML2-XSD.zip
/test/JATS-journalpublishing1-elements.xsd
/test/JATS-journalpublishing1.xsd
/test/standard-modules
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,23 @@ clean:
rm -rf $(TARGET_FOLDER)/paper.pdf
rm -rf $(TARGET_FOLDER)/paper.preprint
rm -rf $(TARGET_FOLDER)/paper.preprint.tex
rm -rf test/JATS-Publishing-1-2-MathML2-XSD.zip
rm -rf test/JATS-journalpublishing1-elements.xsd
rm -rf test/JATS-journalpublishing1.xsd
rm -rf test/standard-modules
rm -rf /tmp/JATS-Publishing-1-2-MathML2-XSD


## Tests

# Command used to invoke Inara. Sets an environment variable that makes the
# program ignore the real date.
INARA_TEST_CMD = docker run --rm -it \
INARA_TEST_CMD = docker run --rm \
--env SOURCE_DATE_EPOCH=1234567890 \
-v $${PWD}:/data openjournals/inara:latest

.PHONY: test golden-tests test-jats test-%
test: golden-tests
.PHONY: test test-golden test-jats test-%
test: test-golden

test-golden: test-crossref test-jats test-pdf test-preprint

Expand All @@ -91,3 +96,18 @@ test-%:
$(INARA_TEST_CMD) -o $* example/paper.md
diff example/$(GOLDEN_FILE) test/expected-$(GOLDEN_FILE)

NCBI_FTP = "ftp://ftp.ncbi.nih.gov/pub/jats/publishing/1.2/xsd/"
test/JATS-Publishing-1-2-MathML2-XSD.zip:
curl --output $@ \
"$(NCBI_FTP)/JATS-Publishing-1-2-MathML2-XSD.zip"

test/JATS-journalpublishing1.xsd: \
test/JATS-Publishing-1-2-MathML2-XSD.zip
unzip -q -d /tmp $<
cp -a /tmp/JATS-Publishing-1-2-MathML2-XSD/* test
rm -rf /tmp/JATS-Publishing-1-2-MathML2-XSD

.PHONY: validate-jats
validate-jats: test/expected-paper.jats/paper.jats \
test/JATS-journalpublishing1.xsd
xmllint --schema test/JATS-journalpublishing1.xsd $< --noout

0 comments on commit b1d58e7

Please sign in to comment.