diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce60760c..f8567ebc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,6 +53,8 @@ jobs: - run: make mn2stsDTD_NISO + - run: make NISO-STS-Standard + # - run: make mn2stsDTD_ISO - run: make publish diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ec91c87..4eae2429 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/Makefile b/Makefile index 699562f0..535d31f3 100644 --- a/Makefile +++ b/Makefile @@ -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)) @@ -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" \ diff --git a/README.adoc b/README.adoc index 8b786e8f..7b9ba8ef 100644 --- a/README.adoc +++ b/README.adoc @@ -1,12 +1,5 @@ = 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 @@ -14,7 +7,7 @@ You will need the `maven` build tool and `make`. [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) @@ -26,7 +19,7 @@ or check any XML against XSD, DTD. [source,sh] ---- -java -jar mnconvert-1.44.0.jar xml_file --validation-against +java -jar mnconvert-1.60.0.jar xml_file --validation-against ---- - `--validation-against`, `-va` - Check against specified DTD ot XSD @@ -37,7 +30,7 @@ java -jar mnconvert-1.44.0.jar xml_file --validation-against [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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 +java -jar mnconvert-1.60.0.jar xml_file --output-format ieee --validation-against ---- - `--xsl-file`, `-s` - path to XSL file, optional @@ -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: + @@ -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 @@ -151,7 +150,7 @@ Update version in `pom.xml`, e.g.: ---- org.metanorma mnconvert -1.59.0 +1.60.0 Metanorma XML to NISO STS XML two-directional converter ---- @@ -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: diff --git a/pom.xml b/pom.xml index 8301aa8f..e0137e8f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.metanorma mnconvert - 1.59.0 + 1.60.0 Metanorma XML to NISO STS XML two-directional, IEEE to Metanorma ADOC, Metanorma XML to IEEE XML, and XML2RFC to Metanorma Asciidoc IETF converter jar https://www.metanorma.org diff --git a/src/main/resources/sts2mn.adoc.xsl b/src/main/resources/sts2mn.adoc.xsl index 9f3ae922..669e9f30 100644 --- a/src/main/resources/sts2mn.adoc.xsl +++ b/src/main/resources/sts2mn.adoc.xsl @@ -43,6 +43,7 @@ en-preface.adoc 00-foreword.adoc 00-introduction.adoc + 99-bibliography.adoc metanorma.yml @@ -63,12 +64,11 @@ - - PAS BSI + NISO @@ -144,19 +144,27 @@ + + + + + + + + @@ -573,8 +581,10 @@ - - + + + + @@ -598,8 +608,24 @@ + + + + /00-meta-notes. + + + + + + + + include::[] + + + + - + @@ -718,8 +744,17 @@ + + + + + + @@ -767,7 +802,11 @@ - + + + language + + :language: en @@ -870,6 +909,12 @@ + + + + + + @@ -953,6 +998,9 @@ + + + @@ -1003,6 +1051,13 @@ + + + + + + + @@ -1055,9 +1110,9 @@ - - - + + + @@ -1084,8 +1139,12 @@ - :docnumber: - + + docnumber + + + + @@ -1094,6 +1153,25 @@ + + + + publisher + + + + + + + pub-address + + + + + + + + @@ -1164,13 +1242,15 @@ + + + + + + + - - - - - - + @@ -1197,10 +1277,18 @@ - - - + + + + + + + + + + + + @@ -1239,7 +1327,10 @@ - + + + + :-: @@ -1248,13 +1339,16 @@ - + + + + - + @@ -1270,7 +1364,11 @@ - + + + true + + @@ -1283,24 +1381,43 @@ </xsl:template> + <!-- for BSI, PAS --> <xsl:template match="title-wrap/intro" mode="bibdata"> - <title language="{../@xml:lang}" format="text/plain" type="title-intro"> + <title format="text/plain" type="title-intro"> <!-- language="{../@xml:lang}" --> + <xsl:attribute name="language"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:attribute> <xsl:apply-templates mode="bibdata"/> + - + <title format="text/plain" type="title-main"> <!-- language="{../@xml:lang}" --> + <xsl:attribute name="language"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:attribute> <xsl:apply-templates mode="bibdata"/> + - + <title format="text/plain" type="title-part"> <!-- language="{../@xml:lang}" --> + <xsl:attribute name="language"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:attribute> <xsl:apply-templates mode="bibdata"/> + @@ -1344,6 +1461,16 @@ + + + :title-main- + + + : + -- + + + :title-part-: @@ -1489,8 +1616,10 @@ - :isbn: - + + isbn + + @@ -1570,6 +1699,18 @@ + + + semantic-metadata-license + + + + + + + + + :semantic-metadata-xplore-article-id: @@ -1609,13 +1750,38 @@ - :isbn-pdf: - + + isbn-pdf + + + + + + + isbn + + - :isbn-print: - + + isbn-print + + + + + + + semantic-metadata-isbn-html + + + + + + + semantic-metadata-issn + + @@ -1667,7 +1833,7 @@ - + @@ -1685,7 +1851,7 @@ - + @@ -1712,6 +1878,23 @@ + + + semantic-metadata-accrediting-organization + + + + + + + authorizer + + + , + + + + @@ -1963,6 +2146,20 @@ + + [.preface + ,type= + ] + + + == {blank} + + + + + + + @@ -2060,7 +2257,13 @@ - + + + 1 + + + + @@ -2068,7 +2271,7 @@ - include::/01-scope.adoc[] + include::[] @@ -2087,7 +2290,13 @@ - + + + 2 + + + + [bibliography] @@ -2096,7 +2305,7 @@ - include::/02-normrefs.adoc[] + include::[] @@ -2134,7 +2343,7 @@ - + @@ -2149,6 +2358,10 @@ + + [heading=terms and definitions,keeptitle=true] + + @@ -2247,44 +2460,63 @@ - - - - - - - - - - - - - - - - - + - + + - + + + + + [bibliography] + - include::/-.adoc[] + include::[] + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3096,8 +3328,18 @@ + + + + + - + + + docidentifier + + + + @@ -3642,7 +3885,12 @@ - [] + + + + [] + + @@ -4878,9 +5126,9 @@ ^(PAS(\s|\h)) BSI $1 - + - + [bibliography] @@ -5055,15 +5303,15 @@ - include::/99-bibliography.adoc[] + include::[] - - + + @@ -5134,10 +5382,14 @@ false false - false + + + false + false + + - - + + docid:: id::: @@ -5332,7 +5584,12 @@ - WARNING: Repeated reference - + + + + WARNING: Repeated reference - + + @@ -5983,6 +6240,29 @@ + + + + + + + + + -1 + + + + + + + + + + + + + + + @@ -6042,66 +6322,70 @@ - - - - - - - - - - - + - - - - - - - + + - - - - - - + + + - + - - - - - - - - noref,noital - - - - - - - - + + + + + + + + + + + + + + + + + + + + noref,noital + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - + span:[] @@ -6513,7 +6797,11 @@ - + + + + + ]] diff --git a/src/main/resources/sts2mn.common.xsl b/src/main/resources/sts2mn.common.xsl index 10c046f7..588879da 100644 --- a/src/main/resources/sts2mn.common.xsl +++ b/src/main/resources/sts2mn.common.xsl @@ -11,6 +11,8 @@ extension-element-prefixes="redirect" version="1.0"> + + @@ -1556,5 +1558,47 @@ + + + + + + + + + + + en + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/sts2mn.xsl b/src/main/resources/sts2mn.xsl index 0a45ce10..5b4fef30 100644 --- a/src/main/resources/sts2mn.xsl +++ b/src/main/resources/sts2mn.xsl @@ -47,8 +47,6 @@ - - @@ -239,7 +237,7 @@ - + true @@ -277,7 +275,7 @@ - + @@ -287,7 +285,7 @@

- +

@@ -303,10 +301,10 @@ --> - + - + @@ -332,6 +330,9 @@ + + + @@ -365,10 +366,14 @@ - + + + + + @@ -387,6 +392,10 @@ + + + + @@ -396,6 +405,8 @@ + + @@ -584,38 +595,43 @@ - - + iso-meta/std-ident | nat-meta/std-ident | reg-meta/std-ident | std-meta/std-ident | std-doc-meta/std-ident | + iso-meta/permissions | nat-meta/permissions | reg-meta/permissions | std-meta/permissions | std-doc-meta/permissions" mode="bibdata_check"> @@ -739,7 +780,7 @@ - + @@ -808,7 +853,11 @@ - + + + true + + @@ -830,31 +879,51 @@ </xsl:template> <xsl:template match="title-wrap/full" mode="bibdata"> - <title language="{../@xml:lang}" format="text/plain" type="main"> + <xsl:variable name="lang"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <title language="{$lang}" format="text/plain" type="main"> <xsl:apply-templates mode="bibdata"/> - - + <xsl:template match="title-wrap//intro" mode="bibdata"> + <xsl:variable name="lang"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <title language="{$lang}" format="text/plain" type="title-intro"> <xsl:apply-templates mode="bibdata"/> - - + <xsl:template match="title-wrap//main" mode="bibdata"> + <xsl:variable name="lang"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <title language="{$lang}" format="text/plain" type="title-main"> <xsl:apply-templates mode="bibdata"/> - - + <xsl:template match="title-wrap//compl" mode="bibdata"> + <xsl:variable name="lang"> + <xsl:call-template name="getLang"> + <xsl:with-param name="fromParent">true</xsl:with-param> + </xsl:call-template> + </xsl:variable> + <title language="{$lang}" format="text/plain" type="title-part"> <xsl:apply-templates mode="bibdata"/> - + @@ -862,7 +931,7 @@ - + @@ -891,6 +960,10 @@ + + + + @@ -905,6 +978,9 @@ + + + @@ -979,29 +1055,52 @@ - + + + + + + + + + + + + + - + - + + - + + + issued + - + + + + + + + + @@ -1021,7 +1120,7 @@ - + @@ -1038,20 +1137,62 @@ - + false - + + + + + + author + author + + + + + + +

+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + - + @@ -1070,7 +1211,7 @@ - + @@ -1089,7 +1230,13 @@
- + + + + + + + @@ -1172,7 +1319,7 @@ - + @@ -1190,26 +1337,26 @@ - + - + - + - + @@ -1235,7 +1382,7 @@ - + @@ -1258,7 +1405,7 @@ - + @@ -1297,13 +1444,13 @@ - + - + @@ -1311,7 +1458,7 @@ - + @@ -1407,6 +1554,11 @@ + + + + + @@ -1766,6 +1918,39 @@ + + + + + + + term- + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2599,7 +2784,12 @@ false false - false + + + false + false + +
@@ -2787,17 +2977,7 @@ - - - - - - - - - - - + @@ -2809,13 +2989,20 @@ - - - - - - - + + + + + + + + + + + + + + diff --git a/src/test/java/org/metanorma/sts2mnTests.java b/src/test/java/org/metanorma/sts2mnTests.java index 4441a909..4fe35001 100644 --- a/src/test/java/org/metanorma/sts2mnTests.java +++ b/src/test/java/org/metanorma/sts2mnTests.java @@ -121,6 +121,18 @@ public void successConvertToAdocOutputSpecified() throws ParseException { assertTrue(Files.exists(fileout)); } + /*@Test + public void successConvertRemoteToAdocOutputSpecified() throws ParseException { + System.out.println(name.getMethodName()); + Path fileout = Paths.get(System.getProperty("buildDirectory"),"NISO-STS-Standard-1-0", "NISO-STS-Standard-1-0.adoc"); + fileout.toFile().delete(); + String remoteXML = "https://www.niso-sts.org/downloadables/samples/NISO-STS-Standard-1-0.XML"; + String[] args = new String[]{"--output-format", "adoc", "--output", fileout.toAbsolutePath().toString(), remoteXML}; + mnconvert.main(args); + + assertTrue(Files.exists(fileout)); + }*/ + @Test public void successConvertToRelativeAdocOutputSpecified() throws ParseException { assumeNotNull(XMLFILE_MN); @@ -154,7 +166,19 @@ public void successConvertToXML() throws ParseException { assertTrue(Files.exists(fileout)); } - + + /*@Test + public void successConvertRemoteToXML() throws ParseException { + System.out.println(name.getMethodName()); + Path fileout = Paths.get(System.getProperty("buildDirectory"), "NISO-STS-Standard-1-0.mn.xml"); + fileout.toFile().delete(); + String remoteXML = "https://www.niso-sts.org/downloadables/samples/NISO-STS-Standard-1-0.XML"; + fileout.toFile().delete(); + String[] args = new String[]{"--output-format", "xml", "--output", fileout.toAbsolutePath().toString(), remoteXML}; + mnconvert.main(args); + assertTrue(Files.exists(fileout)); + }*/ + @Test public void successConvertToADOCWithImageLink() throws ParseException { assumeNotNull(XMLFILE_MN);