metanorma-iho 0.8.7 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efe3afcdcaff83fcf92251b8a15bd65680245bfe8c1ee1ad131b2a8fc76de072
4
- data.tar.gz: c60b29058e6f75f908cf574bec4729a27ab96deca43766c913c6455ed3322de8
3
+ metadata.gz: 0222564e4000d5ef484f0f0a82838f1c3ece8a0d2546e795e992c62dc69ae5fa
4
+ data.tar.gz: 3db4ef3f58e77c33f55c228c6714c67ba8e278262f6de0706b2ee8ad784ff984
5
5
  SHA512:
6
- metadata.gz: 198cef905847f3f049c870a8de097b92c71ea510ba1b582c0910cc8ae2902bce9137a6c5c90c3c9eed8477fed3f8f81d8ef24088ecb7e78bdf59afa19f33dca7
7
- data.tar.gz: 00b6733a35e81f537fe30e54cbeddc166f5654f49eca78d9d61edee109eae6d30b9b7ea726c3fa9a10fa80c1fc354e71fdb8671e7b20010db1f25d61a4f6e350
6
+ metadata.gz: 4fc6726f6a56ad1fbf42489bddd54d972563e638dd83cbed938176d7ad98635a41a1e2be48f70a18f56c594a5adaf489badbafda07bd0b3d26297da7f0535369
7
+ data.tar.gz: 5217fe26eda5262afd14ae27c9fcc4a651c172593d7c427ca7d2e60dcf35f67964dbe6309fa66708319a8dd174ffeaa28fcb5abb4a11b0def1da95b97fd72c4c
@@ -1,3 +1,4 @@
1
1
  table_of_contents: Contents
2
2
  clause: Chapter
3
3
  subclause: Section
4
+ dochistory: Document History
@@ -2606,7 +2606,9 @@
2606
2606
  </xsl:template> <!-- license-statement/p -->
2607
2607
 
2608
2608
  <xsl:template match="*[local-name()='legal-statement']">
2609
+ <xsl:param name="isLegacy">false</xsl:param>
2609
2610
  <fo:block xsl:use-attribute-sets="legal-statement-style">
2611
+
2610
2612
  <xsl:apply-templates/>
2611
2613
  </fo:block>
2612
2614
  </xsl:template> <!-- legal-statement -->
@@ -4875,13 +4877,14 @@
4875
4877
  <!-- ================= -->
4876
4878
  <!-- Added,deleted text -->
4877
4879
  <!-- ================= -->
4878
- <xsl:template match="*[local-name()='add']" name="tag_add">
4880
+ <xsl:template match="*[local-name()='add'] | *[local-name() = 'change-open-tag'] | *[local-name() = 'change-close-tag']" name="tag_add">
4879
4881
  <xsl:param name="skip">true</xsl:param>
4880
4882
  <xsl:param name="block">false</xsl:param>
4881
4883
  <xsl:param name="type"/>
4882
4884
  <xsl:param name="text-align"/>
4883
4885
  <xsl:choose>
4884
- <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4886
+ <xsl:when test="starts-with(., $ace_tag) or local-name() = 'change-open-tag' or local-name() = 'change-close-tag'"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start, or
4887
+ <change-open-tag>A<sub>1</sub></change-open-tag>, <change-close-tag>A<sub>1</sub></change-close-tag> -->
4885
4888
  <xsl:choose>
4886
4889
  <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
4887
4890
  <xsl:otherwise>
@@ -4889,12 +4892,32 @@
4889
4892
  <xsl:call-template name="insertTag">
4890
4893
  <xsl:with-param name="type">
4891
4894
  <xsl:choose>
4895
+ <xsl:when test="local-name() = 'change-open-tag'">start</xsl:when>
4896
+ <xsl:when test="local-name() = 'change-close-tag'">end</xsl:when>
4892
4897
  <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4893
4898
  <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4894
4899
  </xsl:choose>
4895
4900
  </xsl:with-param>
4896
- <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4897
- <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4901
+ <xsl:with-param name="kind">
4902
+ <xsl:choose>
4903
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
4904
+ <xsl:value-of select="text()"/>
4905
+ </xsl:when>
4906
+ <xsl:otherwise>
4907
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4908
+ </xsl:otherwise>
4909
+ </xsl:choose>
4910
+ </xsl:with-param>
4911
+ <xsl:with-param name="value">
4912
+ <xsl:choose>
4913
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
4914
+ <xsl:value-of select="*[local-name() = 'sub']"/>
4915
+ </xsl:when>
4916
+ <xsl:otherwise>
4917
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4918
+ </xsl:otherwise>
4919
+ </xsl:choose>
4920
+ </xsl:with-param>
4898
4921
  </xsl:call-template>
4899
4922
  </xsl:variable>
4900
4923
  <xsl:choose>
@@ -7171,11 +7194,17 @@
7171
7194
  </xsl:when>
7172
7195
  <xsl:otherwise>
7173
7196
 
7197
+ <xsl:variable name="image_class" select="ancestor::*[local-name() = 'image']/@class"/>
7198
+ <xsl:variable name="ancestor_table_cell" select="normalize-space(ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"/>
7199
+
7174
7200
  <xsl:variable name="element">
7175
7201
  <xsl:choose>
7176
7202
  <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
7177
7203
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7178
7204
  </xsl:when>
7205
+ <xsl:when test="not(ancestor::*[local-name() = 'figure'])">
7206
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7207
+ </xsl:when>
7179
7208
  <xsl:otherwise>
7180
7209
  <fo:block xsl:use-attribute-sets="image-style">
7181
7210
  <xsl:if test="ancestor::*[local-name() = 'dt']">
@@ -7191,10 +7220,24 @@
7191
7220
  <xsl:copy-of select="@*"/>
7192
7221
  <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
7193
7222
  <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7194
- <xsl:if test="$isGenerateTableIF = 'false'">
7195
- <xsl:attribute name="width">100%</xsl:attribute>
7196
- </xsl:if>
7197
- <xsl:attribute name="content-height">100%</xsl:attribute>
7223
+
7224
+ <xsl:choose>
7225
+ <xsl:when test="$image_class = 'corrigenda-tag'">
7226
+ <xsl:attribute name="fox:alt-text">CorrigendaTag</xsl:attribute>
7227
+ <xsl:attribute name="baseline-shift">-10%</xsl:attribute>
7228
+ <xsl:if test="$ancestor_table_cell = 'true'">
7229
+ <xsl:attribute name="baseline-shift">-25%</xsl:attribute>
7230
+ </xsl:if>
7231
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
7232
+ </xsl:when>
7233
+ <xsl:otherwise>
7234
+ <xsl:if test="$isGenerateTableIF = 'false'">
7235
+ <xsl:attribute name="width">100%</xsl:attribute>
7236
+ </xsl:if>
7237
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7238
+ </xsl:otherwise>
7239
+ </xsl:choose>
7240
+
7198
7241
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7199
7242
  <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7200
7243
  <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
@@ -9365,14 +9408,16 @@
9365
9408
 
9366
9409
  <xsl:template match="*[local-name() = 'annex']">
9367
9410
  <fo:block break-after="page"/>
9368
- <fo:block id="{@id}">
9411
+ <fo:block>
9369
9412
 
9370
9413
  <xsl:call-template name="setBlockSpanAll"/>
9371
9414
 
9372
9415
  <xsl:call-template name="refine_annex_style"/>
9373
9416
 
9374
9417
  </fo:block>
9375
- <xsl:apply-templates/>
9418
+ <fo:block id="{@id}">
9419
+ <xsl:apply-templates/>
9420
+ </fo:block>
9376
9421
  </xsl:template>
9377
9422
 
9378
9423
  <xsl:template name="refine_annex_style">
@@ -9392,13 +9437,19 @@
9392
9437
  <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9393
9438
  </xsl:when>
9394
9439
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
9395
- <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9440
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9441
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9442
+ </xsl:when>
9443
+ <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9396
9444
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9397
9445
  </xsl:when>
9398
9446
  </xsl:choose>
9399
9447
 
9400
9448
  </xsl:template>
9401
9449
 
9450
+ <!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
9451
+ <xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
9452
+
9402
9453
  <xsl:template match="*[local-name() = 'name']/text()">
9403
9454
  <!-- 0xA0 to space replacement -->
9404
9455
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -11007,7 +11058,7 @@
11007
11058
 
11008
11059
  <xsl:template name="printEdition">
11009
11060
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
11010
- <xsl:text> </xsl:text>
11061
+
11011
11062
  <xsl:choose>
11012
11063
  <xsl:when test="$edition_i18n != ''">
11013
11064
  <!-- Example: <edition language="fr">deuxième édition</edition> -->
@@ -2606,7 +2606,9 @@
2606
2606
  </xsl:template> <!-- license-statement/p -->
2607
2607
 
2608
2608
  <xsl:template match="*[local-name()='legal-statement']">
2609
+ <xsl:param name="isLegacy">false</xsl:param>
2609
2610
  <fo:block xsl:use-attribute-sets="legal-statement-style">
2611
+
2610
2612
  <xsl:apply-templates/>
2611
2613
  </fo:block>
2612
2614
  </xsl:template> <!-- legal-statement -->
@@ -4875,13 +4877,14 @@
4875
4877
  <!-- ================= -->
4876
4878
  <!-- Added,deleted text -->
4877
4879
  <!-- ================= -->
4878
- <xsl:template match="*[local-name()='add']" name="tag_add">
4880
+ <xsl:template match="*[local-name()='add'] | *[local-name() = 'change-open-tag'] | *[local-name() = 'change-close-tag']" name="tag_add">
4879
4881
  <xsl:param name="skip">true</xsl:param>
4880
4882
  <xsl:param name="block">false</xsl:param>
4881
4883
  <xsl:param name="type"/>
4882
4884
  <xsl:param name="text-align"/>
4883
4885
  <xsl:choose>
4884
- <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4886
+ <xsl:when test="starts-with(., $ace_tag) or local-name() = 'change-open-tag' or local-name() = 'change-close-tag'"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start, or
4887
+ <change-open-tag>A<sub>1</sub></change-open-tag>, <change-close-tag>A<sub>1</sub></change-close-tag> -->
4885
4888
  <xsl:choose>
4886
4889
  <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
4887
4890
  <xsl:otherwise>
@@ -4889,12 +4892,32 @@
4889
4892
  <xsl:call-template name="insertTag">
4890
4893
  <xsl:with-param name="type">
4891
4894
  <xsl:choose>
4895
+ <xsl:when test="local-name() = 'change-open-tag'">start</xsl:when>
4896
+ <xsl:when test="local-name() = 'change-close-tag'">end</xsl:when>
4892
4897
  <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4893
4898
  <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4894
4899
  </xsl:choose>
4895
4900
  </xsl:with-param>
4896
- <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4897
- <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4901
+ <xsl:with-param name="kind">
4902
+ <xsl:choose>
4903
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
4904
+ <xsl:value-of select="text()"/>
4905
+ </xsl:when>
4906
+ <xsl:otherwise>
4907
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4908
+ </xsl:otherwise>
4909
+ </xsl:choose>
4910
+ </xsl:with-param>
4911
+ <xsl:with-param name="value">
4912
+ <xsl:choose>
4913
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
4914
+ <xsl:value-of select="*[local-name() = 'sub']"/>
4915
+ </xsl:when>
4916
+ <xsl:otherwise>
4917
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4918
+ </xsl:otherwise>
4919
+ </xsl:choose>
4920
+ </xsl:with-param>
4898
4921
  </xsl:call-template>
4899
4922
  </xsl:variable>
4900
4923
  <xsl:choose>
@@ -7171,11 +7194,17 @@
7171
7194
  </xsl:when>
7172
7195
  <xsl:otherwise>
7173
7196
 
7197
+ <xsl:variable name="image_class" select="ancestor::*[local-name() = 'image']/@class"/>
7198
+ <xsl:variable name="ancestor_table_cell" select="normalize-space(ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"/>
7199
+
7174
7200
  <xsl:variable name="element">
7175
7201
  <xsl:choose>
7176
7202
  <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
7177
7203
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7178
7204
  </xsl:when>
7205
+ <xsl:when test="not(ancestor::*[local-name() = 'figure'])">
7206
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
7207
+ </xsl:when>
7179
7208
  <xsl:otherwise>
7180
7209
  <fo:block xsl:use-attribute-sets="image-style">
7181
7210
  <xsl:if test="ancestor::*[local-name() = 'dt']">
@@ -7191,10 +7220,24 @@
7191
7220
  <xsl:copy-of select="@*"/>
7192
7221
  <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
7193
7222
  <fo:instream-foreign-object fox:alt-text="{$alt-text}">
7194
- <xsl:if test="$isGenerateTableIF = 'false'">
7195
- <xsl:attribute name="width">100%</xsl:attribute>
7196
- </xsl:if>
7197
- <xsl:attribute name="content-height">100%</xsl:attribute>
7223
+
7224
+ <xsl:choose>
7225
+ <xsl:when test="$image_class = 'corrigenda-tag'">
7226
+ <xsl:attribute name="fox:alt-text">CorrigendaTag</xsl:attribute>
7227
+ <xsl:attribute name="baseline-shift">-10%</xsl:attribute>
7228
+ <xsl:if test="$ancestor_table_cell = 'true'">
7229
+ <xsl:attribute name="baseline-shift">-25%</xsl:attribute>
7230
+ </xsl:if>
7231
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
7232
+ </xsl:when>
7233
+ <xsl:otherwise>
7234
+ <xsl:if test="$isGenerateTableIF = 'false'">
7235
+ <xsl:attribute name="width">100%</xsl:attribute>
7236
+ </xsl:if>
7237
+ <xsl:attribute name="content-height">100%</xsl:attribute>
7238
+ </xsl:otherwise>
7239
+ </xsl:choose>
7240
+
7198
7241
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7199
7242
  <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7200
7243
  <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
@@ -9365,14 +9408,16 @@
9365
9408
 
9366
9409
  <xsl:template match="*[local-name() = 'annex']">
9367
9410
  <fo:block break-after="page"/>
9368
- <fo:block id="{@id}">
9411
+ <fo:block>
9369
9412
 
9370
9413
  <xsl:call-template name="setBlockSpanAll"/>
9371
9414
 
9372
9415
  <xsl:call-template name="refine_annex_style"/>
9373
9416
 
9374
9417
  </fo:block>
9375
- <xsl:apply-templates/>
9418
+ <fo:block id="{@id}">
9419
+ <xsl:apply-templates/>
9420
+ </fo:block>
9376
9421
  </xsl:template>
9377
9422
 
9378
9423
  <xsl:template name="refine_annex_style">
@@ -9392,13 +9437,19 @@
9392
9437
  <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9393
9438
  </xsl:when>
9394
9439
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
9395
- <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9440
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9441
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9442
+ </xsl:when>
9443
+ <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9396
9444
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9397
9445
  </xsl:when>
9398
9446
  </xsl:choose>
9399
9447
 
9400
9448
  </xsl:template>
9401
9449
 
9450
+ <!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
9451
+ <xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
9452
+
9402
9453
  <xsl:template match="*[local-name() = 'name']/text()">
9403
9454
  <!-- 0xA0 to space replacement -->
9404
9455
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -11007,7 +11058,7 @@
11007
11058
 
11008
11059
  <xsl:template name="printEdition">
11009
11060
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
11010
- <xsl:text> </xsl:text>
11061
+
11011
11062
  <xsl:choose>
11012
11063
  <xsl:when test="$edition_i18n != ''">
11013
11064
  <!-- Example: <edition language="fr">deuxième édition</edition> -->
@@ -34,6 +34,93 @@ _bib)
34
34
  %w(), doc)
35
35
  end
36
36
 
37
+ def bibdata(docxml)
38
+ super
39
+ dochistory(docxml)
40
+ end
41
+
42
+ UPDATE_RELATIONS = <<~XPATH.freeze
43
+ //bibdata/relation[@type = 'updatedBy' or @type = 'merges' or @type = 'splits' or @type = 'hasDraft']/bibitem
44
+ XPATH
45
+
46
+ def dochistory(docxml)
47
+ updates = docxml.xpath(ns(UPDATE_RELATIONS))
48
+ updates.empty? and return
49
+ pref = preface_insert_point(docxml)
50
+ generate_dochistory(updates, pref)
51
+ end
52
+
53
+ def preface_insert_point(docxml)
54
+ docxml.at(ns("//preface")) || docxml.at(ns("//sections"))
55
+ .add_previous_sibling("<preface> </preface>").first
56
+ end
57
+
58
+ def generate_dochistory(updates, pref)
59
+ ret = updates.map { |u| generate_dochistory_row(u) }.flatten.join("\n")
60
+ pref << <<~XML
61
+ <clause id='_#{UUIDTools::UUID.random_create}'>
62
+ <title>#{@i18n.dochistory}</title>
63
+ <table unnumbered="true"><thead>
64
+ <tr><th>Version Number</th><th>Date</th><th>Author</th><th>Description</th></tr>
65
+ </thead><tbody>
66
+ #{ret}
67
+ </tbody></table></clause>
68
+ XML
69
+ end
70
+
71
+ def generate_dochistory_row(item)
72
+ e = item.at(ns("./edition"))&.text
73
+ date = dochistory_date(item)
74
+ c = dochistory_contributors(item)
75
+ desc = dochistory_description(item)
76
+ "<tr><td>#{e}</td><td>#{date}</td><td>#{c}</td><td>#{desc}</td></tr>"
77
+ end
78
+
79
+ def dochistory_date(item)
80
+ d = item.at(ns("./date[@type = 'updated']")) ||
81
+ item.at(ns("./date[@type = 'published']")) ||
82
+ item.at(ns("./date[@type = 'issued']")) or return ""
83
+ ddMMMyyyy(d.text.strip)
84
+ end
85
+
86
+ def dochistory_contributors(item)
87
+ item.xpath(ns("./contributor")).map do |c|
88
+ dochistory_contributor(c)
89
+ end.join(", ")
90
+ end
91
+
92
+ def dochistory_contributor(contrib)
93
+ ret = contrib.at("./organization/abbreviation") ||
94
+ contrib.at("./organization/subdivision") ||
95
+ contrib.at("./organization/name") ||
96
+ contrib.at("./person/name/abbreviation") ||
97
+ contrib.at("./person/name/completename")
98
+ ret and return ret.text
99
+ format_personalname(contrib)
100
+ end
101
+
102
+ def format_personalname(contrib)
103
+ Relaton::Render::General.new(template: { book: "{{ creatornames }}" })
104
+ .render("<bibitem type='book'>#{contrib.to_xml}</bibitem>")
105
+ end
106
+
107
+ def dochistory_description(item)
108
+ d = item.at(ns("./amend/description")) or return ""
109
+ d.children.to_xml
110
+ end
111
+
112
+ def ddMMMyyyy(isodate)
113
+ isodate.nil? and return nil
114
+ arr = isodate.split("-")
115
+ if arr.size == 1 && (/^\d+$/.match isodate)
116
+ Date.new(*arr.map(&:to_i)).strftime("%Y")
117
+ elsif arr.size == 2
118
+ Date.new(*arr.map(&:to_i)).strftime("%B %Y")
119
+ else
120
+ Date.parse(isodate).strftime("%d %B %Y")
121
+ end
122
+ end
123
+
37
124
  include Init
38
125
  end
39
126
  end
@@ -95,8 +95,89 @@
95
95
  <ref name="pagebreak"/>
96
96
  <ref name="hr"/>
97
97
  <ref name="bookmark"/>
98
+ <ref name="amend"/>
98
99
  </choice>
99
100
  </define>
101
+ <define name="amend">
102
+ <element name="amend">
103
+ <ref name="AmendType"/>
104
+ </element>
105
+ </define>
106
+ <define name="AmendType">
107
+ <optional>
108
+ <attribute name="id">
109
+ <data type="ID"/>
110
+ </attribute>
111
+ </optional>
112
+ <attribute name="change">
113
+ <choice>
114
+ <value>add</value>
115
+ <value>modify</value>
116
+ <value>delete</value>
117
+ <value>replace</value>
118
+ </choice>
119
+ </attribute>
120
+ <optional>
121
+ <attribute name="path"/>
122
+ </optional>
123
+ <optional>
124
+ <attribute name="path_end"/>
125
+ </optional>
126
+ <optional>
127
+ <attribute name="title"/>
128
+ </optional>
129
+ <optional>
130
+ <element name="location">
131
+ <zeroOrMore>
132
+ <choice>
133
+ <ref name="locality"/>
134
+ <ref name="localityStack"/>
135
+ </choice>
136
+ </zeroOrMore>
137
+ </element>
138
+ </optional>
139
+ <optional>
140
+ <element name="description">
141
+ <zeroOrMore>
142
+ <ref name="BasicBlock"/>
143
+ </zeroOrMore>
144
+ </element>
145
+ </optional>
146
+ <optional>
147
+ <element name="newcontent">
148
+ <optional>
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ </optional>
153
+ <zeroOrMore>
154
+ <ref name="BasicBlock"/>
155
+ </zeroOrMore>
156
+ </element>
157
+ </optional>
158
+ <zeroOrMore>
159
+ <ref name="classification"/>
160
+ </zeroOrMore>
161
+ <zeroOrMore>
162
+ <ref name="contributor"/>
163
+ </zeroOrMore>
164
+ </define>
165
+ <define name="classification">
166
+ <element name="classification">
167
+ <ref name="classification_tag"/>
168
+ <ref name="classification_value"/>
169
+ </element>
170
+ </define>
171
+ <define name="classification_tag">
172
+ <element name="tag">
173
+ <text/>
174
+ </element>
175
+ </define>
176
+ <define name="classification_value">
177
+ <element name="value">
178
+ <text/>
179
+ </element>
180
+ </define>
100
181
  <define name="paragraph">
101
182
  <element name="p">
102
183
  <ref name="ParagraphType"/>
@@ -163,6 +244,9 @@
163
244
  <data type="ID"/>
164
245
  </attribute>
165
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
166
250
  <optional>
167
251
  <attribute name="date">
168
252
  <data type="dateTime"/>
@@ -939,18 +1023,12 @@
939
1023
  </optional>
940
1024
  <optional>
941
1025
  <attribute name="width">
942
- <choice>
943
- <data type="int"/>
944
- <value>auto</value>
945
- </choice>
1026
+ <ref name="ImageSize"/>
946
1027
  </attribute>
947
1028
  </optional>
948
1029
  <optional>
949
1030
  <attribute name="height">
950
- <choice>
951
- <data type="int"/>
952
- <value>auto</value>
953
- </choice>
1031
+ <ref name="ImageSize"/>
954
1032
  </attribute>
955
1033
  </optional>
956
1034
  <optional>
@@ -965,6 +1043,14 @@
965
1043
  </attribute>
966
1044
  </optional>
967
1045
  </define>
1046
+ <define name="ImageSize">
1047
+ <choice>
1048
+ <data type="string">
1049
+ <param name="pattern">\d+([.]\d+)?(%?)</param>
1050
+ </data>
1051
+ <value>auto</value>
1052
+ </choice>
1053
+ </define>
968
1054
  <define name="video">
969
1055
  <element name="video">
970
1056
  <attribute name="id">
@@ -9,11 +9,42 @@
9
9
  -->
10
10
  <include href="biblio.rng">
11
11
  <define name="BibData">
12
- <ref name="BibliographicItem"/>
12
+ <ref name="StandardBibliographicItem"/>
13
13
  <optional>
14
14
  <ref name="ext"/>
15
15
  </optional>
16
16
  </define>
17
+ <define name="docrelation">
18
+ <element name="relation">
19
+ <attribute name="type">
20
+ <ref name="DocRelationType"/>
21
+ </attribute>
22
+ <optional>
23
+ <element name="description">
24
+ <ref name="FormattedString"/>
25
+ </element>
26
+ </optional>
27
+ <element name="bibitem">
28
+ <ref name="StandardReducedBibliographicItem"/>
29
+ </element>
30
+ <choice>
31
+ <zeroOrMore>
32
+ <ref name="locality"/>
33
+ </zeroOrMore>
34
+ <zeroOrMore>
35
+ <ref name="localityStack"/>
36
+ </zeroOrMore>
37
+ </choice>
38
+ <choice>
39
+ <zeroOrMore>
40
+ <ref name="sourceLocality"/>
41
+ </zeroOrMore>
42
+ <zeroOrMore>
43
+ <ref name="sourceLocalityStack"/>
44
+ </zeroOrMore>
45
+ </choice>
46
+ </element>
47
+ </define>
17
48
  </include>
18
49
  <define name="ext">
19
50
  <element name="ext">
@@ -161,4 +192,16 @@
161
192
  </optional>
162
193
  </element>
163
194
  </define>
195
+ <define name="StandardBibliographicItem">
196
+ <ref name="BibliographicItem"/>
197
+ <zeroOrMore>
198
+ <ref name="amend"/>
199
+ </zeroOrMore>
200
+ </define>
201
+ <define name="StandardReducedBibliographicItem">
202
+ <ref name="ReducedBibliographicItem"/>
203
+ <zeroOrMore>
204
+ <ref name="amend"/>
205
+ </zeroOrMore>
206
+ </define>
164
207
  </grammar>
@@ -241,6 +241,9 @@
241
241
  </element>
242
242
  </define>
243
243
  <define name="FullNameType">
244
+ <optional>
245
+ <ref name="name_abbreviation"/>
246
+ </optional>
244
247
  <choice>
245
248
  <group>
246
249
  <zeroOrMore>
@@ -266,6 +269,11 @@
266
269
  <ref name="variantname"/>
267
270
  </zeroOrMore>
268
271
  </define>
272
+ <define name="name_abbreviation">
273
+ <element name="abbreviation">
274
+ <ref name="LocalizedString"/>
275
+ </element>
276
+ </define>
269
277
  <define name="prefix">
270
278
  <element name="prefix">
271
279
  <ref name="LocalizedString"/>
@@ -870,6 +878,9 @@
870
878
  <optional>
871
879
  <ref name="validity"/>
872
880
  </optional>
881
+ <optional>
882
+ <ref name="depiction"/>
883
+ </optional>
873
884
  </define>
874
885
  <define name="btitle">
875
886
  <element name="title">
@@ -17,10 +17,19 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.2.9 -->
20
+ <!-- VERSION v1.3.0 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
24
+ <define name="amend">
25
+ <element name="amend">
26
+ <ref name="BlockAttributes"/>
27
+ <ref name="AmendType"/>
28
+ <zeroOrMore>
29
+ <ref name="autonumber"/>
30
+ </zeroOrMore>
31
+ </element>
32
+ </define>
24
33
  <define name="admonition">
25
34
  <element name="admonition">
26
35
  <attribute name="type">
@@ -137,6 +146,9 @@
137
146
  <data type="boolean"/>
138
147
  </attribute>
139
148
  </optional>
149
+ <optional>
150
+ <attribute name="style"/>
151
+ </optional>
140
152
  <oneOrMore>
141
153
  <ref name="PureTextElement"/>
142
154
  </oneOrMore>
@@ -2319,69 +2331,6 @@
2319
2331
  <ref name="CitationType"/>
2320
2332
  </element>
2321
2333
  </define>
2322
- <define name="amend">
2323
- <element name="amend">
2324
- <optional>
2325
- <attribute name="id">
2326
- <data type="ID"/>
2327
- </attribute>
2328
- </optional>
2329
- <attribute name="change">
2330
- <choice>
2331
- <value>add</value>
2332
- <value>modify</value>
2333
- <value>delete</value>
2334
- <value>replace</value>
2335
- </choice>
2336
- </attribute>
2337
- <optional>
2338
- <attribute name="path"/>
2339
- </optional>
2340
- <optional>
2341
- <attribute name="path_end"/>
2342
- </optional>
2343
- <optional>
2344
- <attribute name="title"/>
2345
- </optional>
2346
- <ref name="BlockAttributes"/>
2347
- <optional>
2348
- <element name="location">
2349
- <zeroOrMore>
2350
- <ref name="locality"/>
2351
- </zeroOrMore>
2352
- </element>
2353
- </optional>
2354
- <zeroOrMore>
2355
- <ref name="autonumber"/>
2356
- </zeroOrMore>
2357
- <optional>
2358
- <element name="description">
2359
- <zeroOrMore>
2360
- <ref name="BasicBlock"/>
2361
- </zeroOrMore>
2362
- </element>
2363
- </optional>
2364
- <optional>
2365
- <element name="newcontent">
2366
- <optional>
2367
- <attribute name="id">
2368
- <data type="ID"/>
2369
- </attribute>
2370
- </optional>
2371
- <zeroOrMore>
2372
- <ref name="BasicBlock"/>
2373
- </zeroOrMore>
2374
- </element>
2375
- </optional>
2376
- <optional>
2377
- <element name="description">
2378
- <zeroOrMore>
2379
- <ref name="BasicBlock"/>
2380
- </zeroOrMore>
2381
- </element>
2382
- </optional>
2383
- </element>
2384
- </define>
2385
2334
  <define name="autonumber">
2386
2335
  <element name="autonumber">
2387
2336
  <attribute name="type">
@@ -207,20 +207,4 @@
207
207
  <value>permission</value>
208
208
  </choice>
209
209
  </define>
210
- <define name="classification">
211
- <element name="classification">
212
- <ref name="classification_tag"/>
213
- <ref name="classification_value"/>
214
- </element>
215
- </define>
216
- <define name="classification_tag">
217
- <element name="tag">
218
- <text/>
219
- </element>
220
- </define>
221
- <define name="classification_value">
222
- <element name="value">
223
- <text/>
224
- </element>
225
- </define>
226
210
  </grammar>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.8.7".freeze
3
+ VERSION = "0.9.1".freeze
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
29
29
 
30
- spec.add_dependency "metanorma-generic", "~> 2.5.4"
30
+ spec.add_dependency "metanorma-generic", "~> 2.6.0"
31
31
 
32
32
  spec.add_development_dependency "debug"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.5.4
19
+ version: 2.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.5.4
26
+ version: 2.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement