metanorma-ieee 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/ieee/lists.rb +1 -1
  3. data/lib/html2doc/ieee/notes.rb +1 -1
  4. data/lib/html2doc/ieee.rb +1 -1
  5. data/lib/html2doc/ieee_wp/lists.rb +1 -1
  6. data/lib/html2doc/ieee_wp.rb +1 -1
  7. data/lib/isodoc/ieee/base_convert.rb +1 -1
  8. data/lib/isodoc/ieee/html_convert.rb +1 -1
  9. data/lib/isodoc/ieee/i18n.rb +1 -1
  10. data/lib/isodoc/ieee/ieee.amendment.xsl +85 -22
  11. data/lib/isodoc/ieee/ieee.rb +1 -1
  12. data/lib/isodoc/ieee/ieee.standard.xsl +85 -22
  13. data/lib/isodoc/ieee/ieee_xml_convert.rb +2 -2
  14. data/lib/isodoc/ieee/init.rb +2 -2
  15. data/lib/isodoc/ieee/metadata.rb +1 -1
  16. data/lib/isodoc/ieee/pdf_convert.rb +1 -1
  17. data/lib/isodoc/ieee/presentation_bibdata.rb +1 -1
  18. data/lib/isodoc/ieee/presentation_ref.rb +7 -8
  19. data/lib/isodoc/ieee/presentation_terms.rb +1 -1
  20. data/lib/isodoc/ieee/presentation_xml_convert.rb +1 -1
  21. data/lib/isodoc/ieee/word_authority.rb +1 -1
  22. data/lib/isodoc/ieee/word_cleanup.rb +2 -2
  23. data/lib/isodoc/ieee/word_cleanup_blocks.rb +1 -1
  24. data/lib/isodoc/ieee/word_convert.rb +2 -2
  25. data/lib/isodoc/ieee/word_wp_cleanup.rb +2 -2
  26. data/lib/isodoc/ieee/word_wp_convert.rb +1 -1
  27. data/lib/isodoc/ieee/xref.rb +1 -1
  28. data/lib/isodoc/ieee.rb +1 -1
  29. data/lib/metanorma/ieee/biblio-standoc.rng +13 -0
  30. data/lib/metanorma/ieee/biblio.rng +19 -12
  31. data/lib/metanorma/ieee/cleanup.rb +2 -2
  32. data/lib/metanorma/ieee/cleanup_ref.rb +2 -2
  33. data/lib/metanorma/ieee/converter.rb +7 -7
  34. data/lib/metanorma/ieee/front.rb +1 -1
  35. data/lib/metanorma/ieee/processor.rb +7 -7
  36. data/lib/metanorma/ieee/relaton-ieee.rng +1 -0
  37. data/lib/metanorma/ieee/term_lookup_cleanup.rb +1 -1
  38. data/lib/metanorma/ieee/validate.rb +4 -4
  39. data/lib/metanorma/ieee/validate_section.rb +1 -1
  40. data/lib/metanorma/ieee/validate_style.rb +1 -1
  41. data/lib/metanorma/ieee/version.rb +2 -2
  42. data/lib/metanorma/ieee.rb +1 -1
  43. data/lib/metanorma-ieee.rb +1 -1
  44. data/lib/relaton/render/general.rb +2 -2
  45. data/lib/relaton/render/parse.rb +1 -1
  46. data/metanorma-ieee.gemspec +1 -1
  47. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 867110810ba1b2cdd23be680fbbb4e2e49e93ce46a615d34231af5869f308e87
4
- data.tar.gz: '08d1e99f46b4cc31967854d1df40f2a4a9afec4a23c4ed0a3fc0a9791eae3eea'
3
+ metadata.gz: f5d00bba7b688dd38ac44ed5a74c0d6af83224657024a81246f9039e8097403f
4
+ data.tar.gz: 1c05945009cf1c549c95d300e0699cb88f344dfab9b6c50ebe3cec1a0f6524dc
5
5
  SHA512:
6
- metadata.gz: db8f29c23b5c90f6403b0fb52fe02b5f15cf3dfa926069c1df6006fe826fa62c8ed389e7c99945f718a1ab0151020104a401681aa188bc8008f54d8ba1b09056
7
- data.tar.gz: 8cbef91d2e8134d623b1d516a4997e7981c3c6ea5148b107ed213f739669aacab05d3666464d5eb4ff3de9299a0fa9e041464c5354416a5c0ff525883b2139d7
6
+ metadata.gz: 7d9b2f5e89208ab1dda473cacafda7598f4607be2b634a226a511db6346b69bf258fee280de0c861be07529b16c2a6ef27718f6a947abdc3c63d09cecb34881d
7
+ data.tar.gz: e3df0c93fbe8c325281b29dc378d0b396a7681f789de91315fec689794e40981ee6d1c1e9a21c4b30c545f6f3e0debcea695168dc83230725fbb8b187e41f7a2
@@ -1,5 +1,5 @@
1
1
  class Html2Doc
2
- class IEEE < ::Html2Doc
2
+ class Ieee < ::Html2Doc
3
3
  def style_list(elem, level, liststyle, listnumber)
4
4
  return unless liststyle
5
5
 
@@ -1,5 +1,5 @@
1
1
  class Html2Doc
2
- class IEEE < ::Html2Doc
2
+ class Ieee < ::Html2Doc
3
3
  def process_footnote_texts(docxml, footnotes)
4
4
  body = docxml.at("//body")
5
5
  list = body.add_child("<div style='mso-element:footnote-list'/>")
data/lib/html2doc/ieee.rb CHANGED
@@ -2,6 +2,6 @@ require "html2doc/ieee/notes"
2
2
  require "html2doc/ieee/lists"
3
3
 
4
4
  class Html2Doc
5
- class IEEE
5
+ class Ieee
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  class Html2Doc
2
- class IEEE_WP < ::Html2Doc
2
+ class Ieee_Wp < ::Html2Doc
3
3
  def list2para(list)
4
4
  list.name == "ol" and return super
5
5
  return if list.xpath("./li").empty?
@@ -1,6 +1,6 @@
1
1
  require "html2doc/ieee_wp/lists"
2
2
 
3
3
  class Html2Doc
4
- class IEEE_WP
4
+ class Ieee_Wp
5
5
  end
6
6
  end
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require "fileutils"
3
3
 
4
4
  module IsoDoc
5
- module IEEE
5
+ module Ieee
6
6
  module BaseConvert
7
7
  def clause_attrs(node)
8
8
  { id: node["id"], type: node["type"] }
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require_relative "init"
3
3
 
4
4
  module IsoDoc
5
- module IEEE
5
+ module Ieee
6
6
  class HtmlConvert < IsoDoc::HtmlConvert
7
7
  def initialize(options)
8
8
  @libdir = File.dirname(__FILE__)
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class I18n < IsoDoc::I18n
4
4
  def load_file(fname)
5
5
  f = File.join(File.dirname(__FILE__), fname)
@@ -7214,7 +7214,8 @@
7214
7214
  </xsl:choose>
7215
7215
  </xsl:variable>
7216
7216
  <xsl:variable name="current_fn_number_text">
7217
- <xsl:value-of select="$current_fn_number"/>
7217
+
7218
+ <xsl:value-of select="$current_fn_number"/>
7218
7219
 
7219
7220
  </xsl:variable>
7220
7221
 
@@ -7250,8 +7251,10 @@
7250
7251
 
7251
7252
  <xsl:call-template name="insert_basic_link">
7252
7253
  <xsl:with-param name="element">
7253
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
7254
- <xsl:copy-of select="$current_fn_number_text"/>
7254
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
7255
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
7256
+ <xsl:copy-of select="$current_fn_number_text"/>
7257
+ </fo:inline>
7255
7258
  </fo:basic-link>
7256
7259
  </xsl:with-param>
7257
7260
  </xsl:call-template>
@@ -7532,7 +7535,7 @@
7532
7535
 
7533
7536
  <xsl:call-template name="refine_fn-reference-style"/>
7534
7537
 
7535
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7538
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7536
7539
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7537
7540
  <xsl:attribute name="internal-destination">
7538
7541
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -8530,9 +8533,19 @@
8530
8533
  </fo:inline>
8531
8534
  </xsl:template>
8532
8535
 
8533
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]">
8536
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
8537
+ <xsl:param name="txt"/>
8534
8538
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8535
- <xsl:variable name="text" select="."/>
8539
+ <xsl:variable name="text">
8540
+ <xsl:choose>
8541
+ <xsl:when test="$txt != ''">
8542
+ <xsl:value-of select="$txt"/>
8543
+ </xsl:when>
8544
+ <xsl:otherwise>
8545
+ <xsl:value-of select="."/>
8546
+ </xsl:otherwise>
8547
+ </xsl:choose>
8548
+ </xsl:variable>
8536
8549
  <xsl:variable name="ratio_">
8537
8550
  0.75
8538
8551
  </xsl:variable>
@@ -9980,9 +9993,12 @@
9980
9993
  <xsl:apply-templates/>
9981
9994
  </xsl:when>
9982
9995
  <xsl:otherwise>
9996
+ <xsl:variable name="alt_text">
9997
+ <xsl:call-template name="getAltText"/>
9998
+ </xsl:variable>
9983
9999
  <xsl:call-template name="insert_basic_link">
9984
10000
  <xsl:with-param name="element">
9985
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10001
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
9986
10002
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
9987
10003
  <xsl:attribute name="role">Annot</xsl:attribute>
9988
10004
  </xsl:if>
@@ -10009,6 +10025,14 @@
10009
10025
  </fo:inline>
10010
10026
  </xsl:template> <!-- link -->
10011
10027
 
10028
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getAltText">
10029
+ <xsl:choose>
10030
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
10031
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
10032
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
10033
+ </xsl:choose>
10034
+ </xsl:template>
10035
+
10012
10036
  <!-- ======================== -->
10013
10037
  <!-- Appendix processing -->
10014
10038
  <!-- ======================== -->
@@ -10039,7 +10063,7 @@
10039
10063
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'callout']">
10040
10064
  <xsl:choose>
10041
10065
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
10042
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10066
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10043
10067
  </xsl:choose>
10044
10068
  </xsl:template>
10045
10069
 
@@ -10068,7 +10092,10 @@
10068
10092
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'xref']">
10069
10093
  <xsl:call-template name="insert_basic_link">
10070
10094
  <xsl:with-param name="element">
10071
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
10095
+ <xsl:variable name="alt_text">
10096
+ <xsl:call-template name="getAltText"/>
10097
+ </xsl:variable>
10098
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
10072
10099
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
10073
10100
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10074
10101
  </xsl:if>
@@ -12554,12 +12581,14 @@
12554
12581
 
12555
12582
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
12556
12583
 
12557
- <xsl:variable name="provisional_distance_between_starts">
12584
+ <xsl:variable name="provisional_distance_between_starts_">
12558
12585
  7
12559
12586
  </xsl:variable>
12560
- <xsl:variable name="indent">
12587
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12588
+ <xsl:variable name="indent_">
12561
12589
  0
12562
12590
  </xsl:variable>
12591
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
12563
12592
 
12564
12593
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12565
12594
  <fo:list-item>
@@ -13284,14 +13313,17 @@
13284
13313
  </xsl:when>
13285
13314
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13286
13315
 
13287
- <xsl:variable name="label">
13316
+ <xsl:variable name="type" select="../@type"/>
13288
13317
 
13289
- <xsl:variable name="type" select="../@type"/>
13318
+ <xsl:variable name="label">
13290
13319
 
13291
13320
  <xsl:variable name="style_prefix_">
13292
13321
  <xsl:if test="$type = 'roman'">
13293
13322
  <!-- Example: (i) -->
13294
13323
  </xsl:if>
13324
+ <xsl:if test="$type = 'alphabet'">
13325
+
13326
+ </xsl:if>
13295
13327
  </xsl:variable>
13296
13328
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
13297
13329
 
@@ -13317,13 +13349,15 @@
13317
13349
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
13318
13350
  <xsl:value-of select="$style_prefix"/>
13319
13351
  </xsl:if>
13352
+
13320
13353
  <xsl:value-of select="@label"/>
13354
+
13321
13355
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
13322
13356
  <xsl:value-of select="$style_suffix"/>
13323
13357
  </xsl:if>
13324
13358
  </xsl:variable>
13325
13359
 
13326
- <xsl:value-of select="normalize-space($label)"/>
13360
+ <xsl:value-of select="normalize-space($label)"/>
13327
13361
 
13328
13362
  </xsl:when>
13329
13363
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15672,7 +15706,8 @@
15672
15706
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15673
15707
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15674
15708
  <!-- Todo: need update -->
15675
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15709
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15710
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15676
15711
 
15677
15712
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15678
15713
  <xsl:attribute name="src">
@@ -15693,6 +15728,9 @@
15693
15728
  <xsl:if test="$afrelationship != ''">
15694
15729
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15695
15730
  </xsl:if>
15731
+ <xsl:if test="$volatile != ''">
15732
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15733
+ </xsl:if>
15696
15734
  </pdf:embedded-file>
15697
15735
  </xsl:for-each>
15698
15736
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -15703,14 +15741,18 @@
15703
15741
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15704
15742
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15705
15743
  <!-- Todo: need update -->
15706
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15744
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15745
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15707
15746
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15708
15747
  <xsl:if test="$description != ''">
15709
15748
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15710
15749
  </xsl:if>
15711
15750
  <xsl:if test="$afrelationship != ''">
15712
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15713
- </xsl:if>
15751
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15752
+ </xsl:if>
15753
+ <xsl:if test="$volatile != ''">
15754
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15755
+ </xsl:if>
15714
15756
  </pdf:embedded-file>
15715
15757
  </xsl:for-each>
15716
15758
  </xsl:if>
@@ -15757,10 +15799,31 @@
15757
15799
  <xsl:value-of select="$level_total - 2"/>
15758
15800
  </xsl:when>
15759
15801
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15760
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
15802
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
15803
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
15804
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
15805
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
15806
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
15807
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
15808
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
15809
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
15810
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
15811
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
15812
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
15761
15813
  <xsl:choose>
15762
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15763
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
15814
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
15815
+ <xsl:value-of select="number($curr_clause_depth)"/>
15816
+ </xsl:when>
15817
+ <xsl:otherwise>
15818
+ <xsl:value-of select="$level_total - 2"/>
15819
+ </xsl:otherwise>
15820
+ </xsl:choose>
15821
+ </xsl:when>
15822
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
15823
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15824
+ <xsl:choose>
15825
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
15826
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
15764
15827
  </xsl:when>
15765
15828
  <xsl:otherwise>
15766
15829
  <xsl:value-of select="$level_total - 2"/>
@@ -15768,7 +15831,7 @@
15768
15831
  </xsl:choose>
15769
15832
  </xsl:when>
15770
15833
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15771
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
15834
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15772
15835
  <xsl:choose>
15773
15836
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15774
15837
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -6,6 +6,6 @@ require "isodoc/ieee/word_convert"
6
6
  require "isodoc/ieee/presentation_xml_convert"
7
7
 
8
8
  module IsoDoc
9
- module IEEE
9
+ module Ieee
10
10
  end
11
11
  end
@@ -7214,7 +7214,8 @@
7214
7214
  </xsl:choose>
7215
7215
  </xsl:variable>
7216
7216
  <xsl:variable name="current_fn_number_text">
7217
- <xsl:value-of select="$current_fn_number"/>
7217
+
7218
+ <xsl:value-of select="$current_fn_number"/>
7218
7219
 
7219
7220
  </xsl:variable>
7220
7221
 
@@ -7250,8 +7251,10 @@
7250
7251
 
7251
7252
  <xsl:call-template name="insert_basic_link">
7252
7253
  <xsl:with-param name="element">
7253
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
7254
- <xsl:copy-of select="$current_fn_number_text"/>
7254
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
7255
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
7256
+ <xsl:copy-of select="$current_fn_number_text"/>
7257
+ </fo:inline>
7255
7258
  </fo:basic-link>
7256
7259
  </xsl:with-param>
7257
7260
  </xsl:call-template>
@@ -7532,7 +7535,7 @@
7532
7535
 
7533
7536
  <xsl:call-template name="refine_fn-reference-style"/>
7534
7537
 
7535
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7538
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7536
7539
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7537
7540
  <xsl:attribute name="internal-destination">
7538
7541
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -8530,9 +8533,19 @@
8530
8533
  </fo:inline>
8531
8534
  </xsl:template>
8532
8535
 
8533
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]">
8536
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
8537
+ <xsl:param name="txt"/>
8534
8538
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8535
- <xsl:variable name="text" select="."/>
8539
+ <xsl:variable name="text">
8540
+ <xsl:choose>
8541
+ <xsl:when test="$txt != ''">
8542
+ <xsl:value-of select="$txt"/>
8543
+ </xsl:when>
8544
+ <xsl:otherwise>
8545
+ <xsl:value-of select="."/>
8546
+ </xsl:otherwise>
8547
+ </xsl:choose>
8548
+ </xsl:variable>
8536
8549
  <xsl:variable name="ratio_">
8537
8550
  0.75
8538
8551
  </xsl:variable>
@@ -9980,9 +9993,12 @@
9980
9993
  <xsl:apply-templates/>
9981
9994
  </xsl:when>
9982
9995
  <xsl:otherwise>
9996
+ <xsl:variable name="alt_text">
9997
+ <xsl:call-template name="getAltText"/>
9998
+ </xsl:variable>
9983
9999
  <xsl:call-template name="insert_basic_link">
9984
10000
  <xsl:with-param name="element">
9985
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10001
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
9986
10002
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
9987
10003
  <xsl:attribute name="role">Annot</xsl:attribute>
9988
10004
  </xsl:if>
@@ -10009,6 +10025,14 @@
10009
10025
  </fo:inline>
10010
10026
  </xsl:template> <!-- link -->
10011
10027
 
10028
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getAltText">
10029
+ <xsl:choose>
10030
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
10031
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
10032
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
10033
+ </xsl:choose>
10034
+ </xsl:template>
10035
+
10012
10036
  <!-- ======================== -->
10013
10037
  <!-- Appendix processing -->
10014
10038
  <!-- ======================== -->
@@ -10039,7 +10063,7 @@
10039
10063
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'callout']">
10040
10064
  <xsl:choose>
10041
10065
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
10042
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10066
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10043
10067
  </xsl:choose>
10044
10068
  </xsl:template>
10045
10069
 
@@ -10068,7 +10092,10 @@
10068
10092
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'xref']">
10069
10093
  <xsl:call-template name="insert_basic_link">
10070
10094
  <xsl:with-param name="element">
10071
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
10095
+ <xsl:variable name="alt_text">
10096
+ <xsl:call-template name="getAltText"/>
10097
+ </xsl:variable>
10098
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
10072
10099
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
10073
10100
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10074
10101
  </xsl:if>
@@ -12554,12 +12581,14 @@
12554
12581
 
12555
12582
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
12556
12583
 
12557
- <xsl:variable name="provisional_distance_between_starts">
12584
+ <xsl:variable name="provisional_distance_between_starts_">
12558
12585
  7
12559
12586
  </xsl:variable>
12560
- <xsl:variable name="indent">
12587
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12588
+ <xsl:variable name="indent_">
12561
12589
  0
12562
12590
  </xsl:variable>
12591
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
12563
12592
 
12564
12593
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12565
12594
  <fo:list-item>
@@ -13284,14 +13313,17 @@
13284
13313
  </xsl:when>
13285
13314
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13286
13315
 
13287
- <xsl:variable name="label">
13316
+ <xsl:variable name="type" select="../@type"/>
13288
13317
 
13289
- <xsl:variable name="type" select="../@type"/>
13318
+ <xsl:variable name="label">
13290
13319
 
13291
13320
  <xsl:variable name="style_prefix_">
13292
13321
  <xsl:if test="$type = 'roman'">
13293
13322
  <!-- Example: (i) -->
13294
13323
  </xsl:if>
13324
+ <xsl:if test="$type = 'alphabet'">
13325
+
13326
+ </xsl:if>
13295
13327
  </xsl:variable>
13296
13328
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
13297
13329
 
@@ -13317,13 +13349,15 @@
13317
13349
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
13318
13350
  <xsl:value-of select="$style_prefix"/>
13319
13351
  </xsl:if>
13352
+
13320
13353
  <xsl:value-of select="@label"/>
13354
+
13321
13355
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
13322
13356
  <xsl:value-of select="$style_suffix"/>
13323
13357
  </xsl:if>
13324
13358
  </xsl:variable>
13325
13359
 
13326
- <xsl:value-of select="normalize-space($label)"/>
13360
+ <xsl:value-of select="normalize-space($label)"/>
13327
13361
 
13328
13362
  </xsl:when>
13329
13363
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15672,7 +15706,8 @@
15672
15706
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15673
15707
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15674
15708
  <!-- Todo: need update -->
15675
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15709
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15710
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15676
15711
 
15677
15712
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15678
15713
  <xsl:attribute name="src">
@@ -15693,6 +15728,9 @@
15693
15728
  <xsl:if test="$afrelationship != ''">
15694
15729
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15695
15730
  </xsl:if>
15731
+ <xsl:if test="$volatile != ''">
15732
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15733
+ </xsl:if>
15696
15734
  </pdf:embedded-file>
15697
15735
  </xsl:for-each>
15698
15736
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -15703,14 +15741,18 @@
15703
15741
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15704
15742
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15705
15743
  <!-- Todo: need update -->
15706
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15744
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15745
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15707
15746
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15708
15747
  <xsl:if test="$description != ''">
15709
15748
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15710
15749
  </xsl:if>
15711
15750
  <xsl:if test="$afrelationship != ''">
15712
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15713
- </xsl:if>
15751
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15752
+ </xsl:if>
15753
+ <xsl:if test="$volatile != ''">
15754
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15755
+ </xsl:if>
15714
15756
  </pdf:embedded-file>
15715
15757
  </xsl:for-each>
15716
15758
  </xsl:if>
@@ -15757,10 +15799,31 @@
15757
15799
  <xsl:value-of select="$level_total - 2"/>
15758
15800
  </xsl:when>
15759
15801
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15760
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
15802
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
15803
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
15804
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
15805
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
15806
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
15807
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
15808
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
15809
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
15810
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
15811
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
15812
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
15761
15813
  <xsl:choose>
15762
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15763
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
15814
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
15815
+ <xsl:value-of select="number($curr_clause_depth)"/>
15816
+ </xsl:when>
15817
+ <xsl:otherwise>
15818
+ <xsl:value-of select="$level_total - 2"/>
15819
+ </xsl:otherwise>
15820
+ </xsl:choose>
15821
+ </xsl:when>
15822
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
15823
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15824
+ <xsl:choose>
15825
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
15826
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
15764
15827
  </xsl:when>
15765
15828
  <xsl:otherwise>
15766
15829
  <xsl:value-of select="$level_total - 2"/>
@@ -15768,7 +15831,7 @@
15768
15831
  </xsl:choose>
15769
15832
  </xsl:when>
15770
15833
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15771
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
15834
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15772
15835
  <xsl:choose>
15773
15836
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15774
15837
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -2,8 +2,8 @@ require "isodoc"
2
2
  require "mnconvert"
3
3
 
4
4
  module IsoDoc
5
- module IEEE
6
- class IEEEXMLConvert < IsoDoc::XslfoPdfConvert
5
+ module Ieee
6
+ class IeeeXMLConvert < IsoDoc::XslfoPdfConvert
7
7
  def initialize(options) # rubocop:disable Lint/MissingSuper
8
8
  @libdir = File.dirname(__FILE__)
9
9
  @format = :ieee
@@ -4,7 +4,7 @@ require_relative "xref"
4
4
  require_relative "i18n"
5
5
 
6
6
  module IsoDoc
7
- module IEEE
7
+ module Ieee
8
8
  module Init
9
9
  def metadata_init(lang, script, locale, i18n)
10
10
  @meta = Metadata.new(lang, script, locale, i18n)
@@ -22,7 +22,7 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def bibrenderer
25
- ::Relaton::Render::IEEE::General.new(language: @lang,
25
+ ::Relaton::Render::Ieee::General.new(language: @lang,
26
26
  i18nhash: @i18n.get)
27
27
  end
28
28
 
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require "twitter_cldr"
3
3
 
4
4
  module IsoDoc
5
- module IEEE
5
+ module Ieee
6
6
  class Metadata < IsoDoc::Metadata
7
7
  def initialize(lang, script, i18n, fonts_options = {})
8
8
  super
@@ -2,7 +2,7 @@ require "isodoc"
2
2
  require "fileutils"
3
3
 
4
4
  module IsoDoc
5
- module IEEE
5
+ module Ieee
6
6
  # A {Converter} implementation that generates PDF HTML output, and a
7
7
  # document schema encapsulation of the document for validation
8
8
  class PdfConvert < IsoDoc::XslfoPdfConvert
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
4
  def bibdata_i18n(bib)
5
5
  super
@@ -1,7 +1,7 @@
1
1
  require_relative "../../relaton/render/general"
2
2
 
3
3
  module IsoDoc
4
- module IEEE
4
+ module Ieee
5
5
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
6
6
  # Style manual 19
7
7
  def anchor_linkend(node, linkend)
@@ -76,14 +76,13 @@ module IsoDoc
76
76
  end
77
77
 
78
78
  def creatornames(bibitem)
79
- ::Relaton::Render::IEEE::General
79
+ ::Relaton::Render::Ieee::General
80
80
  .new(language: @lang, i18nhash: @i18n.get,
81
- #template: { (bibitem["type"] || "misc").to_sym =>
82
- #"{{ creatornames }}" },
83
- template: "{{ creatornames }}" ,
84
- extenttemplate: { (bibitem["type"] || "misc").to_sym => "{{page}}"} ,
85
- sizetemplate: { (bibitem["type"] || "misc").to_sym => "{{data}}"} ,
86
- )
81
+ # template: { (bibitem["type"] || "misc").to_sym =>
82
+ # "{{ creatornames }}" },
83
+ template: "{{ creatornames }}",
84
+ extenttemplate: { (bibitem["type"] || "misc").to_sym => "{{page}}" },
85
+ sizetemplate: { (bibitem["type"] || "misc").to_sym => "{{data}}" })
87
86
  .render1(RelatonBib::XMLParser.from_xml(bibitem.to_xml))
88
87
  end
89
88
 
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
4
  def multidef(elem)
5
5
  number_multidef(elem)
@@ -5,7 +5,7 @@ require_relative "presentation_ref"
5
5
  require "isodoc"
6
6
 
7
7
  module IsoDoc
8
- module IEEE
8
+ module Ieee
9
9
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
10
10
  def initialize(options)
11
11
  @hierarchical_assets = options[:hierarchicalassets]
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class WordConvert < IsoDoc::WordConvert
4
4
  def authority_cleanup(docxml)
5
5
  feedback_footnote(docxml)
@@ -1,8 +1,8 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class WordConvert < IsoDoc::WordConvert
4
4
  def toWord(result, filename, dir, header)
5
- ::Html2Doc::IEEE.new(
5
+ ::Html2Doc::Ieee.new(
6
6
  filename: filename,
7
7
  imagedir: @localdir,
8
8
  stylesheet: @wordstylesheet&.path,
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class WordConvert < IsoDoc::WordConvert
4
4
  # STYLE
5
5
  def admonition_cleanup(docxml)
@@ -6,7 +6,7 @@ require_relative "word_authority"
6
6
  require_relative "word_wp_convert"
7
7
 
8
8
  module IsoDoc
9
- module IEEE
9
+ module Ieee
10
10
  class WordConvert < IsoDoc::WordConvert
11
11
  def initialize(options)
12
12
  @libdir = File.dirname(__FILE__)
@@ -15,7 +15,7 @@ module IsoDoc
15
15
  end
16
16
 
17
17
  def init_wp(options)
18
- @wp = ::IsoDoc::IEEE::WordWPConvert.new(options)
18
+ @wp = ::IsoDoc::Ieee::WordWPConvert.new(options)
19
19
  end
20
20
 
21
21
  def convert1(docxml, filename, dir)
@@ -1,5 +1,5 @@
1
1
  module IsoDoc
2
- module IEEE
2
+ module Ieee
3
3
  class WordWPConvert < WordConvert
4
4
  def stylesmap
5
5
  {
@@ -75,7 +75,7 @@ module IsoDoc
75
75
  end
76
76
 
77
77
  def toWord(result, filename, dir, header)
78
- ::Html2Doc::IEEE_WP.new(
78
+ ::Html2Doc::Ieee_Wp.new(
79
79
  filename: filename,
80
80
  imagedir: @localdir,
81
81
  stylesheet: @wordstylesheet&.path,
@@ -1,7 +1,7 @@
1
1
  require_relative "word_wp_cleanup"
2
2
 
3
3
  module IsoDoc
4
- module IEEE
4
+ module Ieee
5
5
  class WordWPConvert < WordConvert
6
6
  def initialize(options)
7
7
  @libdir ||= File.dirname(__FILE__) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor
@@ -1,7 +1,7 @@
1
1
  require "isodoc"
2
2
 
3
3
  module IsoDoc
4
- module IEEE
4
+ module Ieee
5
5
  class Counter < ::IsoDoc::XrefGen::Counter
6
6
  end
7
7
 
data/lib/isodoc/ieee.rb CHANGED
@@ -7,6 +7,6 @@ require "isodoc/ieee/presentation_xml_convert"
7
7
  require "isodoc/ieee/ieee_xml_convert"
8
8
 
9
9
  module IsoDoc
10
- module IEEE
10
+ module Ieee
11
11
  end
12
12
  end
@@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
72
72
  from other documents in the same doctype</a:documentation>
73
73
  </ref>
74
74
  </optional>
75
+ <ref name="flavor">
76
+ <a:documentation>Flavour of Metanorma used to process this document</a:documentation>
77
+ </ref>
75
78
  <optional>
76
79
  <ref name="editorialgroup">
77
80
  <a:documentation>Groups associated with the production of the standards document, typically within
@@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
113
116
  <define name="DocumentSubtype">
114
117
  <text/>
115
118
  </define>
119
+ <define name="flavor">
120
+ <element name="flavor">
121
+ <ref name="MetanormaFlavor"/>
122
+ </element>
123
+ </define>
124
+ <define name="MetanormaFlavor">
125
+ <a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
126
+ However we prefer not to hardcode it, given ongoing extension.</a:documentation>
127
+ <text/>
128
+ </define>
116
129
  <define name="editorialgroup">
117
130
  <a:documentation>A group associated with the production of the standards document, typically within
118
131
  a standards definition organization</a:documentation>
@@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is
1382
1382
  <define name="bdate">
1383
1383
  <a:documentation>Significant date in the lifecycle of the bibliographic item, including its production and its access</a:documentation>
1384
1384
  <element name="date">
1385
- <attribute name="type">
1386
- <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1387
- <choice>
1388
- <ref name="BibliographicDateType"/>
1389
- <text/>
1390
- </choice>
1391
- </attribute>
1392
- <optional>
1393
- <attribute name="text">
1394
- <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1395
- </attribute>
1396
- </optional>
1385
+ <ref name="bDateAttributes"/>
1397
1386
  <optional>
1398
1387
  <choice>
1399
1388
  <group>
@@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is
1416
1405
  </optional>
1417
1406
  </element>
1418
1407
  </define>
1408
+ <define name="bDateAttributes">
1409
+ <attribute name="type">
1410
+ <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1411
+ <choice>
1412
+ <ref name="BibliographicDateType"/>
1413
+ <text/>
1414
+ </choice>
1415
+ </attribute>
1416
+ <optional>
1417
+ <attribute name="text">
1418
+ <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1419
+ </attribute>
1420
+ </optional>
1421
+ </define>
1419
1422
  <define name="docidentifier">
1420
1423
  <a:documentation>An identifier of a bibliographic item in an international standard scheme</a:documentation>
1421
1424
  <element name="docidentifier">
@@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1884
1887
  <value>hasAnnotation</value>
1885
1888
  <value>draftOf</value>
1886
1889
  <value>hasDraft</value>
1890
+ <value>preliminaryDraftOf</value>
1891
+ <value>hasPreliminaryDraft</value>
1892
+ <value>revisionDraftOf</value>
1893
+ <value>hasRevisionDraft</value>
1887
1894
  <value>editionOf</value>
1888
1895
  <value>hasEdition</value>
1889
1896
  <value>updates</value>
@@ -2,7 +2,7 @@ require_relative "cleanup_ref"
2
2
  require_relative "term_lookup_cleanup"
3
3
 
4
4
  module Metanorma
5
- module IEEE
5
+ module Ieee
6
6
  class Converter < Standoc::Converter
7
7
  def initial_boilerplate(xml, isodoc)
8
8
  intro_boilerplate(xml, isodoc)
@@ -130,7 +130,7 @@ module Metanorma
130
130
  def term_defs_boilerplate_cont(src, term, isodoc); end
131
131
 
132
132
  def termlookup_cleanup(xmldoc)
133
- Metanorma::IEEE::TermLookupCleanup.new(xmldoc, @log).call
133
+ Metanorma::Ieee::TermLookupCleanup.new(xmldoc, @log).call
134
134
  end
135
135
 
136
136
  def boilerplate_isodoc(xmldoc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
- module IEEE
2
+ module Ieee
3
3
  class Converter < Standoc::Converter
4
4
  BIBLIO =
5
5
  "//bibliography/references[@normative = 'false'][not(@hidden)] | " \
@@ -20,7 +20,7 @@ module Metanorma
20
20
  end
21
21
 
22
22
  def sort_biblio(bib)
23
- @i = IsoDoc::IEEE::PresentationXMLConvert
23
+ @i = IsoDoc::Ieee::PresentationXMLConvert
24
24
  .new({ lang: @lang, script: @script, locale: @locale })
25
25
  @i.i18n_init(@lang, @script, @locale)
26
26
  sort_keys = bib.each_with_object({}) do |b, m|
@@ -7,7 +7,7 @@ require_relative "cleanup"
7
7
  require_relative "validate"
8
8
 
9
9
  module Metanorma
10
- module IEEE
10
+ module Ieee
11
11
  class Converter < Standoc::Converter
12
12
  XML_ROOT_TAG = "ieee-standard".freeze
13
13
  XML_NAMESPACE = "https://www.metanorma.org/ns/ieee".freeze
@@ -81,29 +81,29 @@ module Metanorma
81
81
  end
82
82
 
83
83
  def presentation_xml_converter(node)
84
- IsoDoc::IEEE::PresentationXMLConvert
84
+ IsoDoc::Ieee::PresentationXMLConvert
85
85
  .new(html_extract_attributes(node)
86
- .merge(output_formats: ::Metanorma::IEEE::Processor.new.output_formats))
86
+ .merge(output_formats: ::Metanorma::Ieee::Processor.new.output_formats))
87
87
  end
88
88
 
89
89
  def html_converter(node)
90
- IsoDoc::IEEE::HtmlConvert.new(html_extract_attributes(node))
90
+ IsoDoc::Ieee::HtmlConvert.new(html_extract_attributes(node))
91
91
  end
92
92
 
93
93
  def pdf_converter(node)
94
94
  return nil if node.attr("no-pdf")
95
95
 
96
- IsoDoc::IEEE::PdfConvert.new(pdf_extract_attributes(node))
96
+ IsoDoc::Ieee::PdfConvert.new(pdf_extract_attributes(node))
97
97
  end
98
98
 
99
99
  def doc_converter(node)
100
- IsoDoc::IEEE::WordConvert.new(doc_extract_attributes(node))
100
+ IsoDoc::Ieee::WordConvert.new(doc_extract_attributes(node))
101
101
  end
102
102
 
103
103
  def ieee_xml_converter(node)
104
104
  return nil if node.attr("no-pdf")
105
105
 
106
- IsoDoc::Iso::IEEEXMLConvert.new(html_extract_attributes(node))
106
+ IsoDoc::Iso::IeeeXMLConvert.new(html_extract_attributes(node))
107
107
  end
108
108
  end
109
109
  end
@@ -2,7 +2,7 @@ require "isoics"
2
2
  require "pubid-ieee"
3
3
 
4
4
  module Metanorma
5
- module IEEE
5
+ module Ieee
6
6
  class Converter < Standoc::Converter
7
7
  def metadata_committee(node, xml)
8
8
  metadata_committee_prep(node) or return
@@ -1,7 +1,7 @@
1
1
  require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
- module IEEE
4
+ module Ieee
5
5
  class Processor < Metanorma::Processor
6
6
  def initialize
7
7
  @short = :ieee
@@ -30,27 +30,27 @@ module Metanorma
30
30
  end
31
31
 
32
32
  def version
33
- "Metanorma::IEEE #{Metanorma::IEEE::VERSION}"
33
+ "Metanorma::Ieee #{Metanorma::Ieee::VERSION}"
34
34
  end
35
35
 
36
36
  def output(isodoc_node, inname, outname, format, options = {})
37
37
  options_preprocess(options)
38
38
  case format
39
39
  when :html
40
- IsoDoc::IEEE::HtmlConvert.new(options).convert(inname, isodoc_node,
40
+ IsoDoc::Ieee::HtmlConvert.new(options).convert(inname, isodoc_node,
41
41
  nil, outname)
42
42
  when :doc
43
- IsoDoc::IEEE::WordConvert.new(options).convert(inname, isodoc_node,
43
+ IsoDoc::Ieee::WordConvert.new(options).convert(inname, isodoc_node,
44
44
  nil, outname)
45
45
  when :pdf
46
- IsoDoc::IEEE::PdfConvert.new(options).convert(inname, isodoc_node,
46
+ IsoDoc::Ieee::PdfConvert.new(options).convert(inname, isodoc_node,
47
47
  nil, outname)
48
48
  when :presentation
49
- IsoDoc::IEEE::PresentationXMLConvert.new(options).convert(
49
+ IsoDoc::Ieee::PresentationXMLConvert.new(options).convert(
50
50
  inname, isodoc_node, nil, outname
51
51
  )
52
52
  when :ieee
53
- IsoDoc::IEEE::IEEEXMLConvert.new(options)
53
+ IsoDoc::Ieee::IeeeXMLConvert.new(options)
54
54
  .convert(inname, isodoc_node, nil, outname)
55
55
  else
56
56
  super
@@ -54,6 +54,7 @@
54
54
  <optional>
55
55
  <ref name="docsubtype"/>
56
56
  </optional>
57
+ <ref name="flavor"/>
57
58
  <optional>
58
59
  <ref name="trialuse"/>
59
60
  </optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
- module IEEE
2
+ module Ieee
3
3
  class TermLookupCleanup < Metanorma::Standoc::TermLookupCleanup
4
4
  def remove_missing_ref_term(node, _target, type)
5
5
  type == "symbol" and return super
@@ -2,7 +2,7 @@ require_relative "validate_section"
2
2
  require_relative "validate_style"
3
3
 
4
4
  module Metanorma
5
- module IEEE
5
+ module Ieee
6
6
  class Converter < Standoc::Converter
7
7
  def validate(doc)
8
8
  content_validate(doc)
@@ -127,9 +127,9 @@ module Metanorma
127
127
  end
128
128
 
129
129
  def xrefs(xmldoc)
130
- klass = IsoDoc::IEEE::HtmlConvert.new(language: @lang, script: @script)
131
- xrefs = IsoDoc::IEEE::Xref
132
- .new(@lang, @script, klass, IsoDoc::IEEE::I18n.new(@lang, @script),
130
+ klass = IsoDoc::Ieee::HtmlConvert.new(language: @lang, script: @script)
131
+ xrefs = IsoDoc::Ieee::Xref
132
+ .new(@lang, @script, klass, IsoDoc::Ieee::I18n.new(@lang, @script),
133
133
  { hierarchicalassets: @hierarchical_assets })
134
134
  # don't process refs without relaton-render init
135
135
  xrefs.parse_inclusions(clauses: true, assets: true)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
- module IEEE
2
+ module Ieee
3
3
  class Converter < Standoc::Converter
4
4
  def section_validate(doc)
5
5
  unless %w(amendment technical-corrigendum).include? @doctype
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
- module IEEE
2
+ module Ieee
3
3
  class Converter < Standoc::Converter
4
4
  ASSETS_TO_STYLE =
5
5
  "//termsource | //formula | //termnote | " \
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
- module IEEE
3
- VERSION = "1.3.1".freeze
2
+ module Ieee
3
+ VERSION = "1.3.2".freeze
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ require "metanorma/ieee/processor"
3
3
  require "metanorma/ieee/converter"
4
4
 
5
5
  module Metanorma
6
- module IEEE
6
+ module Ieee
7
7
  ORGANIZATION_NAME_SHORT = "IEEE"
8
8
  ORGANIZATION_NAME_LONG = "Institute of Electrical and Electronics Engineers"
9
9
  end
@@ -6,5 +6,5 @@ require "html2doc/ieee_wp"
6
6
  require "metanorma"
7
7
 
8
8
  if defined? Metanorma::Registry
9
- Metanorma::Registry.instance.register(Metanorma::IEEE::Processor)
9
+ Metanorma::Registry.instance.register(Metanorma::Ieee::Processor)
10
10
  end
@@ -3,7 +3,7 @@ require_relative "parse"
3
3
 
4
4
  module Relaton
5
5
  module Render
6
- module IEEE
6
+ module Ieee
7
7
  class General < ::Relaton::Render::IsoDoc::General
8
8
  def config_loc
9
9
  YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
@@ -11,7 +11,7 @@ module Relaton
11
11
 
12
12
  def klass_initialize(_options)
13
13
  super
14
- @parseklass = Relaton::Render::IEEE::Parse
14
+ @parseklass = Relaton::Render::Ieee::Parse
15
15
  end
16
16
  end
17
17
  end
@@ -1,6 +1,6 @@
1
1
  module Relaton
2
2
  module Render
3
- module IEEE
3
+ module Ieee
4
4
  class Parse < ::Relaton::Render::Parse
5
5
  def simple_or_host_xml2hash(doc, host)
6
6
  ret = super
@@ -4,7 +4,7 @@ require "metanorma/ieee/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "metanorma-ieee"
7
- spec.version = Metanorma::IEEE::VERSION
7
+ spec.version = Metanorma::Ieee::VERSION
8
8
  spec.authors = ["Ribose Inc."]
9
9
  spec.email = ["open.source@ribose.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc