Skip to content

Commit

Permalink
Merge pull request #758 from metanorma/fix/annotations
Browse files Browse the repository at this point in the history
Fix/annotations
  • Loading branch information
Intelligent2013 authored Nov 1, 2024
2 parents 3439454 + c913721 commit 8dc1b69
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ XSLT_GENERATED := xslt/iec.international-standard.xsl \
xslt/bipm.rapport.xsl \
xslt/jcgm.standard.xsl

MN2PDF_DOWNLOAD_PATH := https://github.com/metanorma/mn2pdf/releases/download/v2.04/mn2pdf-2.04.jar
MN2PDF_DOWNLOAD_PATH := https://github.com/metanorma/mn2pdf/releases/download/v2.07/mn2pdf-2.07.jar
# MN2PDF_DOWNLOAD_PATH := https://maven.pkg.github.com/metanorma/mn2pdf/com/metanorma/fop/mn2pdf/1.7/mn2pdf-1.7.jar
MN2PDF_EXECUTABLE := $(notdir $(MN2PDF_DOWNLOAD_PATH))

Expand Down
10 changes: 8 additions & 2 deletions xslt_src/bipm.brochure.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2366,6 +2366,7 @@
<xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
<fo:block keep-with-next="always">
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
</fo:block>
<fo:table table-layout="fixed" width="173.5mm">
<xsl:call-template name="setId">
Expand Down Expand Up @@ -2522,6 +2523,7 @@

<fo:block keep-with-next="always">
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
</fo:block>
<fo:table table-layout="fixed" width="174mm" line-height="135%">
<xsl:if test="@orientation = 'landscape'">
Expand Down Expand Up @@ -2738,15 +2740,17 @@
<xsl:when test="local-name(following-sibling::*[1]) = 'title'"/> <!-- id will set in title -->
<xsl:otherwise>
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
Expand Down Expand Up @@ -2779,6 +2783,8 @@

</xsl:if>

<xsl:call-template name="addReviewHelper"/>

<!-- if note relates to title, but not fn -->
<xsl:if test="ancestor::bipm:title and not(bipm:sup_fn)"><fo:inline>* </fo:inline></xsl:if>

Expand Down
47 changes: 46 additions & 1 deletion xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16480,6 +16480,29 @@
<!-- ========== -->


<xsl:variable name="reviews_">
<xsl:for-each select="//*[local-name() = 'review'][@from]">
<xsl:copy>
<xsl:copy-of select="@from"/>
<xsl:copy-of select="@id"/>
</xsl:copy>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>

<xsl:template name="addReviewHelper">
<!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
<xsl:variable name="curr_id" select="@id"/>
<xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
<xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
<fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:if>
<!-- <fo:block>
<curr_id><xsl:value-of select="$curr_id"/></curr_id>
<xsl:copy-of select="$reviews"/>
</fo:block> -->
</xsl:template>

<!-- main sections -->
<xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
<xsl:if test="$namespace = 'm3d' or $namespace = 'unece-rec'">
Expand All @@ -16490,6 +16513,8 @@

<xsl:call-template name="sections_element_style"/>

<xsl:call-template name="addReviewHelper"/>

<xsl:apply-templates />
</fo:block>

Expand Down Expand Up @@ -16610,6 +16635,7 @@
</xsl:choose>
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand All @@ -16635,7 +16661,6 @@
</xsl:choose>
</xsl:template>


<xsl:template match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
<fo:block>
<xsl:if test="parent::*[local-name() = 'copyright-statement']">
Expand All @@ -16648,6 +16673,8 @@

<xsl:call-template name="refine_clause_style"/>

<xsl:call-template name="addReviewHelper"/>

<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down Expand Up @@ -16717,6 +16744,23 @@

<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>

<xsl:if test="1 = 1">
<xsl:choose>
<!-- if there isn't the attribute '@from', then -->
<xsl:when test="$id_from = ''">
<fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:when>
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
<xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
<fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:when>
<xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
<fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
</xsl:when>
</xsl:choose>
</xsl:if>

<xsl:if test="1 = 2">
<xsl:choose>
<!-- if there isn't the attribute '@from', then -->
<xsl:when test="$id_from = ''">
Expand All @@ -16730,6 +16774,7 @@
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
</xsl:when>
</xsl:choose>
</xsl:if>

</xsl:template>

Expand Down
2 changes: 2 additions & 0 deletions xslt_src/ieee.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,7 @@
<xsl:template match="ieee:abstract">
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down Expand Up @@ -2356,6 +2357,7 @@
<xsl:template match="*[local-name() = 'introduction'] | *[local-name() = 'foreword'] | *[local-name() = 'acknowledgements']">
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/iho.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@
<xsl:otherwise>
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
Expand Down
4 changes: 4 additions & 0 deletions xslt_src/iso.international-standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -4541,6 +4541,8 @@
</xsl:if>
</xsl:if>

<xsl:call-template name="addReviewHelper"/>

<xsl:call-template name="processElementContent"/>
</fo:block>
</xsl:template>
Expand All @@ -4558,6 +4560,8 @@

<xsl:call-template name="refine_clause_style"/>

<xsl:call-template name="addReviewHelper"/>

<xsl:call-template name="processElementContent"/>

</fo:block>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/itu.recommendation.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1967,6 +1967,7 @@
</xsl:choose>
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/jis.international-standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,7 @@
<xsl:template match="*[local-name() = 'preface']/*[local-name() = 'clause']" priority="3">
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/ogc.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@
<xsl:attribute name="line-height">125%</xsl:attribute>
</xsl:if>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/ogc.white-paper.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@

<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/plateau.international-standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@
<xsl:template match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*[local-name() = 'clause']" priority="3">
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</xsl:template>
Expand Down
1 change: 1 addition & 0 deletions xslt_src/ribose.standard.core.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@
<fo:block-container margin-left="0mm">
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="addReviewHelper"/>
<xsl:apply-templates />
</fo:block>
</fo:block-container>
Expand Down

0 comments on commit 8dc1b69

Please sign in to comment.