metanorma-jis 0.5.6 → 0.5.9

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.
@@ -2,24 +2,19 @@ module IsoDoc
2
2
  module Jis
3
3
  class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
4
4
  def ol_depth(node)
5
- depth == 1 and return :alphabet
6
- :arabic
5
+ depth = node.ancestors("ol").size + 1
6
+ @counter.ol_type(node, depth) # defined in Xref::Counter
7
7
  end
8
8
 
9
- def ol_depth(node)
10
- depth = node.ancestors("ol").size + 1
11
- @counter.ol_type(node, depth) # defined in Xref::Counter
12
- end
13
-
14
- def ul_label_list(_elem)
15
- %w(&#xFF0D; &#x30FB;)
16
- end
9
+ def ul_label_list(_elem)
10
+ %w(&#xFF0D; &#x30FB;)
11
+ end
17
12
 
18
- def ul_label_value(elem)
19
- depth = elem.ancestors("ul").size
20
- val = ul_label_list(elem)
21
- val[(depth - 1) % val.size]
22
- end
13
+ def ul_label_value(elem)
14
+ depth = elem.ancestors("ul").size
15
+ val = ul_label_list(elem)
16
+ val[(depth - 1) % val.size]
17
+ end
23
18
 
24
19
  # TODO: move the table/figure key processing to Word, not Presentation XML
25
20
  def dl(docxml)
@@ -82,10 +82,10 @@ module IsoDoc
82
82
  s, t, y, d = participant_table_prep(clause)
83
83
  s or return nil
84
84
  out1 = <<~OUTPUT
85
- <clause id='_#{UUIDTools::UUID.random_create}' type="participants"><title>#{t}</title>
86
- <table unnumbered='true'>
85
+ <clause #{add_id_text} type="participants"><title>#{t}</title>
86
+ <table #{add_id_text} unnumbered='true'>
87
87
  <thead>
88
- <tr><th/><th>#{@i18n.full_name}</th><th>#{@i18n.affiliation}</th></tr>
88
+ <tr #{add_id_text}><th #{add_id_text}/><th #{add_id_text}>#{@i18n.full_name}</th><th #{add_id_text}>#{@i18n.affiliation}</th></tr>
89
89
  </thead>
90
90
  <tbody>
91
91
  OUTPUT
@@ -110,11 +110,12 @@ module IsoDoc
110
110
  r = y["role"] ? @i18n.l10n("(#{y['role']})") : ""
111
111
  n = y["name"]
112
112
  if n.is_a?(Hash)
113
- n =
114
- if @lang == "ja" then "#{n['surname']} #{n['givenname']}"
115
- else "#{n['givenname']} #{n['surname']}" end
113
+ n = if @lang == "ja" then "#{n['surname']} #{n['givenname']}"
114
+ else "#{n['givenname']} #{n['surname']}" end
116
115
  end
117
- "<tr><td>#{r}</rd><td>#{n}</td><td>#{y['affiliation']}</td></tr>"
116
+ <<~XML
117
+ <tr #{add_id_text}><td #{add_id_text}>#{r}</td><td #{add_id_text}>#{n}</td><td #{add_id_text}>#{y['affiliation']}</td></tr>
118
+ XML
118
119
  end.join("\n")
119
120
  end
120
121
 
@@ -75,29 +75,15 @@ module IsoDoc
75
75
  end
76
76
 
77
77
  def full_row(cols, elem)
78
- "<tr><td border='0' colspan='#{cols}'>#{elem}</td></tr>"
79
- end
80
-
81
- # KILL
82
- def tablesourcex(elem)
83
- ret = [semx_fmt_dup(elem)]
84
- n = elem
85
- while n = n&.next_element
86
- case n.name
87
- when "source"
88
- when "fmt-source"
89
- ret << to_xml(n.remove.children)
90
- else break
91
- end
92
- end
93
- s = ret.map(&:strip).join("; ")
94
- tablesource_label(elem, s)
78
+ <<~XML
79
+ <tr #{add_id_text}><td #{add_id_text} border='0' colspan='#{cols}'>#{elem}</td></tr>
80
+ XML
95
81
  end
96
82
 
97
83
  def source1_label(elem, sources, ancestor)
98
84
  case ancestor
99
85
  when :table
100
- elem.children = l10n("#{@i18n.source}: #{sources}")
86
+ elem.children = l10n("#{@i18n.source}: #{sources}")
101
87
  else super
102
88
  end
103
89
  end
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <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">
3
- <!-- VERSION v2.0.5 -->
3
+ <!-- VERSION v2.0.7 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -76,6 +76,7 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
76
76
  <a:documentation>Title(s) of a clause</a:documentation>
77
77
  <element name="title">
78
78
  <a:documentation>Title proper for a clause</a:documentation>
79
+ <ref name="RequiredId"/>
79
80
  <zeroOrMore>
80
81
  <ref name="TextElement"/>
81
82
  </zeroOrMore>
@@ -83,10 +84,19 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
83
84
  <zeroOrMore>
84
85
  <element name="variant-title">
85
86
  <a:documentation>Alternate title for a clause</a:documentation>
87
+ <ref name="RequiredId"/>
86
88
  <ref name="TypedTitleString"/>
87
89
  </element>
88
90
  </zeroOrMore>
89
91
  </define>
92
+ <define name="tname">
93
+ <element name="name">
94
+ <ref name="RequiredId"/>
95
+ <oneOrMore>
96
+ <ref name="NestedTextElement"/>
97
+ </oneOrMore>
98
+ </element>
99
+ </define>
90
100
  <define name="UlBody">
91
101
  <optional>
92
102
  <ref name="tname">
@@ -475,6 +485,7 @@ normative or informative references, some split references into sections organiz
475
485
  <!-- exclude figures? -->
476
486
  <define name="dd">
477
487
  <element name="dd">
488
+ <ref name="OptionalId"/>
478
489
  <zeroOrMore>
479
490
  <!-- exclude figures? -->
480
491
  <ref name="BasicBlock"/>
@@ -526,6 +537,7 @@ normative or informative references, some split references into sections organiz
526
537
  </choice>
527
538
  </define>
528
539
  <define name="TrAttributes">
540
+ <ref name="OptionalId"/>
529
541
  <optional>
530
542
  <attribute name="style">
531
543
  <a:documentation>CSS style: only background-color supported</a:documentation>
@@ -595,6 +607,7 @@ gives an explicit page orientation</a:documentation>
595
607
  </include>
596
608
  <!-- end overrides -->
597
609
  <define name="FnAttributes" combine="interleave">
610
+ <ref name="RequiredId"/>
598
611
  <optional>
599
612
  <attribute name="hiddenref">
600
613
  <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
@@ -604,6 +617,7 @@ This is done if the footnote reference is already presented in some other form,
604
617
  </optional>
605
618
  </define>
606
619
  <define name="TdAttributes" combine="interleave">
620
+ <ref name="RequiredId"/>
607
621
  <optional>
608
622
  <attribute name="style">
609
623
  <a:documentation>CSS style: only background-color supported</a:documentation>
@@ -801,6 +815,12 @@ titlecase, or lowercase</a:documentation>
801
815
  <a:documentation>User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
802
816
  </attribute>
803
817
  </optional>
818
+ <optional>
819
+ <attribute name="source">
820
+ <a:documentation>Sourcing of the current element in an external data model</a:documentation>
821
+ <ref name="IdRefType"/>
822
+ </attribute>
823
+ </optional>
804
824
  </define>
805
825
  <define name="OptionalId" combine="interleave">
806
826
  <optional>
@@ -808,6 +828,12 @@ titlecase, or lowercase</a:documentation>
808
828
  <a:documentation> User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
809
829
  </attribute>
810
830
  </optional>
831
+ <optional>
832
+ <attribute name="source">
833
+ <a:documentation>Sourcing of the current element in an external data model</a:documentation>
834
+ <ref name="IdRefType"/>
835
+ </attribute>
836
+ </optional>
811
837
  </define>
812
838
  <define name="ObligationType">
813
839
  <a:documentation>The force of a clause in a standard document: whether it has normative or informative effect</a:documentation>
@@ -954,6 +980,7 @@ titlecase, or lowercase</a:documentation>
954
980
  is used in particular to capture mutually agreed definitions of codepoints in Unicode Private Use Area</a:documentation>
955
981
  </attribute>
956
982
  </optional>
983
+ <ref name="OptionalId"/>
957
984
  <oneOrMore>
958
985
  <ref name="TextElement">
959
986
  <a:documentation>Textual content of span</a:documentation>
@@ -1808,7 +1835,7 @@ used in document amendments</a:documentation>
1808
1835
  </element>
1809
1836
  </define>
1810
1837
  <define name="TermAttributes">
1811
- <ref name="OptionalId"/>
1838
+ <ref name="RequiredId"/>
1812
1839
  <ref name="LocalizedStringAttributes"/>
1813
1840
  <ref name="BlockAttributes"/>
1814
1841
  </define>
@@ -2151,6 +2178,7 @@ used in document amendments</a:documentation>
2151
2178
  <define name="termdefinition">
2152
2179
  <a:documentation>The definition of a term applied in the current document</a:documentation>
2153
2180
  <element name="definition">
2181
+ <ref name="RequiredId"/>
2154
2182
  <optional>
2155
2183
  <attribute name="type">
2156
2184
  <a:documentation>Type of definition, used to differentiate it from other definitions of the same term if present</a:documentation>
@@ -2172,6 +2200,7 @@ used in document amendments</a:documentation>
2172
2200
  </define>
2173
2201
  <define name="verbaldefinition">
2174
2202
  <element name="verbal-definition">
2203
+ <ref name="RequiredId"/>
2175
2204
  <oneOrMore>
2176
2205
  <choice>
2177
2206
  <a:documentation>Content of the verbal representation of the term</a:documentation>
@@ -2192,6 +2221,7 @@ used in document amendments</a:documentation>
2192
2221
  <define name="nonverbalrep">
2193
2222
  <a:documentation>Non-verbal representation of the term</a:documentation>
2194
2223
  <element name="non-verbal-representation">
2224
+ <ref name="RequiredId"/>
2195
2225
  <oneOrMore>
2196
2226
  <choice>
2197
2227
  <a:documentation>Content of the non-verbal representation of the term</a:documentation>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Jis
3
- VERSION = "0.5.6".freeze
3
+ VERSION = "0.5.9".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-12 00:00:00.000000000 Z
11
+ date: 2025-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar