Skip to content

Commit

Permalink
Merge pull request #170 from metanorma/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
Intelligent2013 authored Apr 24, 2024
2 parents 7886cdc + 479671b commit 754dd5d
Show file tree
Hide file tree
Showing 23 changed files with 510 additions and 636 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.46.jar <XML-FileName>
java -Xss5m -jar target/stepmod2mn-1.47.jar <XML-FileName>
----

e.g.

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

e.g.

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

e.g.

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

e.g.

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

e.g.

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

e.g.

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

e.g.

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

e.g.

[source,sh]
----
java -Xss5m -jar target/stepmod2mn-1.46.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.47.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.46.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.47.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.46.jar <Publication-Index-XML-FileName> [--type <resource_docs or modules>]
java -Xss5m -jar target/stepmod2mn-1.47.jar <Publication-Index-XML-FileName> [--type <resource_docs or modules>]
----

e.g.

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

e.g.

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

e.g.

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

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

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

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.46</version>
<version>1.47</version>
<name>STEPmod XML to Metanorma AsciiDoc converter</name>
<packaging>jar</packaging>
<url>https://www.metanorma.org</url>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/linearize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</xsl:template>

<!-- remove empty p -->
<xsl:template match="p[not(text()) or text() = '']" mode="step1"/>
<xsl:template match="p[not(.//text()) or text() = '']" mode="step1"/>


<xsl:template match="@*|node()">
Expand Down
64 changes: 51 additions & 13 deletions src/main/resources/stepmod.base_xsl/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,15 @@ width="20" height="20"/> -->
<!-- <xsl:value-of
select="concat('../../../modules/',$module,'/sys/introduction',
$FILE_EXT,$construct)"/> -->
<xsl:value-of select="$construct"/>
<xsl:choose>
<xsl:when test="$construct != ''">
<xsl:value-of select="$construct"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'introduction'"/>
</xsl:otherwise>
</xsl:choose>

</xsl:when>

<xsl:when test="$section='1_scope'">
Expand Down Expand Up @@ -2931,6 +2939,19 @@ width="20" height="20"/> -->
[construct:<xsl:value-of select="$construct"/>]
[id:<xsl:value-of select="$id"/>]
-->

<xsl:variable name="module_curr" select="ancestor::module/@name"/>
<xsl:variable name="mod_dir">
<xsl:call-template name="module_directory">
<xsl:with-param name="module" select="$module"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="module_xml_document" select="document(concat($mod_dir,'/module.xml'))"/>
<xsl:variable name="module_part" select="$module_xml_document/*/@part"/>
<!-- Example: <<doc_iso10303-54,anchor=scope>> -->
<xsl:variable name="href_module" select="concat('doc_iso10303-',$module_part)"/>
<xsl:variable name="anchor" select="concat('anchor=',$href)"/>

<xsl:choose>
<xsl:when test="$href=''">
<xsl:call-template name="error_message">
Expand All @@ -2940,6 +2961,20 @@ width="20" height="20"/> -->
$nlinkend,
'# is incorrectly specified.')"/>
</xsl:call-template>
<!-- <xsl:message>DEBUG:</xsl:message>
<xsl:message>nlinkend=<xsl:value-of select="$nlinkend"/></xsl:message>
<xsl:message>module_sect=<xsl:value-of select="$module_sect"/></xsl:message>
<xsl:message>module_curr=<xsl:value-of select="ancestor::module/@name"/></xsl:message>
<xsl:message>module=<xsl:value-of select="$module"/></xsl:message>
<xsl:message>nlinkend1=<xsl:value-of select="$nlinkend1"/></xsl:message>
<xsl:message>section_tmp=<xsl:value-of select="$section_tmp"/></xsl:message>
<xsl:message>section=<xsl:value-of select="$section"/></xsl:message>
<xsl:message>nlinkend2=<xsl:value-of select="$nlinkend2"/></xsl:message>
<xsl:message>construct_tmp=<xsl:value-of select="$construct_tmp"/></xsl:message>
<xsl:message>nlinkend3=<xsl:value-of select="$nlinkend3"/></xsl:message>
<xsl:message>id=<xsl:value-of select="$id"/></xsl:message>
<xsl:message>construct=<xsl:value-of select="$construct"/></xsl:message>
<xsl:message>href=<xsl:value-of select="$href"/></xsl:message> -->
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
Expand All @@ -2960,20 +2995,11 @@ width="20" height="20"/> -->
</xsl:choose>
</xsl:when>
<xsl:otherwise>

<xsl:variable name="module_curr" select="ancestor::module/@name"/>

<xsl:choose>
<xsl:when test="$module_curr != $module"> <!-- link to the another module -->
<xsl:variable name="mod_dir">
<xsl:call-template name="module_directory">
<xsl:with-param name="module" select="$module"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="module_xml_document" select="document(concat($mod_dir,'/module.xml'))"/>
<xsl:variable name="module_part" select="$module_xml_document/*/@part"/>
<xsl:attribute name="href"><xsl:value-of select="concat('doc_iso10303-',$module_part)"/></xsl:attribute>
<xsl:value-of select="concat('anchor=',$href)"/>
<xsl:attribute name="href"><xsl:value-of select="$href_module"/></xsl:attribute>
<xsl:value-of select="$anchor"/>
<!-- Example: <<doc_iso10303-54,anchor=scope>> -->
</xsl:when>
<xsl:otherwise>
Expand All @@ -2997,8 +3023,20 @@ width="20" height="20"/> -->
<!-- <a href="{$href}"><xsl:value-of select="$module_name"/></a> -->
<xsl:call-template name="insertHyperlink">
<xsl:with-param name="a">
<a href="{$href}"><xsl:value-of select="$module_name"/></a>
<a href="{$href}">
<xsl:choose>
<xsl:when test="$module_curr != $module"> <!-- link to the another module -->
<xsl:attribute name="href"><xsl:value-of select="$href_module"/></xsl:attribute>
<xsl:value-of select="$anchor"/>
<!-- Example: <<doc_iso10303-54,anchor=scope>> -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$module_name"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:with-param>
<xsl:with-param name="isInternalLink"><xsl:if test="$module_curr != $module">true</xsl:if></xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
Expand Down
Loading

0 comments on commit 754dd5d

Please sign in to comment.