Skip to content

Commit

Permalink
Merge pull request #182 from metanorma/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
Intelligent2013 authored Apr 29, 2024
2 parents 821c32e + c0f6a03 commit 58e054c
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 71 deletions.
56 changes: 28 additions & 28 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.52.jar <XML-FileName>
java -Xss5m -jar target/stepmod2mn-1.53.jar <XML-FileName>
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar data/resource_docs/draughting_elements/resource.xml
java -Xss5m -jar target/stepmod2mn-1.53.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.52.jar <XML-FileName> [--output <AsciiDoc-FileName>]
java -Xss5m -jar target/stepmod2mn-1.53.jar <XML-FileName> [--output <AsciiDoc-FileName>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar data/resource_docs/draughting_elements/resource.xml --output result_dir/draughting_elements/document.adoc
java -Xss5m -jar target/stepmod2mn-1.53.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.52.jar <Input-folder>
java -Xss5m -jar target/stepmod2mn-1.53.jar <Input-folder>
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar data/
java -Xss5m -jar target/stepmod2mn-1.53.jar data/
----

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

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

e.g.

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


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

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar <Input-folder> [--exclude <documents or part numbers list>]
java -Xss5m -jar target/stepmod2mn-1.53.jar <Input-folder> [--exclude <documents or part numbers list>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar data/ --exclude "machining_features 104"
java -Xss5m -jar target/stepmod2mn-1.53.jar data/ --exclude "machining_features 104"
----

=== Convert only specified documents 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.52.jar <Input-folder> [--include-only <documents list>]
java -Xss5m -jar target/stepmod2mn-1.53.jar <Input-folder> [--include-only <documents list>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar data/ --include-only "fundamentals_of_product_description_and_support kinematics"
java -Xss5m -jar target/stepmod2mn-1.53.jar data/ --include-only "fundamentals_of_product_description_and_support kinematics"
----

=== Generate Metanorma collection files (metanorma.yml and collection.yml) for the documents specified in the publication index xml file in the tags 'resource_docs' and 'modules':

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

e.g.

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

NOTE: the Metanorma collection files .yml will be saved in the 3 level up folder (usually, source repository's root folder).
Expand All @@ -125,14 +125,14 @@ and save them into the output folder:

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

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar iso-10303-srl/iso-10303-stepmod-wg12/publication/part1000/CR_PMI_5/publication_index.xml --output iso-10303-srl/
java -Xss5m -jar target/stepmod2mn-1.53.jar iso-10303-srl/iso-10303-stepmod-wg12/publication/part1000/CR_PMI_5/publication_index.xml --output iso-10303-srl/
----

NOTE: the output folder should contains the folder with the generated .adoc (usually, 'documents'). You can specify this folder obviously by the parameter '--input-documents':
Expand All @@ -141,7 +141,7 @@ e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.52.jar iso-10303-srl/iso-10303-stepmod-wg12/publication/part1000/CR_PMI_5/publication_index.xml --output iso-10303-srl/CR_PMI_5 --input-documents iso-10303-srl/documents
java -Xss5m -jar target/stepmod2mn-1.53.jar iso-10303-srl/iso-10303-stepmod-wg12/publication/part1000/CR_PMI_5/publication_index.xml --output iso-10303-srl/CR_PMI_5 --input-documents iso-10303-srl/documents
----

NOTE: the Metanorma collection files (.yml) will be saved in the folder 'iso-10303-srl/CR_PMI_5' and the references point to the documents in the folder iso-10303-srl/documents.
Expand All @@ -151,14 +151,14 @@ NOTE: the Metanorma collection files (.yml) will be saved in the folder 'iso-103

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

e.g.

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

NOTE: the Metanorma collection file 'metanorma.yml' will be saved in the 3 level up folder (usually, source repository's root folder).
Expand All @@ -168,42 +168,42 @@ NOTE: the Metanorma collection file 'metanorma.yml' will be saved in the 3 level

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

e.g.

[source,sh]
----
java -jar target/stepmod2mn-1.52.jar data/resources --svg
java -jar target/stepmod2mn-1.53.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.52.jar <start folder to process xml maps files> --svg [--output <Output-folder>]
java -jar target/stepmod2mn-1.53.jar <start folder to process xml maps files> --svg [--output <Output-folder>]
----

e.g.

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

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

[source,sh]
----
java -jar stepmod2mn-1.52.jar --xml <Express Imagemap XML file path> --image <Image file name> [--svg <resulted SVG map file or folder>]
java -jar stepmod2mn-1.53.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.52.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.53.jar --xml data\resource_docs\fundamentals_of_product_description_and_support\schema_diagexpg1.xml --image schema_diagexpg1.gif --svg schema_diagexpg1.svg
----


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

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

[source,xml]
----
git tag v1.52
git push origin v1.52
git tag v1.53
git push origin v1.53
----

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.52</version>
<version>1.53</version>
<name>STEPmod XML to Metanorma AsciiDoc converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
66 changes: 42 additions & 24 deletions src/main/resources/stepmod.base_xsl/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -918,24 +918,42 @@ or name()='screen' or name()='ul' or name()='example' or name()='note' or name()
<xsl:text>&#xa;&#xa;</xsl:text>
</xsl:if>

<xsl:choose>
<xsl:when test="following-sibling::*[1][local-name() = 'example' or local-name() = 'note']">
<xsl:call-template name="insertParagraph">
<xsl:with-param name="text">
<xsl:apply-templates/>
</xsl:with-param>
<xsl:with-param name="keep-with-next">true</xsl:with-param>
</xsl:call-template>
<!-- Example:
<def>
<p>batch</p>
collection of distinct products that are treated as a single unit
<example>...
-->

<xsl:choose>
<xsl:when test="parent::def and not(preceding-sibling::node()[normalize-space() != '']) and following-sibling::node()[1][self::text()][normalize-space() != '']">
<xsl:text>admitted:[</xsl:text>
<xsl:apply-templates/>
<xsl:text>]</xsl:text>
<br/><br/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="insertParagraph">
<xsl:with-param name="text">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
<xsl:choose>
<xsl:when test="following-sibling::*[1][local-name() = 'example' or local-name() = 'note']">
<xsl:call-template name="insertParagraph">
<xsl:with-param name="text">
<xsl:apply-templates/>
</xsl:with-param>
<xsl:with-param name="keep-with-next">true</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="insertParagraph">
<xsl:with-param name="text">
<xsl:apply-templates/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>

<xsl:if test="parent::def and following-sibling::*[1][self::p]"><br/><br/></xsl:if>

</xsl:template>

Expand Down Expand Up @@ -4859,7 +4877,7 @@ is case sensitive.')"/>

<xsl:template match="firstname | lastname">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/>
<xsl:text>&#xa;</xsl:text>
</xsl:template>

Expand Down Expand Up @@ -4894,51 +4912,51 @@ is case sensitive.')"/>

<xsl:template match="affiliation">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="street">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="pobox">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="city">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="state">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="postcode">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="country">
<xsl:param name="document_attribute_prefix"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/><!-- <br/> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/><!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>

<xsl:template match="phone">
<xsl:param name="document_attribute_prefix"/>
<!-- <b>Telephone: </b> -->
<!-- <xsl:text> *Telephone:* </xsl:text> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/>
<!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>
Expand All @@ -4947,7 +4965,7 @@ is case sensitive.')"/>
<xsl:param name="document_attribute_prefix"/>
<!-- <b>Telefacsimile: </b> -->
<!-- <xsl:text> *Telefacsimile:* </xsl:text> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/>
<!-- <br/> -->
<xsl:text>&#xa;</xsl:text>
</xsl:template>
Expand All @@ -4963,7 +4981,7 @@ is case sensitive.')"/>

<!-- <xsl:text> *Electronic mail:* </xsl:text> -->
<!--<xsl:value-of select="$mailto"/> <xsl:text>[]</xsl:text> -->
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', .)"/>
<xsl:value-of select="concat($document_attribute_prefix, local-name(), ': ', normalize-space())"/>
<xsl:text>&#xa;</xsl:text>
</xsl:template>

Expand Down
Loading

0 comments on commit 58e054c

Please sign in to comment.