metanorma-un 0.8.8 → 0.9.2

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.
@@ -16,19 +16,25 @@ module IsoDoc
16
16
 
17
17
  def default_fonts(options)
18
18
  {
19
- bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' :
20
- '"Times New Roman",serif'),
21
- headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
22
- '"Times New Roman",serif'),
23
- monospacefont: '"Courier New",monospace',
24
- normalfontsize: "10.5pt",
25
- monospacefontsize: "10.0pt",
26
- smallerfontsize: "10.0pt",
27
- footnotefontsize: "9.0pt",
19
+ bodyfont: (if options[:script] == "Hans"
20
+ '"Source Han Sans",serif'
21
+ else
22
+ '"Times New Roman",serif'
23
+ end),
24
+ headerfont: (if options[:script] == "Hans"
25
+ '"Source Han Sans",sans-serif'
26
+ else
27
+ '"Times New Roman",serif'
28
+ end),
29
+ monospacefont: '"Courier New",monospace',
30
+ normalfontsize: "10.5pt",
31
+ monospacefontsize: "10.0pt",
32
+ smallerfontsize: "10.0pt",
33
+ footnotefontsize: "9.0pt",
28
34
  }
29
35
  end
30
36
 
31
- def default_file_locations(options)
37
+ def default_file_locations(_options)
32
38
  {
33
39
  wordstylesheet: html_doc_path("wordstyle.scss"),
34
40
  standardstylesheet: html_doc_path("unece.scss"),
@@ -40,11 +46,11 @@ module IsoDoc
40
46
  }
41
47
  end
42
48
 
43
- def footnotes(div)
49
+ def footnotes(_div)
44
50
  if @meta.get[:item_footnote]
45
51
  fn = noko do |xml|
46
- xml.aside **{ id: "ftnitem" } do |div|
47
- div.p @meta.get[:item_footnote]
52
+ xml.aside **{ id: "ftnitem" } do |d|
53
+ d.p @meta.get[:item_footnote]
48
54
  end
49
55
  end.join("\n")
50
56
  @footnotes.unshift fn
@@ -77,18 +83,18 @@ module IsoDoc
77
83
  introduction docxml, div2
78
84
  preface docxml, div2
79
85
  acknowledgements docxml, div2
80
- div2.p { |p| p << "&nbsp;" } # placeholder
86
+ div2.p { |p| p << "&#xa0;" } # placeholder
81
87
  end
82
88
  section_break(body)
83
89
  end
84
90
 
85
91
  ENDLINE = <<~END.freeze
86
- <v:line
87
- alt="" style='position:absolute;left:0;text-align:left;z-index:251662848;
88
- mso-wrap-edited:f;mso-width-percent:0;mso-height-percent:0;
89
- mso-width-percent:0;mso-height-percent:0'
90
- from="6.375cm,20.95pt" to="10.625cm,20.95pt"
91
- strokeweight="1.5pt"/>
92
+ <v:line
93
+ alt="" style='position:absolute;left:0;text-align:left;z-index:251662848;
94
+ mso-wrap-edited:f;mso-width-percent:0;mso-height-percent:0;
95
+ mso-width-percent:0;mso-height-percent:0'
96
+ from="6.375cm,20.95pt" to="10.625cm,20.95pt"
97
+ strokeweight="1.5pt"/>
92
98
  END
93
99
 
94
100
  def end_line(_isoxml, out)
@@ -138,7 +144,7 @@ module IsoDoc
138
144
  abstract.parent = (abstractbox || preface_container) if abstract &&
139
145
  (abstractbox || preface_container)
140
146
  abstractbox and abstract&.xpath(".//p/br")&.each do |a|
141
- a.parent.remove if /page-break-before:always/.match(a["style"])
147
+ a.parent.remove if /page-break-before:always/.match?(a["style"])
142
148
  end
143
149
  docxml&.at("//p[@class = 'AbstractTitle']")&.remove if abstractbox
144
150
  foreword.parent = preface_container if foreword && preface_container
@@ -4,21 +4,25 @@ module IsoDoc
4
4
  module UN
5
5
  class Xref < IsoDoc::Xref
6
6
  def initial_anchor_names(doc)
7
- preface_names(doc.at(ns("//preface/abstract")))
8
- preface_names(doc.at(ns("//foreword")))
9
- preface_names(doc.at(ns("//introduction")))
10
- doc.xpath(ns("//preface/clause")).each do |c|
11
- preface_names(c)
7
+ if @parse_settings.empty? || @parse_settings[:clauses]
8
+ preface_names(doc.at(ns("//preface/abstract")))
9
+ preface_names(doc.at(ns("//foreword")))
10
+ preface_names(doc.at(ns("//introduction")))
11
+ doc.xpath(ns("//preface/clause")).each do |c|
12
+ preface_names(c)
13
+ end
14
+ preface_names(doc.at(ns("//acknowledgements")))
15
+ clause_names(doc, 0)
16
+ end
17
+ if @parse_settings.empty?
18
+ sequential_asset_names(
19
+ doc.xpath(ns("//preface/abstract | //foreword | //introduction | "\
20
+ "//preface/clause | //acknowledgements")),
21
+ )
22
+ middle_section_asset_names(doc)
23
+ termnote_anchor_names(doc)
24
+ termexample_anchor_names(doc)
12
25
  end
13
- preface_names(doc.at(ns("//acknowledgements")))
14
- sequential_asset_names(
15
- doc.xpath(ns("//preface/abstract | //foreword | //introduction | "\
16
- "//preface/clause | //acknowledgements")),
17
- )
18
- middle_section_asset_names(doc)
19
- clause_names(doc, 0)
20
- termnote_anchor_names(doc)
21
- termexample_anchor_names(doc)
22
26
  end
23
27
 
24
28
  def clause_names(docxml, _sect_num)
@@ -122,8 +126,9 @@ module IsoDoc
122
126
  leaf_section?(clause) and
123
127
  label_annex_leaf_section(clause, num, 1) and return
124
128
  @anchors[clause["id"]] = annex_name_anchors(clause, num)
125
- if a = single_annex_special_section(clause)
126
- annex_names1(a, num.to_s, 1)
129
+ if @klass.single_term_clause?(clause)
130
+ annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
131
+ num.to_s, 1)
127
132
  else
128
133
  i = 1
129
134
  clause.xpath(ns(SUBCLAUSES)).each do |c|
@@ -614,12 +614,12 @@
614
614
  <optional>
615
615
  <ref name="fetched"/>
616
616
  </optional>
617
- <choice>
618
- <oneOrMore>
619
- <ref name="btitle"/>
620
- </oneOrMore>
617
+ <optional>
621
618
  <ref name="formattedref"/>
622
- </choice>
619
+ </optional>
620
+ <oneOrMore>
621
+ <ref name="btitle"/>
622
+ </oneOrMore>
623
623
  <zeroOrMore>
624
624
  <ref name="bsource"/>
625
625
  </zeroOrMore>
@@ -851,17 +851,46 @@
851
851
  </define>
852
852
  <define name="bplace">
853
853
  <element name="place">
854
- <optional>
855
- <attribute name="uri">
856
- <data type="anyURI"/>
857
- </attribute>
858
- </optional>
859
- <optional>
860
- <attribute name="region"/>
861
- </optional>
854
+ <choice>
855
+ <text/>
856
+ <group>
857
+ <ref name="bibliocity"/>
858
+ <zeroOrMore>
859
+ <ref name="biblioregion"/>
860
+ </zeroOrMore>
861
+ <zeroOrMore>
862
+ <ref name="bibliocountry"/>
863
+ </zeroOrMore>
864
+ </group>
865
+ </choice>
866
+ </element>
867
+ </define>
868
+ <define name="bibliocity">
869
+ <element name="city">
862
870
  <text/>
863
871
  </element>
864
872
  </define>
873
+ <define name="biblioregion">
874
+ <element name="region">
875
+ <ref name="RegionType"/>
876
+ </element>
877
+ </define>
878
+ <define name="bibliocountry">
879
+ <element name="country">
880
+ <ref name="RegionType"/>
881
+ </element>
882
+ </define>
883
+ <define name="RegionType">
884
+ <optional>
885
+ <attribute name="iso"/>
886
+ </optional>
887
+ <optional>
888
+ <attribute name="recommended">
889
+ <data type="boolean"/>
890
+ </attribute>
891
+ </optional>
892
+ <text/>
893
+ </define>
865
894
  <define name="bprice">
866
895
  <element name="price">
867
896
  <attribute name="currency"/>
@@ -957,36 +986,34 @@
957
986
  <ref name="SeriesType"/>
958
987
  </attribute>
959
988
  </optional>
960
- <choice>
989
+ <optional>
961
990
  <ref name="formattedref"/>
962
- <group>
963
- <ref name="btitle"/>
964
- <optional>
965
- <ref name="bplace"/>
966
- </optional>
967
- <optional>
968
- <ref name="seriesorganization"/>
969
- </optional>
970
- <optional>
971
- <ref name="abbreviation"/>
972
- </optional>
973
- <optional>
974
- <ref name="seriesfrom"/>
975
- </optional>
976
- <optional>
977
- <ref name="seriesto"/>
978
- </optional>
979
- <optional>
980
- <ref name="seriesnumber"/>
981
- </optional>
982
- <optional>
983
- <ref name="seriespartnumber"/>
984
- </optional>
985
- <optional>
986
- <ref name="seriesrun"/>
987
- </optional>
988
- </group>
989
- </choice>
991
+ </optional>
992
+ <ref name="btitle"/>
993
+ <optional>
994
+ <ref name="bplace"/>
995
+ </optional>
996
+ <optional>
997
+ <ref name="seriesorganization"/>
998
+ </optional>
999
+ <optional>
1000
+ <ref name="abbreviation"/>
1001
+ </optional>
1002
+ <optional>
1003
+ <ref name="seriesfrom"/>
1004
+ </optional>
1005
+ <optional>
1006
+ <ref name="seriesto"/>
1007
+ </optional>
1008
+ <optional>
1009
+ <ref name="seriesnumber"/>
1010
+ </optional>
1011
+ <optional>
1012
+ <ref name="seriespartnumber"/>
1013
+ </optional>
1014
+ <optional>
1015
+ <ref name="seriesrun"/>
1016
+ </optional>
990
1017
  </element>
991
1018
  </define>
992
1019
  <define name="SeriesType">
@@ -126,13 +126,13 @@ module Metanorma
126
126
  end
127
127
 
128
128
  def outputs(node, ret)
129
- File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
130
- presentation_xml_converter(node).convert(@filename + ".xml")
131
- html_converter(node).convert(@filename + ".presentation.xml",
129
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
130
+ presentation_xml_converter(node).convert("#{@filename}.xml")
131
+ html_converter(node).convert("#{@filename}.presentation.xml",
132
132
  nil, false, "#{@filename}.html")
133
- doc_converter(node).convert(@filename + ".presentation.xml",
133
+ doc_converter(node).convert("#{@filename}.presentation.xml",
134
134
  nil, false, "#{@filename}.doc")
135
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
135
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
136
136
  nil, false, "#{@filename}.pdf")
137
137
  end
138
138
 
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="admonition">
36
+ <element name="admonition">
37
+ <attribute name="type">
38
+ <ref name="AdmonitionType"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="class"/>
42
+ </optional>
43
+ <attribute name="id">
44
+ <data type="ID"/>
45
+ </attribute>
46
+ <optional>
47
+ <attribute name="uri">
48
+ <data type="anyURI"/>
49
+ </attribute>
50
+ </optional>
51
+ <optional>
52
+ <attribute name="coverpage">
53
+ <data type="boolean"/>
54
+ </attribute>
55
+ </optional>
56
+ <optional>
57
+ <attribute name="notag">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <zeroOrMore>
65
+ <ref name="paragraph-with-footnote"/>
66
+ </zeroOrMore>
67
+ <zeroOrMore>
68
+ <ref name="note"/>
69
+ </zeroOrMore>
70
+ </element>
71
+ </define>
35
72
  <define name="index">
36
73
  <element name="index">
37
74
  <optional>
@@ -245,6 +282,9 @@
245
282
  <ref name="MultilingualRenderingType"/>
246
283
  </attribute>
247
284
  </optional>
285
+ <optional>
286
+ <ref name="tname"/>
287
+ </optional>
248
288
  <oneOrMore>
249
289
  <ref name="ul_li"/>
250
290
  </oneOrMore>
@@ -287,6 +327,9 @@
287
327
  </choice>
288
328
  </attribute>
289
329
  </optional>
330
+ <optional>
331
+ <ref name="tname"/>
332
+ </optional>
290
333
  <oneOrMore>
291
334
  <ref name="li"/>
292
335
  </oneOrMore>
@@ -323,6 +366,9 @@
323
366
  <ref name="MultilingualRenderingType"/>
324
367
  </attribute>
325
368
  </optional>
369
+ <optional>
370
+ <ref name="tname"/>
371
+ </optional>
326
372
  <oneOrMore>
327
373
  <ref name="dt"/>
328
374
  <ref name="dd"/>
@@ -851,6 +897,16 @@
851
897
  <ref name="MultilingualRenderingType"/>
852
898
  </attribute>
853
899
  </optional>
900
+ <optional>
901
+ <attribute name="coverpage">
902
+ <data type="boolean"/>
903
+ </attribute>
904
+ </optional>
905
+ <optional>
906
+ <attribute name="notag">
907
+ <data type="boolean"/>
908
+ </attribute>
909
+ </optional>
854
910
  <oneOrMore>
855
911
  <choice>
856
912
  <ref name="paragraph"/>
@@ -1178,6 +1234,7 @@
1178
1234
  <ref name="concept"/>
1179
1235
  <ref name="add"/>
1180
1236
  <ref name="del"/>
1237
+ <ref name="span"/>
1181
1238
  </choice>
1182
1239
  </define>
1183
1240
  <define name="add">
@@ -1204,6 +1261,14 @@
1204
1261
  </choice>
1205
1262
  </element>
1206
1263
  </define>
1264
+ <define name="span">
1265
+ <element name="span">
1266
+ <attribute name="class"/>
1267
+ <oneOrMore>
1268
+ <ref name="TextElement"/>
1269
+ </oneOrMore>
1270
+ </element>
1271
+ </define>
1207
1272
  <define name="concept">
1208
1273
  <element name="concept">
1209
1274
  <optional>
@@ -48,6 +48,16 @@
48
48
  <value>safety precautions</value>
49
49
  </choice>
50
50
  </attribute>
51
+ <optional>
52
+ <attribute name="coverpage">
53
+ <data type="boolean"/>
54
+ </attribute>
55
+ </optional>
56
+ <optional>
57
+ <attribute name="notag">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
51
61
  <optional>
52
62
  <ref name="tname"/>
53
63
  </optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.8.8".freeze
3
+ VERSION = "0.9.2".freeze
4
4
  end
5
5
  end
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "roman-numerals"
31
31
  spec.add_dependency "twitter_cldr"
32
32
 
33
- spec.add_dependency "metanorma-standoc", "~> 2.0.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 2.1.0"
34
34
 
35
35
  spec.add_development_dependency "debug"
36
36
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.9.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: 2022-04-18 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.0.0
61
+ version: 2.1.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.0.0
68
+ version: 2.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: debug
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
291
  - !ruby/object:Gem::Version
292
292
  version: '0'
293
293
  requirements: []
294
- rubygems_version: 3.3.9
294
+ rubygems_version: 3.3.7
295
295
  signing_key:
296
296
  specification_version: 4
297
297
  summary: Metanorma for UN.