Skip to content

Commit

Permalink
Merge pull request #408 from metanorma/niso_sample
Browse files Browse the repository at this point in the history
official NISO STS XML sample conversion added to Makefile, #407
  • Loading branch information
Intelligent2013 committed Apr 18, 2024
2 parents 2a0cd49 + 7a7af65 commit 51b60ea
Show file tree
Hide file tree
Showing 9 changed files with 772 additions and 215 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:

- run: make mn2stsDTD_NISO

- run: make NISO-STS-Standard

# - run: make mn2stsDTD_ISO

- run: make publish
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ jobs:

- run: make testMN2IEEE

- run: make NISO-STS-Standard

- if: matrix.os == 'ubuntu-latest'
name: Notify mn-samples-bsi
uses: peter-evans/repository-dispatch@v1
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ SRCFILESTS := $(SRCDIR)/rice-en.final.sts.xml
SRCRFCDIR := rfcsources
SRCRFCMASK := rfc865*.xml

SRCNISODIR := nisosource
NISO_STANDARD_URL = https://www.niso-sts.org/downloadables/samples/NISO-STS-Standard-1-0.XML

DESTDIR := documents
DESTSTSXML := $(patsubst %.mn.xml,%.sts.xml,$(patsubst src/test/resources/%,documents/%,$(SRCFILE)))
DESTSTSHTML := $(patsubst %.xml,%.html,$(DESTSTSXML))
Expand Down Expand Up @@ -105,6 +108,14 @@ rfcsources:
saxon.jar:
curl -sSL $(SAXON_URL) -o $@


NISO-STS-Standard: target/$(JAR_FILE) nisosource documents
for f in $(SRCNISODIR)/*.XML; do java -jar target/$(JAR_FILE) $$f --output $(DESTDIR)/$@.adoc ; done

nisosource:
curl -sSLk --create-dirs -O --output-dir $(SRCNISODIR) $(NISO_STANDARD_URL)


documents.rxl: $(DESTSTSHTML) | bundle
bundle exec relaton concatenate \
-t "mnconvert samples" \
Expand Down
37 changes: 18 additions & 19 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
= Metanorma mnconvert

== Installing Build Tools

You will need the `maven` build tool and `make`.

* https://www.baeldung.com/install-maven-on-windows-linux-mac[How to install Maven on Windows, Linux, Mac]


== Usage


=== 1. Check ISO/NISO STS XML against XSD, DTD.

[source,sh]
----
java -jar mnconvert-1.59.0.jar xml_file --check-type xsd-niso
java -jar mnconvert-1.60.0.jar xml_file --check-type xsd-niso
----

- `--check-type`, `-ct` - Check against XSD NISO (value xsd-niso), DTD ISO (dtd-iso), DTD NISO (dtd-niso)
Expand All @@ -26,7 +19,7 @@ or check any XML against XSD, DTD.

[source,sh]
----
java -jar mnconvert-1.44.0.jar xml_file --validation-against <path DTD or XSD>
java -jar mnconvert-1.60.0.jar xml_file --validation-against <path DTD or XSD>
----

- `--validation-against`, `-va` - Check against specified DTD ot XSD
Expand All @@ -37,7 +30,7 @@ java -jar mnconvert-1.44.0.jar xml_file --validation-against <path DTD or XSD>

[source,sh]
----
java -jar mnconvert-1.59.0.jar xml_file [options]
java -jar mnconvert-1.60.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -52,7 +45,7 @@ java -jar mnconvert-1.59.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.59.0.jar xml_file [options]
java -jar mnconvert-1.60.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -67,7 +60,7 @@ java -jar mnconvert-1.59.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.59.0.jar xml_file [options]
java -jar mnconvert-1.60.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -78,7 +71,7 @@ java -jar mnconvert-1.59.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.59.0.jar docx_file [options]
java -jar mnconvert-1.60.0.jar docx_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -88,7 +81,7 @@ java -jar mnconvert-1.59.0.jar docx_file [options]
=== 6. Convert from IEEE STL XML to Metanorma AsciiDoc.

----
java -jar mnconvert-1.59.0.jar xml_file [options]
java -jar mnconvert-1.60.0.jar xml_file [options]
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -100,7 +93,7 @@ java -jar mnconvert-1.59.0.jar xml_file [options]

[source,sh]
----
java -jar mnconvert-1.59.0.jar xml_file --output-format ieee --validation-against <path to IEEE DTD>
java -jar mnconvert-1.60.0.jar xml_file --output-format ieee --validation-against <path to IEEE DTD>
----

- `--xsl-file`, `-s` - path to XSL file, optional
Expand All @@ -118,7 +111,7 @@ e.g.

[source,sh]
----
java -jar target/mnconvert-1.59.0.jar tests/iso-tc154-8601-1-en.xml --output tests/iso-tc154-8601-1-en.out.xml
java -jar target/mnconvert-1.60.0.jar tests/iso-tc154-8601-1-en.xml --output tests/iso-tc154-8601-1-en.out.xml
----

NOTE: Input XML format (Metanorma, STS ISO/NISO, IEEE or XML2RFC) determines programmatically by root element of input file: +
Expand All @@ -134,6 +127,12 @@ NOTE: Output format (Metanorma or STS) determines programmatically by root eleme
- Metanorma for input XML2RFC


== Installing Build Tools

You will need the `maven` build tool and `make`.

* https://www.baeldung.com/install-maven-on-windows-linux-mac[How to install Maven on Windows, Linux, Mac]


== Building the package

Expand All @@ -151,7 +150,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma</groupId>
<artifactId>mnconvert</artifactId>
<version>1.59.0</version>
<version>1.60.0</version>
<name>Metanorma XML to NISO STS XML two-directional converter</name>
----

Expand All @@ -162,8 +161,8 @@ Tag the same version in Git:

[source,xml]
----
git tag v1.59.0
git push origin v1.59.0
git tag v1.60.0
git push origin v1.60.0
----

Then the corresponding GitHub release will be automatically created at:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metanorma</groupId>
<artifactId>mnconvert</artifactId>
<version>1.59.0</version>
<version>1.60.0</version>
<name>Metanorma XML to NISO STS XML two-directional, IEEE to Metanorma ADOC, Metanorma XML to IEEE XML, and XML2RFC to Metanorma Asciidoc IETF converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
Loading

0 comments on commit 51b60ea

Please sign in to comment.