Skip to content

Commit

Permalink
Merge pull request #74 from metanorma/issue/72
Browse files Browse the repository at this point in the history
Issue/72
  • Loading branch information
Intelligent2013 authored Oct 7, 2023
2 parents 5965ad8 + 0c1cdd8 commit 1759691
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 34 deletions.
46 changes: 23 additions & 23 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ You will need the `maven` build tool and `make`.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <XML-FileName>
java -Xss5m -jar target/stepmod2mn-1.18.jar <XML-FileName>
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar data/resource_docs/draughting_elements/resource.xml
java -Xss5m -jar target/stepmod2mn-1.18.jar data/resource_docs/draughting_elements/resource.xml
----

NOTE: resulted AsciiDoc found in data/resource_docs/draughting_elements/document.adoc
Expand All @@ -34,28 +34,28 @@ NOTE: resulted AsciiDoc found in data/resource_docs/draughting_elements/document

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <XML-FileName> [--output <AsciiDoc-FileName>]
java -Xss5m -jar target/stepmod2mn-1.18.jar <XML-FileName> [--output <AsciiDoc-FileName>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar data/resource_docs/draughting_elements/resource.xml --output result_dir/draughting_elements/document.adoc
java -Xss5m -jar target/stepmod2mn-1.18.jar data/resource_docs/draughting_elements/resource.xml --output result_dir/draughting_elements/document.adoc
----

=== Convert all resource.xml and module.xml in the specified folder and sub-folders into the Metanorma AsciiDoc format:

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <Input-folder>
java -Xss5m -jar target/stepmod2mn-1.18.jar <Input-folder>
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar data/
java -Xss5m -jar target/stepmod2mn-1.18.jar data/
----

NOTE: the result AsciiDocs will be saved in the folder with the source resource.xml and module.xml files.
Expand All @@ -65,29 +65,29 @@ NOTE: the result AsciiDocs will be saved in the folder with the source resource.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <Input-folder> [--output <Output-folder>]
java -Xss5m -jar target/stepmod2mn-1.18.jar <Input-folder> [--output <Output-folder>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar data/ --output documents/
java -Xss5m -jar target/stepmod2mn-1.18.jar data/ --output documents/
----


=== Convert the documents specified in the publication index xml file in the tags 'resource_docs' and 'modules' into the Metanorma AsciiDoc format:

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <Publication-Index-XML-FileName>
java -Xss5m -jar target/stepmod2mn-1.18.jar <Publication-Index-XML-FileName>
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar publication/part1000/CR_PMI_5/publication_index.xml
java -Xss5m -jar target/stepmod2mn-1.18.jar publication/part1000/CR_PMI_5/publication_index.xml
----

NOTE: the resulted AsciiDocs will be saved in the folder with the source resource.xml and module.xml files.
Expand All @@ -99,29 +99,29 @@ and save them into the output folder:

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <Publication-Index-XML-FileName> [--output <Output-folder>]
java -Xss5m -jar target/stepmod2mn-1.18.jar <Publication-Index-XML-FileName> [--output <Output-folder>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar publication/part1000/CR_PMI_5/publication_index.xml --output documents/
java -Xss5m -jar target/stepmod2mn-1.18.jar publication/part1000/CR_PMI_5/publication_index.xml --output documents/
----


=== Convert the specified type of the document (resource_docs or modules) in the publication index xml file into the Metanorma AsciiDoc format:

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar <Publication-Index-XML-FileName> [--type <resource_docs or modules>]
java -Xss5m -jar target/stepmod2mn-1.18.jar <Publication-Index-XML-FileName> [--type <resource_docs or modules>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.17.jar publication/part1000/CR_PMI_5/publication_index.xml --type resource_docs
java -Xss5m -jar target/stepmod2mn-1.18.jar publication/part1000/CR_PMI_5/publication_index.xml --type resource_docs
----

NOTE: the resulted AsciiDocs will be saved in the folder with the source resource.xml (or module.xml) files.
Expand All @@ -133,42 +133,42 @@ NOTE: the Metanorma collection file 'metanorma.yml' will be saved in the 3 level

[source,sh]
----
java -jar target/stepmod2mn-1.17.jar <start folder to process xml maps files> --svg
java -jar target/stepmod2mn-1.18.jar <start folder to process xml maps files> --svg
----

e.g.

[source,sh]
----
java -jar target/stepmod2mn-1.17.jar data/resources --svg
java -jar target/stepmod2mn-1.18.jar data/resources --svg
----

=== Generate SVG images for the XML in the specified folder and sub-folders, and save them in the output folder:

[source,sh]
----
java -jar target/stepmod2mn-1.17.jar <start folder to process xml maps files> --svg [--output <Output-folder>]
java -jar target/stepmod2mn-1.18.jar <start folder to process xml maps files> --svg [--output <Output-folder>]
----

e.g.

[source,sh]
----
java -jar target/stepmod2mn-1.17.jar data/resources --svg --output schemas/
java -jar target/stepmod2mn-1.18.jar data/resources --svg --output schemas/
----

=== Generate SVG image for Express Imagemap XML and Image:

[source,sh]
----
java -jar stepmod2mn-1.17.jar --xml <Express Imagemap XML file path> --image <Image file name> [--svg <resulted SVG map file or folder>]
java -jar stepmod2mn-1.18.jar --xml <Express Imagemap XML file path> --image <Image file name> [--svg <resulted SVG map file or folder>]
----

e.g.

[source,sh]
----
java -jar stepmod2mn-1.17.jar --xml data\resource_docs\fundamentals_of_product_description_and_support\schema_diagexpg1.xml --image schema_diagexpg1.gif --svg schema_diagexpg1.svg
java -jar stepmod2mn-1.18.jar --xml data\resource_docs\fundamentals_of_product_description_and_support\schema_diagexpg1.xml --image schema_diagexpg1.gif --svg schema_diagexpg1.svg
----


Expand All @@ -188,7 +188,7 @@ Update version in `pom.xml`, e.g.:
----
<groupId>org.metanorma</groupId>
<artifactId>stepmod2mn</artifactId>
<version>1.17</version>
<version>1.18</version>
<name>STEPmod XML to Metanorma AsciiDoc converter</name>
----

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

[source,xml]
----
git tag v1.17
git push origin v1.17
git tag v1.18
git push origin v1.18
----

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>stepmod2mn</artifactId>
<version>1.17</version>
<version>1.18</version>
<name>STEPmod XML to Metanorma AsciiDoc converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
11 changes: 9 additions & 2 deletions src/main/resources/stepmod.base_xsl/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,15 @@ or name()='screen' or name()='ul' or name()='example' or name()='note' or name()
<xsl:apply-templates/>
</xsl:variable>
<xsl:copy-of select="$text"/>

<xsl:text>&#xa;&#xa;</xsl:text>
<xsl:choose>
<xsl:when test="following-sibling::*[1][self::li]">
<xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:when test="not(following-sibling::*) and not(../following-sibling::*) and local-name(../..) = 'note'"/>
<xsl:otherwise>
<xsl:text>&#xa;&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- get the text or the text of the last paragraph. Ignore examples and
Expand Down
10 changes: 4 additions & 6 deletions src/main/resources/stepmod.base_xsl/res_doc/resource.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1310,8 +1310,7 @@ Purpose:
<xsl:text>&#xa;</xsl:text>
<xsl:call-template name="insertParagraph">
<xsl:with-param name="text">
The following are within the scope of this part of ISO 10303:
</xsl:with-param>
The following are within the scope of this part of ISO 10303:</xsl:with-param>
</xsl:call-template>
<!-- </p> -->
<!-- output any issues -->
Expand All @@ -1320,7 +1319,7 @@ Purpose:
</xsl:apply-templates>

<!-- <ul> -->
<xsl:text>&#xa;</xsl:text>
<!-- <xsl:text>&#xa;</xsl:text> -->
<xsl:apply-templates/>
<!-- </ul> -->
<xsl:text>&#xa;&#xa;</xsl:text>
Expand All @@ -1335,8 +1334,7 @@ Purpose:
<xsl:text>&#xa;</xsl:text>
<xsl:call-template name="insertParagraph">
<xsl:with-param name="text">
The following are outside the scope of this part of ISO 10303:
</xsl:with-param>
The following are outside the scope of this part of ISO 10303:</xsl:with-param>
</xsl:call-template>
<!-- </p> -->
<!-- output any issues -->
Expand All @@ -1345,7 +1343,7 @@ Purpose:
</xsl:apply-templates>

<!-- <ul> -->
<xsl:text>&#xa;</xsl:text>
<!-- <xsl:text>&#xa;</xsl:text> -->
<xsl:apply-templates/>
<!-- </ul> -->
<xsl:text>&#xa;&#xa;</xsl:text>
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/stepmod2mn.adoc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
<xsl:otherwise>*</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:text>&#xa;</xsl:text>
<xsl:call-template name="repeat">
<xsl:with-param name="char" select="$list-label_"/>
<xsl:with-param name="count" select="$level"/>
Expand Down Expand Up @@ -883,7 +883,9 @@
parent::i or parent::i2 or
parent::tt or parent::tt2 or
parent::sup or parent::sup2 or
parent::sub or parent::sub2)]" mode="linearize">
parent::sub or parent::sub2 or
parent::li_label or
preceding-sibling::node()[1][self::li_label])]" mode="linearize">
<xsl:variable name="text_1" select="translate(., '&#xa;&#x9;', ' ')"/>
<xsl:variable name="text_2" select="java:replaceAll(java:java.lang.String.new($text_1),'\s+',' ')"/>
<xsl:call-template name="trimSpaces">
Expand Down

0 comments on commit 1759691

Please sign in to comment.