Skip to content

Commit

Permalink
sts to metanorma xml conversion removed, #418
Browse files Browse the repository at this point in the history
  • Loading branch information
Intelligent2013 committed Jan 23, 2025
1 parent e722b47 commit 665d960
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
24 changes: 12 additions & 12 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[source,sh]
----
java -jar mnconvert-1.67.0.jar xml_file --check-type xsd-niso
java -jar mnconvert-1.68.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 @@ -19,7 +19,7 @@ or check any XML against XSD, DTD.

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

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

[source,sh]
----
java -jar mnconvert-1.67.0.jar xml_file [options]
java -jar mnconvert-1.68.0.jar xml_file [options]
----

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

[source,sh]
----
java -jar mnconvert-1.67.0.jar xml_file [options]
java -jar mnconvert-1.68.0.jar xml_file [options]
----

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

[source,sh]
----
java -jar mnconvert-1.67.0.jar xml_file [options]
java -jar mnconvert-1.68.0.jar xml_file [options]
----

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

[source,sh]
----
java -jar mnconvert-1.67.0.jar docx_file [options]
java -jar mnconvert-1.68.0.jar docx_file [options]
----

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

----
java -jar mnconvert-1.67.0.jar xml_file [options]
java -jar mnconvert-1.68.0.jar xml_file [options]
----

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

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

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

[source,sh]
----
java -jar target/mnconvert-1.67.0.jar tests/iso-tc154-8601-1-en.xml --output tests/iso-tc154-8601-1-en.out.xml --output-format ieee
java -jar target/mnconvert-1.68.0.jar tests/iso-tc154-8601-1-en.xml --output tests/iso-tc154-8601-1-en.out.xml --output-format ieee
----

NOTE: Input XML format (Metanorma, STS ISO/NISO, IEEE or XML2RFC) determines programmatically by root element of input file: +
Expand Down Expand Up @@ -150,7 +150,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma</groupId>
<artifactId>mnconvert</artifactId>
<version>1.67.0</version>
<version>1.68.0</version>
<name>Metanorma XML to NISO STS XML two-directional converter</name>
----

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

[source,xml]
----
git tag v1.67.0
git push origin v1.67.0
git tag v1.68.0
git push origin v1.68.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.67.0</version>
<version>1.68.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
30 changes: 15 additions & 15 deletions src/main/java/org/metanorma/STS2MN_XsltConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class STS2MN_XsltConverter extends XsltConverter {

private String typeStandard = ""; // default value empty - allows to determine standard via xslt

private boolean isSemanticXML = false;
//private boolean isSemanticXML = false;

final String SPLIT = "///SPLIT ";

Expand All @@ -71,24 +71,24 @@ public void setTypeStandard(String typeStandard) {
}
}

public void setIsSemanticXML(boolean isSemanticXML) {
/*public void setIsSemanticXML(boolean isSemanticXML) {
this.isSemanticXML = isSemanticXML;
}
}*/


private void setDefaultOutputFilePath() {
if (outputFilePath.isEmpty()) {

String outputFilePathWithoutExtension = super.getDefaultOutputFilePath();

if (outputFormat.equals("xml")) {
/*if (outputFormat.equals("xml")) {
outputFilePath = outputFilePathWithoutExtension + "mn." + outputFormat;
if (isSplitBibdata) { //relaton XML
outputFilePath = getSplitBibdataFilename(outputFilePath, outputFormat);
}
} else { // adoc
outputFilePath = outputFilePathWithoutExtension + outputFormat;
}
} else {*/ // adoc
outputFilePath = outputFilePathWithoutExtension + outputFormat;
//}
}
}

Expand Down Expand Up @@ -119,7 +119,7 @@ public boolean process() {
}
}

if (!outputFormat.equals("adoc") && !outputFormat.equals("xml")) {
if (!outputFormat.equals("adoc")) { // && !outputFormat.equals("xml")
//System.out.println(String.format(UNKNOWN_OUTPUT_FORMAT, outputFormat));
logger.severe(String.format(UNKNOWN_OUTPUT_FORMAT, outputFormat));
return false;
Expand All @@ -135,11 +135,11 @@ public boolean process() {
if (isSplitBibdata) {
String addon_outputFormat = "";
String addon_outputFilePath = "";
if (outputFormat.equals("xml")) {
/*if (outputFormat.equals("xml")) {
addon_outputFormat = "adoc";
} else { // adoc output
addon_outputFormat = "xml";
}
} else { // adoc output*/
addon_outputFormat = "xml";
//}
addon_outputFilePath = getSplitBibdataFilename(outputFilePath, addon_outputFormat);
logger.info(String.format(OUTPUT_LOG_STS2MN, addon_outputFormat.toUpperCase(), addon_outputFilePath));
}
Expand Down Expand Up @@ -176,7 +176,7 @@ private void convertsts2mn() throws IOException, TransformerException, SAXExcept
String outputFolder = fileOut.getAbsoluteFile().getParent();

String bibdataFileName = fileOut.getName();
if (isSplitBibdata && outputFormat.equals("xml")) {
if (isSplitBibdata) { // && outputFormat.equals("xml")
String addon_outputFormat = "adoc";
bibdataFileName = getSplitBibdataFilename(bibdataFileName, addon_outputFormat);
}
Expand Down Expand Up @@ -207,7 +207,7 @@ public InputSource resolveEntity(String publicId, String systemId) throws SAXExc

logger.info("Transforming...");

if (outputFormat.equals("xml") || isSplitBibdata) {
if (isSplitBibdata) { // outputFormat.equals("xml") ||
Source srcXSL;
if (fileXSL != null) { //external xsl
srcXSL = new StreamSource(fileXSL);
Expand All @@ -222,7 +222,7 @@ public InputSource resolveEntity(String publicId, String systemId) throws SAXExc
transformer.setParameter("imagesdir", imagesDir);
transformer.setParameter("outpath", outputFolder);
transformer.setParameter("typestandard", typeStandard);
transformer.setParameter("semantic", isSemanticXML);
//transformer.setParameter("semantic", isSemanticXML);
transformer.setParameter("debug", isDebugMode);

StringWriter resultWriter = new StringWriter();
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/metanorma/mnconvert.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.commons.cli.ParseException;

/**
* This class for the command line application for conversion between Metanorma XML and NISO/ISO STS format XML (STS <-> MN XML, STS -> MN ADOC)
* This class for the command line application for conversion between NISO/ISO STS format XML and Metanorma XML/ADOC (MN XML -> STS , STS -> MN ADOC)
*/
public class mnconvert {

Expand Down Expand Up @@ -129,7 +129,7 @@ public class mnconvert {
.build());
addOption(Option.builder("of")
.longOpt("output-format")
.desc("output format: xml|adoc(default) for Metanorma output, iso|niso(default) for STS output, or ieee for IEEE format output")
.desc("output format: adoc for Metanorma output, iso|niso(default) for STS output, or ieee for IEEE format output")
.hasArg()
.argName("xml|adoc|iso|niso|ieee")
.required(false)
Expand All @@ -151,11 +151,11 @@ public class mnconvert {
.hasArg()
.required(false)
.build());
addOption(Option.builder("sx")
/*addOption(Option.builder("sx")
.longOpt("semantic")
.desc("For STS input only: generate semantic XML (Metanorma XML output only)")
.required(false)
.build());
.build());*/
addOption(Option.builder("ct")
.longOpt("check-type")
.desc("For STS output only: check against XSD NISO (value 'xsd-niso', default), DTD ISO (value 'dtd-iso'), DTD NISO (value 'dtd-niso')")
Expand Down Expand Up @@ -354,7 +354,7 @@ public static void main(String[] args) throws ParseException {
sts2mn.setImagesDir(cmdMain.getOptionValue("imagesdir"));
sts2mn.setIsSplitBibdata(cmdMain.hasOption("split-bibdata"));
sts2mn.setTypeStandard(cmdMain.getOptionValue("type"));
sts2mn.setIsSemanticXML(cmdMain.hasOption("semantic"));
//sts2mn.setIsSemanticXML(cmdMain.hasOption("semantic"));
defaultOutputFormat = "adoc";
converter = sts2mn;
break;
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/metanorma/sts2mnTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void successConvertToRelativeAdocOutputSpecified() throws ParseException
assertTrue(Files.exists(fileout));
}

@Test
/*@Test
public void successConvertToXML() throws ParseException {
assumeNotNull(XMLFILE_MN);
System.out.println(name.getMethodName());
Expand All @@ -165,7 +165,7 @@ public void successConvertToXML() throws ParseException {
mnconvert.main(args);
assertTrue(Files.exists(fileout));
}
}*/

/*@Test
public void successConvertRemoteToXML() throws ParseException {
Expand Down Expand Up @@ -202,7 +202,7 @@ public void successConvertToADOCWithImageLink() throws ParseException {
}
}

@Test
/*@Test
public void successConvertToXMLWithImageLink() throws ParseException {
assumeNotNull(XMLFILE_MN);
System.out.println(name.getMethodName());
Expand All @@ -224,7 +224,7 @@ public void successConvertToXMLWithImageLink() throws ParseException {
assertTrue(Files.exists(fileout));
assertTrue(Files.exists(imageout));
}
}
}*/

@Test
public void successSplitBibData() throws ParseException {
Expand Down

0 comments on commit 665d960

Please sign in to comment.