Skip to content

Commit

Permalink
Merge pull request #202 from metanorma/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
Intelligent2013 authored Oct 4, 2024
2 parents 733a890 + 2673153 commit 0893547
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 34 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.60.jar <XML-FileName>
java -Xss5m -jar target/stepmod2mn-1.61.jar <XML-FileName>
----

e.g.

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

e.g.

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

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.jar data/
java -Xss5m -jar target/stepmod2mn-1.61.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.60.jar <Input-folder> [--output <Output-folder>]
java -Xss5m -jar target/stepmod2mn-1.61.jar <Input-folder> [--output <Output-folder>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.jar data/ --output documents/
java -Xss5m -jar target/stepmod2mn-1.61.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.60.jar <Input-folder> [--exclude <documents or part numbers list>]
java -Xss5m -jar target/stepmod2mn-1.61.jar <Input-folder> [--exclude <documents or part numbers list>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.jar data/ --exclude "machining_features 104"
java -Xss5m -jar target/stepmod2mn-1.61.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.60.jar <Input-folder> [--include-only <documents list>]
java -Xss5m -jar target/stepmod2mn-1.61.jar <Input-folder> [--include-only <documents list>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.jar data/ --include-only "fundamentals_of_product_description_and_support kinematics"
java -Xss5m -jar target/stepmod2mn-1.61.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.60.jar <Publication-Index-XML-FileName>
java -Xss5m -jar target/stepmod2mn-1.61.jar <Publication-Index-XML-FileName>
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.jar publication/part1000/CR_PMI_5/publication_index.xml
java -Xss5m -jar target/stepmod2mn-1.61.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.60.jar <Publication-Index-XML-FileName> [--output <Output-folder>]
java -Xss5m -jar target/stepmod2mn-1.61.jar <Publication-Index-XML-FileName> [--output <Output-folder>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.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.61.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.60.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.61.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.60.jar <Publication-Index-XML-FileName> [--type <resource_docs or modules>]
java -Xss5m -jar target/stepmod2mn-1.61.jar <Publication-Index-XML-FileName> [--type <resource_docs or modules>]
----

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.60.jar publication/part1000/CR_PMI_5/publication_index.xml --type resource_docs
java -Xss5m -jar target/stepmod2mn-1.61.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.60.jar <start folder to process xml maps files> --svg
java -jar target/stepmod2mn-1.61.jar <start folder to process xml maps files> --svg
----

e.g.

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

e.g.

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

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

[source,sh]
----
java -jar stepmod2mn-1.60.jar --xml <Express Imagemap XML file path> --image <Image file name> [--svg <resulted SVG map file or folder>]
java -jar stepmod2mn-1.61.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.60.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.61.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.60</version>
<version>1.61</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.60
git push origin v1.60
git tag v1.61
git push origin v1.61
----

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.60</version>
<version>1.61</version>
<name>STEPmod XML to Metanorma AsciiDoc converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
14 changes: 13 additions & 1 deletion src/main/resources/linearize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,27 @@
<xsl:when test="not(preceding-sibling::*) and not(preceding-sibling::comment())">
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'^\s+','')"/>
</xsl:when>
<xsl:when test="count(preceding-sibling::node()) = 1 and preceding-sibling::comment()">
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'^\s+','')"/>
</xsl:when>
<xsl:when test="count(preceding-sibling::node()) = 2 and preceding-sibling::comment() and preceding-sibling::text()[normalize-space() = '']">
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'^\s+','')"/>
</xsl:when>
<xsl:when test="preceding-sibling::node()[1][self::p or self::table or self::ul or self::ol or self::dl]">
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'^\s+','')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>


<xsl:variable name="text_righttrim">
<xsl:choose>
<xsl:when test="following-sibling::node()[1][self::p or self::table or self::ul or self::ol or self::dl]">
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text_lefttrim),'\s+$','')"/>
<xsl:if test="following-sibling::node()[1][self::table]"><xsl:text>&#xa;&#xa;</xsl:text></xsl:if>
</xsl:when>
<xsl:when test="(not(following-sibling::*) and not(following-sibling::comment())) or following-sibling::*[1][self::note or self::example]">
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text_lefttrim),'\s+$','')"/>
</xsl:when>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/stepmod.base_xsl/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ or name()='screen' or name()='ul' or name()='example' or name()='note' or name()
A definition list
-->
<xsl:template match="dl">
<br/><br/>
<!-- <dl> -->
<xsl:apply-templates mode="dl"/>
<!-- </dl> -->
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/stepmod.base_xsl/res_doc/resource.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1640,11 +1640,15 @@ Purpose:

<xsl:variable name="express_g_diagrams_yaml" select="concat($outpath, '/express-g-diagrams.yaml')"/>

<!-- commented -->
<!-- https://github.com/metanorma/stepmod2mn/issues/201 -->
<xsl:if test="1 = 2">
<redirect:open file="{$express_g_diagrams_yaml}"/>
<redirect:write file="{$express_g_diagrams_yaml}">
<xsl:text>---</xsl:text>
<xsl:text>&#xa;</xsl:text>
</redirect:write>
</xsl:if>

<!-- generate SVG images -->
<xsl:for-each select="./schema/express-g/imgfile | ./schema/express-g/img">
Expand All @@ -1655,6 +1659,9 @@ Purpose:
<!-- Note: the variable generateSVG is using just for call the function 'generateSVG' -->
<xsl:variable name="generateSVG" select="java:generateSVG(java:org.metanorma.stepmod2mn.new(),concat($path,'/','../../resources/', $schema,'/',@file),'',$outpath_schemas,false())"/>

<!-- commented -->
<!-- https://github.com/metanorma/stepmod2mn/issues/201 -->
<xsl:if test="1 = 2">
<xsl:if test="normalize-space($generateSVG) != ''">
<redirect:write file="{$express_g_diagrams_yaml}">
<xsl:text>- path: ../</xsl:text> <!-- added '../' because `:imagesdir: images` added, see https://github.com/metanorma/stepmod2mn/issues/138 -->
Expand All @@ -1663,9 +1670,12 @@ Purpose:
<xsl:text>&#xa;</xsl:text>
</redirect:write>
</xsl:if>
</xsl:if>

</xsl:for-each>
<xsl:if test="1 = 2">
<redirect:close file="{$express_g_diagrams_yaml}"/>
</xsl:if>

<!-- commented -->
<!-- https://github.com/metanorma/stepmod2mn/issues/115 -->
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/stepmod2mn.adoc.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<xsl:strip-space elements="*"/>

<xsl:variable name="annex_id_usage_info">usage_info</xsl:variable>
<xsl:variable name="annex_id_change_history">change_history</xsl:variable>
<xsl:variable name="annex_id_change_history">annex_change_history</xsl:variable>
<xsl:variable name="annex_id_add_scope">add_scope</xsl:variable>
<xsl:variable name="annex_id_tech_discussion">tech_discussion</xsl:variable>
<xsl:variable name="annex_id_examples">annex_examples</xsl:variable>
Expand Down Expand Up @@ -381,9 +381,10 @@
<xsl:with-param name="count" select="$level + 1"/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:value-of select="$header"/>
<xsl:value-of select="normalize-space($header)"/>
<xsl:if test="$indexed = 'true'">
<xsl:text> (((</xsl:text>
<xsl:if test="normalize-space($header) != ''"><xsl:text> </xsl:text></xsl:if>
<xsl:text>(((</xsl:text>
<xsl:choose>
<xsl:when test="$index_term2 != '' or $index_term3 != ''">
<xsl:value-of select="$index_term"/>
Expand Down Expand Up @@ -608,7 +609,8 @@

<xsl:template name="insertListItemLabel">
<xsl:param name="list-label"/>
<xsl:variable name="level_" select="count(ancestor-or-self::ul) + count(ancestor-or-self::ol)"/>
<!-- <xsl:variable name="level_" select="count(ancestor-or-self::ul) + count(ancestor-or-self::ol)"/> -->
<xsl:variable name="level_" select="count(ancestor-or-self::li) - count(ancestor::note) - count(ancestor::example)"/>
<xsl:variable name="level">
<xsl:choose>
<xsl:when test="$level_ = 0">1</xsl:when>
Expand Down

0 comments on commit 0893547

Please sign in to comment.