metanorma-generic 1.6.1 → 1.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b73bf6f76844d72f936a43ae9854fd9c56c0971404fb29a6e0749fd0882ec073
4
- data.tar.gz: d62573d1a7fa43a18a64d256df76fb46672339b14166b65d9d3bb8377a5d8e06
3
+ metadata.gz: 0d02192d5be665b9aa551746323610fe9b988beebecdb2958b8c5e82db73b5af
4
+ data.tar.gz: 040ed75b73480fd867037665e2b6d7265b514231c4c9db9e875e6726f98087eb
5
5
  SHA512:
6
- metadata.gz: 92f06b85bc9aa9ec83e88903bed4e2530d4ac5b0c1f064e4a1034af9869944af2620a78a4908c7e3b93a8877f5153c45528f21decf6e17599825203cb8ddcf46
7
- data.tar.gz: c5ede8599a30d940c5633dbb63e97bdf37ad1edc700561fddb4e2186ee09eb081bb27b0451dd79d508d0c7b4aa70480c8ae6426446d925cd280a37377459d90a
6
+ metadata.gz: 46ecf1b3a72fa9b298c2d775b330c81604fea4224f2794422f5df8a6ca89a7ff2d7b8564eac7b2626af9f94d88d9755d55e533dc27913428ea4d73c00c6e452d
7
+ data.tar.gz: 1c652868d71eab1fb629726b5c3c8b2910e02d89f9ac41e532b9d3e907ac3305030105367ecf4c0dca1a06d38a953c5151cb2a938d244e6dd8c9ac14649f901d
@@ -0,0 +1,44 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+
10
+ jobs:
11
+ rake:
12
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
13
+ runs-on: ${{ matrix.os }}
14
+ continue-on-error: ${{ matrix.experimental }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
20
+ experimental: [ false ]
21
+ include:
22
+ - ruby: '2.7'
23
+ os: 'ubuntu-latest'
24
+ experimental: true
25
+ - ruby: '2.7'
26
+ os: 'windows-latest'
27
+ experimental: true
28
+ - ruby: '2.7'
29
+ os: 'macos-latest'
30
+ experimental: true
31
+ steps:
32
+ - uses: actions/checkout@master
33
+
34
+ - name: Use Ruby
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
39
+
40
+ - name: Update gems
41
+ run: bundle install --jobs 4 --retry 3
42
+
43
+ - name: Run specs
44
+ run: bundle exec rake
@@ -402,6 +402,16 @@
402
402
  </choice>
403
403
  </attribute>
404
404
  </optional>
405
+ <optional>
406
+ <attribute name="valign">
407
+ <choice>
408
+ <value>top</value>
409
+ <value>middle</value>
410
+ <value>bottom</value>
411
+ <value>baseline</value>
412
+ </choice>
413
+ </attribute>
414
+ </optional>
405
415
  <choice>
406
416
  <zeroOrMore>
407
417
  <ref name="TextElement"/>
@@ -429,6 +439,16 @@
429
439
  </choice>
430
440
  </attribute>
431
441
  </optional>
442
+ <optional>
443
+ <attribute name="valign">
444
+ <choice>
445
+ <value>top</value>
446
+ <value>middle</value>
447
+ <value>bottom</value>
448
+ <value>baseline</value>
449
+ </choice>
450
+ </attribute>
451
+ </optional>
432
452
  <choice>
433
453
  <zeroOrMore>
434
454
  <ref name="TextElement"/>
@@ -998,6 +1018,9 @@
998
1018
  <value>alphabet_upper</value>
999
1019
  </choice>
1000
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1001
1024
  <oneOrMore>
1002
1025
  <ref name="li"/>
1003
1026
  </oneOrMore>
@@ -1,13 +1,10 @@
1
1
  require "asciidoctor"
2
2
  require "asciidoctor/standoc/converter"
3
3
  require "fileutils"
4
+ require_relative "front"
4
5
 
5
6
  module Asciidoctor
6
7
  module Generic
7
-
8
- # A {Converter} implementation that generates RSD output, and a document
9
- # schema encapsulation of the document for validation
10
- #
11
8
  class Converter < Standoc::Converter
12
9
  XML_ROOT_TAG = "generic-standard".freeze
13
10
  XML_NAMESPACE = "https://www.metanorma.org/ns/generic".freeze
@@ -28,33 +25,6 @@ module Asciidoctor
28
25
  self.class::_file || __FILE__), "..", "..", "..", loc))
29
26
  end
30
27
 
31
- def default_publisher
32
- configuration.organization_name_long
33
- end
34
-
35
- def metadata_committee(node, xml)
36
- return unless node.attr("committee")
37
- xml.editorialgroup do |a|
38
- a.committee node.attr("committee"),
39
- **attr_code(type: node.attr("committee-type"))
40
- i = 2
41
- while node.attr("committee_#{i}") do
42
- a.committee node.attr("committee_#{i}"),
43
- **attr_code(type: node.attr("committee-type_#{i}"))
44
- i += 1
45
- end
46
- end
47
- end
48
-
49
- def metadata_status(node, xml)
50
- xml.status do |s|
51
- s.stage ( node.attr("status") || node.attr("docstage") ||
52
- configuration.default_stage || "published" )
53
- x = node.attr("substage") and s.substage x
54
- x = node.attr("iteration") and s.iteration x
55
- end
56
- end
57
-
58
28
  def docidentifier_cleanup(xmldoc)
59
29
  template = configuration.docid_template ||
60
30
  "{{ organization_name_short }} {{ docnumeric }}"
@@ -63,30 +33,15 @@ module Asciidoctor
63
33
  id.empty? and docid.remove or docid.children = id
64
34
  end
65
35
 
66
- def metadata_id(node, xml)
67
- xml.docidentifier **{ type:
68
- configuration.organization_name_short } do |i|
69
- i << "DUMMY"
70
- end
71
- xml.docnumber { |i| i << node.attr("docnumber") }
72
- end
73
-
74
- def metadata_ext(node, ext)
75
- super
76
- Array(configuration.metadata_extensions).each do |e|
77
- a = node.attr(e) and ext.send e, a
78
- end
79
- end
80
-
81
36
  def doctype(node)
82
- d = node.attr("doctype")
37
+ d = super
83
38
  configuration.doctypes or return d == "article" ? "standard" : d
84
- default = configuration.default_doctype || Array(configuration.doctypes).dig(0) ||
85
- "standard"
39
+ type = configuration.default_doctype ||
40
+ Array(configuration.doctypes).dig(0) || "standard"
86
41
  unless Array(configuration.doctypes).include? d
87
42
  @log.add("Document Attributes", nil,
88
- "#{d} is not a legal document type: reverting to '#{default}'")
89
- d = default
43
+ "#{d} is not a legal document type: reverting to '#{type}'")
44
+ d = type
90
45
  end
91
46
  d
92
47
  end
@@ -97,13 +52,13 @@ module Asciidoctor
97
52
  end
98
53
 
99
54
  def sectiontype_streamline(ret)
100
- if configuration.termsdefs_titles.map(&:downcase).include? (ret)
55
+ if configuration&.termsdefs_titles&.map(&:downcase)&.include? (ret)
101
56
  "terms and definitions"
102
- elsif configuration.symbols_titles.map(&:downcase).include? (ret)
57
+ elsif configuration&.symbols_titles&.map(&:downcase)&.include? (ret)
103
58
  "symbols and abbreviated terms"
104
- elsif configuration.normref_titles.map(&:downcase).include? (ret)
59
+ elsif configuration&.normref_titles&.map(&:downcase)&.include? (ret)
105
60
  "normative references"
106
- elsif configuration.bibliography_titles.map(&:downcase).include? (ret)
61
+ elsif configuration&.bibliography_titles&.map(&:downcase)&.include? (ret)
107
62
  "bibliography"
108
63
  else
109
64
  ret
@@ -117,11 +72,11 @@ module Asciidoctor
117
72
 
118
73
  def outputs(node, ret)
119
74
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
120
- presentation_xml_converter(node).convert(@filename + ".xml")
121
- html_converter(node).convert(@filename + ".presentation.xml",
122
- nil, false, "#{@filename}.html")
123
- doc_converter(node).convert(@filename + ".presentation.xml",
124
- nil, false, "#{@filename}.doc")
75
+ presentation_xml_converter(node)&.convert(@filename + ".xml")
76
+ html_converter(node)&.convert(@filename + ".presentation.xml",
77
+ nil, false, "#{@filename}.html")
78
+ doc_converter(node)&.convert(@filename + ".presentation.xml",
79
+ nil, false, "#{@filename}.doc")
125
80
  pdf_converter(node)&.convert(@filename + ".presentation.xml",
126
81
  nil, false, "#{@filename}.pdf")
127
82
 
@@ -141,6 +96,7 @@ module Asciidoctor
141
96
 
142
97
  def bibdata_validate(doc)
143
98
  stage_validate(doc)
99
+ committee_validate(doc)
144
100
  end
145
101
 
146
102
  def stage_validate(xmldoc)
@@ -151,6 +107,15 @@ module Asciidoctor
151
107
  @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
152
108
  end
153
109
 
110
+ def committee_validate(xmldoc)
111
+ committees = Array(configuration&.committees) || return
112
+ committees.empty? and return
113
+ xmldoc.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
114
+ committees.include? c.text or
115
+ @log.add("Document Attributes", nil, "#{c.text} is not a recognised committee")
116
+ end
117
+ end
118
+
154
119
  def sections_cleanup(x)
155
120
  super
156
121
  x.xpath("//*[@inline-header]").each do |h|
@@ -187,6 +152,26 @@ module Asciidoctor
187
152
  end
188
153
  conv
189
154
  end
155
+
156
+ def boilerplate_file(xmldoc)
157
+ f = configuration.boilerplate
158
+ f.nil? and return super
159
+ f.is_a? String and return baselocation(f)
160
+ f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
161
+ super
162
+ end
163
+
164
+ def cleanup(xmldoc)
165
+ super
166
+ empty_metadata_cleanup(xmldoc)
167
+ xmldoc
168
+ end
169
+
170
+ def empty_metadata_cleanup(xmldoc)
171
+ xmldoc.xpath("//bibdata/ext//*").each do |x|
172
+ x.remove if x.children.empty?
173
+ end
174
+ end
190
175
  end
191
176
  end
192
177
  end
@@ -0,0 +1,103 @@
1
+ module Asciidoctor
2
+ module Generic
3
+ class Converter < Standoc::Converter
4
+ def default_publisher
5
+ configuration.organization_name_long
6
+ end
7
+
8
+ def org_abbrev
9
+ if !configuration.organization_name_long.empty? &&
10
+ !configuration.organization_name_short.empty? &&
11
+ configuration.organization_name_long !=
12
+ configuration.organization_name_short
13
+ { configuration.organization_name_long =>
14
+ configuration.organization_name_short }
15
+ else
16
+ super
17
+ end
18
+ end
19
+
20
+ def relaton_relations
21
+ Array(configuration.relations) || []
22
+ end
23
+
24
+ def metadata_committee(node, xml)
25
+ return unless node.attr("committee")
26
+ xml.editorialgroup do |a|
27
+ a.committee node.attr("committee"),
28
+ **attr_code(type: node.attr("committee-type"))
29
+ i = 2
30
+ while node.attr("committee_#{i}") do
31
+ a.committee node.attr("committee_#{i}"),
32
+ **attr_code(type: node.attr("committee-type_#{i}"))
33
+ i += 1
34
+ end
35
+ end
36
+ end
37
+
38
+ def metadata_status(node, xml)
39
+ xml.status do |s|
40
+ s.stage ( node.attr("status") || node.attr("docstage") ||
41
+ configuration.default_stage || "published" )
42
+ x = node.attr("substage") and s.substage x
43
+ x = node.attr("iteration") and s.iteration x
44
+ end
45
+ end
46
+
47
+ def metadata_id(node, xml)
48
+ xml.docidentifier **{ type:
49
+ configuration.organization_name_short } do |i|
50
+ i << "DUMMY"
51
+ end
52
+ xml.docnumber { |i| i << node.attr("docnumber") }
53
+ end
54
+
55
+ def metadata_ext(node, ext)
56
+ super
57
+ if configuration.metadata_extensions.is_a? Hash
58
+ metadata_ext_hash(node, ext, configuration.metadata_extensions)
59
+ else
60
+ Array(configuration.metadata_extensions).each do |e|
61
+ a = node.attr(e) and ext.send e, a
62
+ end
63
+ end
64
+ end
65
+
66
+ EXT_STRUCT = %w(_output _attribute _list).freeze
67
+
68
+ def metadata_ext_hash(node, ext, hash)
69
+ hash.each do |k, v|
70
+ next if EXT_STRUCT.include?(k) || !v&.is_a?(Hash) && !node.attr(k)
71
+ if v&.is_a?(Hash) && v["_list"]
72
+ csv_split(node.attr(k)).each do |val|
73
+ metadata_ext_hash1(k, val, ext, v, node)
74
+ end
75
+ else
76
+ metadata_ext_hash1(k, node.attr(k), ext, v, node)
77
+ end
78
+ end
79
+ end
80
+
81
+ def metadata_ext_hash1(key, value, ext, hash, node)
82
+ return if hash&.is_a?(Hash) && hash["_attribute"]
83
+ is_hash = hash&.is_a?(Hash) &&
84
+ !hash.keys.reject { |n| EXT_STRUCT.include?(n) }.empty?
85
+ return if !is_hash && (value.nil? || value.empty?)
86
+ name = hash&.is_a?(Hash) ? (hash["_output"] || key) : key
87
+ ext.send name, **attr_code(metadata_ext_attrs(hash, node)) do |e|
88
+ is_hash ? metadata_ext_hash(node, e, hash) : (e << value)
89
+ end
90
+ end
91
+
92
+ def metadata_ext_attrs(hash, node)
93
+ return {} unless hash.is_a?(Hash)
94
+ ret = {}
95
+ hash.each do |k, v|
96
+ next unless v.is_a?(Hash) && v["_attribute"]
97
+ ret[(v["_output"] || k).to_sym] = node.attr(k)
98
+ end
99
+ ret
100
+ end
101
+ end
102
+ end
103
+ end
@@ -59,6 +59,13 @@
59
59
  </define>
60
60
  <define name="generic-standard">
61
61
  <element name="generic-standard">
62
+ <attribute name="version"/>
63
+ <attribute name="type">
64
+ <choice>
65
+ <value>semantic</value>
66
+ <value>presentation</value>
67
+ </choice>
68
+ </attribute>
62
69
  <ref name="bibdata"/>
63
70
  <zeroOrMore>
64
71
  <ref name="termdocsource"/>
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,6 +63,11 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -1049,14 +1085,17 @@
1049
1085
  <ref name="section-title"/>
1050
1086
  </optional>
1051
1087
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
1060
1099
  <zeroOrMore>
1061
1100
  <choice>
1062
1101
  <ref name="clause-subsection"/>
@@ -1125,49 +1164,7 @@
1125
1164
  </define>
1126
1165
  <define name="annex">
1127
1166
  <element name="annex">
1128
- <optional>
1129
- <attribute name="id">
1130
- <data type="ID"/>
1131
- </attribute>
1132
- </optional>
1133
- <optional>
1134
- <attribute name="language"/>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="script"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="inline-header">
1141
- <data type="boolean"/>
1142
- </attribute>
1143
- </optional>
1144
- <attribute name="obligation">
1145
- <choice>
1146
- <value>normative</value>
1147
- <value>informative</value>
1148
- </choice>
1149
- </attribute>
1150
- <optional>
1151
- <ref name="section-title"/>
1152
- </optional>
1153
- <group>
1154
- <group>
1155
- <zeroOrMore>
1156
- <ref name="BasicBlock"/>
1157
- </zeroOrMore>
1158
- <zeroOrMore>
1159
- <ref name="note"/>
1160
- </zeroOrMore>
1161
- </group>
1162
- <zeroOrMore>
1163
- <choice>
1164
- <ref name="annex-subsection"/>
1165
- <ref name="terms"/>
1166
- <ref name="definitions"/>
1167
- <ref name="references"/>
1168
- </choice>
1169
- </zeroOrMore>
1170
- </group>
1167
+ <ref name="Annex-Section"/>
1171
1168
  </element>
1172
1169
  </define>
1173
1170
  <define name="terms">
@@ -1453,11 +1450,6 @@
1453
1450
  </optional>
1454
1451
  </element>
1455
1452
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1453
  <define name="term-clause">
1462
1454
  <element name="clause">
1463
1455
  <optional>
@@ -1507,4 +1499,79 @@
1507
1499
  <ref name="CitationType"/>
1508
1500
  </element>
1509
1501
  </define>
1502
+ <define name="amend">
1503
+ <element name="amend">
1504
+ <optional>
1505
+ <attribute name="id">
1506
+ <data type="ID"/>
1507
+ </attribute>
1508
+ </optional>
1509
+ <attribute name="change">
1510
+ <choice>
1511
+ <value>add</value>
1512
+ <value>modify</value>
1513
+ <value>delete</value>
1514
+ </choice>
1515
+ </attribute>
1516
+ <optional>
1517
+ <attribute name="path"/>
1518
+ </optional>
1519
+ <optional>
1520
+ <attribute name="path_end"/>
1521
+ </optional>
1522
+ <optional>
1523
+ <attribute name="title"/>
1524
+ </optional>
1525
+ <optional>
1526
+ <element name="location">
1527
+ <zeroOrMore>
1528
+ <ref name="locality"/>
1529
+ </zeroOrMore>
1530
+ </element>
1531
+ </optional>
1532
+ <zeroOrMore>
1533
+ <ref name="autonumber"/>
1534
+ </zeroOrMore>
1535
+ <optional>
1536
+ <element name="description">
1537
+ <zeroOrMore>
1538
+ <ref name="BasicBlock"/>
1539
+ </zeroOrMore>
1540
+ </element>
1541
+ </optional>
1542
+ <optional>
1543
+ <element name="newcontent">
1544
+ <zeroOrMore>
1545
+ <ref name="BasicBlock"/>
1546
+ </zeroOrMore>
1547
+ </element>
1548
+ </optional>
1549
+ <optional>
1550
+ <element name="description">
1551
+ <zeroOrMore>
1552
+ <ref name="BasicBlock"/>
1553
+ </zeroOrMore>
1554
+ </element>
1555
+ </optional>
1556
+ </element>
1557
+ </define>
1558
+ <define name="autonumber">
1559
+ <element name="autonumber">
1560
+ <attribute name="type">
1561
+ <choice>
1562
+ <value>requirement</value>
1563
+ <value>recommendation</value>
1564
+ <value>permission</value>
1565
+ <value>table</value>
1566
+ <value>figure</value>
1567
+ <value>admonition</value>
1568
+ <value>formula</value>
1569
+ <value>sourcecode</value>
1570
+ <value>example</value>
1571
+ <value>note</value>
1572
+ </choice>
1573
+ </attribute>
1574
+ <text/>
1575
+ </element>
1576
+ </define>
1510
1577
  </grammar>
@@ -4,11 +4,13 @@ require "fileutils"
4
4
  module IsoDoc
5
5
  module Generic
6
6
  module BaseConvert
7
+ =begin
7
8
  def baselocation(loc)
8
9
  return nil if loc.nil?
9
10
  File.expand_path(File.join(
10
11
  File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
11
12
  end
13
+ =end
12
14
 
13
15
  def cleanup(docxml)
14
16
  super
@@ -636,7 +636,7 @@ div.WordSection2
636
636
 
637
637
  div.WordSection3
638
638
  {page:WordSection3;}
639
- table.MsoISOTable
639
+ table.MsoISOTable, table.MsoISOTableBig
640
640
  {mso-style-name:"Table ISO";
641
641
  mso-tstyle-rowband-size:0;
642
642
  mso-tstyle-colband-size:0;
@@ -656,15 +656,15 @@ table.MsoISOTable
656
656
  mso-border-insidev:.75pt solid windowtext;
657
657
  font-size:10.0pt;
658
658
  font-family:$bodyfont;}
659
- table.MsoISOTable th
659
+ table.MsoISOTable th, table.MsoISOTableBig th
660
660
  {border:solid windowtext 1pt;
661
661
  mso-border-alt:solid windowtext 1pt;
662
662
  padding:0cm 2.85pt 0cm 2.85pt;}
663
- table.MsoISOTable td
663
+ table.MsoISOTable td, table.MsoISOTableBig td
664
664
  {border:solid windowtext 1pt;
665
665
  mso-border-alt:solid windowtext 1pt;
666
666
  padding:0cm 2.85pt 0cm 2.85pt;}
667
- table.MsoISOTable p
667
+ table.MsoISOTable p, table.MsoISOTableBig p
668
668
  {font-size:10.0pt; }
669
669
  table.MsoTableGrid
670
670
  {mso-style-name:"Table Grid";
@@ -750,6 +750,20 @@ div.example p.MsoListParagraph {
750
750
 
751
751
  div.Note p.MsoListParagraph {
752
752
  font-size: 10.0pt;
753
+ margin-left: 1.0cm;
754
+ }
755
+
756
+ div.Note span.stem {
757
+ font-size: 10.0pt; }
758
+
759
+ div.Note p.Sourcecode, div.Note pre.Sourcecode {
760
+ font-size: 8.0pt;
761
+ margin-left: 1.0cm;
762
+ }
763
+
764
+ div.Note table.dl {
765
+ font-size: 10.0pt;
766
+ margin-left: 1.0cm;
753
767
  }
754
768
 
755
769
  span.note_label, span.example_label, td.example_label, td.note_label
@@ -24,10 +24,14 @@ module IsoDoc
24
24
 
25
25
  def default_fonts(options)
26
26
  {
27
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif'
28
- : configuration.html_bodyfont || '"Overpass",sans-serif'),
29
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
30
- configuration.html_headerfont || '"Overpass",sans-serif'),
27
+ bodyfont: (
28
+ options[:script] == "Hans" ? '"SimSun",serif' :
29
+ configuration.html_bodyfont || '"Overpass",sans-serif'
30
+ ),
31
+ headerfont: (
32
+ options[:script] == "Hans" ? '"SimHei",sans-serif' :
33
+ configuration.html_headerfont || '"Overpass",sans-serif'
34
+ ),
31
35
  monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
32
36
  }
33
37
  end
@@ -35,20 +39,23 @@ module IsoDoc
35
39
  def default_file_locations(_options)
36
40
  {
37
41
  htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
38
- html_doc_path("htmlstyle.scss"),
42
+ html_doc_path("htmlstyle.scss"),
39
43
  htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
40
- html_doc_path("html_generic_titlepage.html"),
44
+ html_doc_path("html_generic_titlepage.html"),
41
45
  htmlintropage: baselocation(configuration.htmlintropage) ||
42
- html_doc_path("html_generic_intro.html"),
46
+ html_doc_path("html_generic_intro.html"),
43
47
  scripts: baselocation(configuration.scripts) ||
44
- html_doc_path("scripts.html"),
45
- i18nyaml: baselocation(configuration.i18nyaml)
48
+ html_doc_path("scripts.html"),
49
+ i18nyaml: (configuration.i18nyaml.is_a?(String) ?
50
+ baselocation(configuration.i18nyaml) : nil)
46
51
  }
47
52
  end
48
53
 
54
+ =begin
49
55
  def configuration
50
56
  Metanorma::Generic.configuration
51
57
  end
58
+ =end
52
59
 
53
60
  def googlefonts
54
61
  return unless configuration.webfont
@@ -0,0 +1,26 @@
1
+ require_relative "utils"
2
+
3
+ module IsoDoc
4
+ module Generic
5
+ class I18n < IsoDoc::I18n
6
+ class << self
7
+ attr_accessor :_file
8
+ end
9
+
10
+ def self.inherited( k )
11
+ k._file = caller_locations.first.absolute_path
12
+ end
13
+
14
+ def load_yaml1(lang, script)
15
+ return super unless configuration.i18nyaml
16
+ file = configuration.i18nyaml.is_a?(Hash) ?
17
+ configuration.i18nyaml[lang] : configuration.i18nyaml
18
+ return super if file.nil?
19
+ y = YAML.load_file(baselocation(file))
20
+ super.merge(y)
21
+ end
22
+
23
+ include Utils
24
+ end
25
+ end
26
+ end
@@ -1,6 +1,8 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
3
  require_relative "xref"
4
+ require_relative "i18n"
5
+ require_relative "utils"
4
6
 
5
7
  module IsoDoc
6
8
  module Generic
@@ -15,12 +17,13 @@ module IsoDoc
15
17
  end
16
18
 
17
19
  def i18n_init(lang, script, i18nyaml = nil)
18
- @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
20
+ f = Metanorma::Generic.configuration.i18nyaml
21
+ f = nil unless f.is_a? String
22
+ @i18n = I18n.new(
23
+ lang, script, i18nyaml || f || @i18nyaml)
19
24
  end
20
25
 
21
- def fileloc(loc)
22
- File.join(File.dirname(__FILE__), loc)
23
- end
26
+ include Utils
24
27
  end
25
28
  end
26
29
  end
@@ -1,4 +1,29 @@
1
1
  require "isodoc"
2
+ require "nokogiri"
3
+ require_relative "init"
4
+ require_relative "utils"
5
+
6
+ class Nokogiri::XML::Node
7
+ TYPENAMES = {1=>'element',2=>'attribute',3=>'text',4=>'cdata',8=>'comment'}
8
+ def to_hash
9
+ ret = {kind:TYPENAMES[node_type],name:name}.tap do |h|
10
+ h.merge! text:text&.strip
11
+ a = attribute_nodes.map(&:to_hash)
12
+ if element? && !a.empty?
13
+ h.merge! attr: a.inject({}) { |m, v| m[v[:name]] = v[:text]; m }
14
+ end
15
+ c = children.map(&:to_hash)
16
+ if element? && !(c&.size == 1 && c[0][:kind] == "text")
17
+ h.merge! kids: c.delete_if { |n| n[:kind] == "text" && n[:text].empty? }
18
+ end
19
+ end
20
+ ret
21
+ end
22
+ end
23
+
24
+ class Nokogiri::XML::Document
25
+ def to_hash; root.to_hash; end
26
+ end
2
27
 
3
28
  module IsoDoc
4
29
  module Generic
@@ -22,16 +47,6 @@ module IsoDoc
22
47
  k._file = caller_locations.first.absolute_path
23
48
  end
24
49
 
25
- def baselocation(loc)
26
- return nil if loc.nil?
27
- File.expand_path(File.join(
28
- File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
29
- end
30
-
31
- def configuration
32
- Metanorma::Generic.configuration
33
- end
34
-
35
50
  def author(isoxml, _out)
36
51
  super
37
52
  tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
@@ -48,12 +63,32 @@ module IsoDoc
48
63
  !(Array(stages).map { |m| m.downcase }.include? status.downcase)
49
64
  end
50
65
 
51
- def ext(isoxml, out)
52
- Array(configuration.metadata_extensions).each do |e|
53
- b = isoxml&.at(ns("//bibdata/ext/#{e}"))&.text or next
54
- set(e.to_sym, b)
66
+ def xmlhash2hash(h)
67
+ ret = {}
68
+ return ret if h.nil? || h[:kind] != "element"
69
+ h[:attr].nil? or h[:attr].each { |k, v| ret["#{h[:name]}_#{k}"] = v }
70
+ ret[h[:name]] = h[:kids] ? xmlhash2hash_kids(h) : h[:text]
71
+ ret
72
+ end
73
+
74
+ def xmlhash2hash_kids(h)
75
+ c = {}
76
+ h[:kids].each do |n|
77
+ xmlhash2hash(n).each do |k1, v1|
78
+ c[k1] = c[k1].nil? ? v1 :
79
+ c[k1].is_a?(Array) ? c[k1] << v1 :
80
+ [c[k1], v1]
81
+ end
55
82
  end
83
+ c
56
84
  end
85
+
86
+ def ext(isoxml, out)
87
+ b = isoxml&.at(ns("//bibdata/ext")) or return
88
+ set(:metadata_extensions, xmlhash2hash(b.to_hash)["ext"])
89
+ end
90
+
91
+ include Utils
57
92
  end
58
93
  end
59
94
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "init"
2
+ require_relative "metadata"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -0,0 +1,21 @@
1
+ module IsoDoc
2
+ module Generic
3
+ module Utils
4
+ def configuration
5
+ Metanorma::Generic.configuration
6
+ end
7
+
8
+ def fileloc(loc)
9
+ File.join(File.dirname(__FILE__), loc)
10
+ end
11
+
12
+ def baselocation(loc)
13
+ return nil if loc.nil?
14
+ f = defined?(self.class::_file) ? (self.class::_file || __FILE__) :
15
+ __FILE__
16
+ File.expand_path(File.join(
17
+ File.dirname(f), "..", "..", "..", loc))
18
+ end
19
+ end
20
+ end
21
+ end
@@ -23,10 +23,14 @@ module IsoDoc
23
23
 
24
24
  def default_fonts(options)
25
25
  {
26
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
27
- configuration.word_bodyfont || '"Arial",sans-serif'),
28
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
29
- configuration.word_headerfont || '"Arial",sans-serif'),
26
+ bodyfont: (
27
+ options[:script] == "Hans" ? '"SimSun",serif' :
28
+ configuration.word_bodyfont || '"Arial",sans-serif'
29
+ ),
30
+ headerfont: (
31
+ options[:script] == "Hans" ? '"SimHei",sans-serif' :
32
+ configuration.word_headerfont || '"Arial",sans-serif'
33
+ ),
30
34
  monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
31
35
  }
32
36
  end
@@ -34,24 +38,27 @@ module IsoDoc
34
38
  def default_file_locations(options)
35
39
  {
36
40
  wordstylesheet: baselocation(configuration.wordstylesheet) ||
37
- html_doc_path("wordstyle.scss"),
41
+ html_doc_path("wordstyle.scss"),
38
42
  standardstylesheet: baselocation(configuration.standardstylesheet) ||
39
- html_doc_path("generic.scss"),
43
+ html_doc_path("generic.scss"),
40
44
  header: baselocation(configuration.header) ||
41
- html_doc_path("header.html"),
45
+ html_doc_path("header.html"),
42
46
  wordcoverpage: baselocation(configuration.wordcoverpage) ||
43
- html_doc_path("word_generic_titlepage.html"),
47
+ html_doc_path("word_generic_titlepage.html"),
44
48
  wordintropage: baselocation(configuration.wordintropage) ||
45
- html_doc_path("word_generic_intro.html"),
46
- i18nyaml: baselocation(configuration.i18nyaml),
47
- ulstyle: "l3",
48
- olstyle: "l2",
49
+ html_doc_path("word_generic_intro.html"),
50
+ i18nyaml: (configuration.i18nyaml.is_a?(String) ?
51
+ baselocation(configuration.i18nyaml) : nil),
52
+ ulstyle: "l3",
53
+ olstyle: "l2",
49
54
  }
50
55
  end
51
56
 
57
+ =begin
52
58
  def configuration
53
59
  Metanorma::Generic.configuration
54
60
  end
61
+ =end
55
62
 
56
63
  include BaseConvert
57
64
  include Init
@@ -15,6 +15,8 @@ module Metanorma
15
15
  organization_name_short
16
16
  organization_name_long
17
17
  bibliography_titles
18
+ boilerplate
19
+ committees
18
20
  document_namespace
19
21
  docid_template
20
22
  doctypes
@@ -33,6 +35,7 @@ module Metanorma
33
35
  metanorma_name
34
36
  normref_titles
35
37
  published_stages
38
+ relations
36
39
  default_stage
37
40
  stage_abbreviations
38
41
  scripts
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.6.1"
3
+ VERSION = "1.7.2"
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
30
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "metanorma-standoc", "~> 1.5.0"
31
+ spec.add_dependency "metanorma-standoc", "~> 1.6.0"
32
32
  spec.add_dependency "isodoc", "~> 1.2.0"
33
33
 
34
34
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -29,6 +29,11 @@ metadata_extensions:
29
29
  - security
30
30
  published_stages:
31
31
  - published
32
+ committees:
33
+ - TC 1
34
+ relations:
35
+ - part-of
36
+ - translated-from
32
37
  stage_abbreviations:
33
38
  draft-proposal:
34
39
  draft-development:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-generic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.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: 2020-08-14 00:00:00.000000000 Z
11
+ date: 2020-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.5.0
47
+ version: 1.6.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.5.0
54
+ version: 1.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -216,9 +216,7 @@ executables: []
216
216
  extensions: []
217
217
  extra_rdoc_files: []
218
218
  files:
219
- - ".github/workflows/macos.yml"
220
- - ".github/workflows/ubuntu.yml"
221
- - ".github/workflows/windows.yml"
219
+ - ".github/workflows/rake.yml"
222
220
  - ".gitignore"
223
221
  - ".hound.yml"
224
222
  - ".rubocop.ribose.yml"
@@ -236,6 +234,7 @@ files:
236
234
  - lib/asciidoctor/generic/basicdoc.rng
237
235
  - lib/asciidoctor/generic/biblio.rng
238
236
  - lib/asciidoctor/generic/converter.rb
237
+ - lib/asciidoctor/generic/front.rb
239
238
  - lib/asciidoctor/generic/generic.rng
240
239
  - lib/asciidoctor/generic/isodoc.rng
241
240
  - lib/asciidoctor/generic/reqt.rng
@@ -253,10 +252,12 @@ files:
253
252
  - lib/isodoc/generic/html/word_generic_titlepage.html
254
253
  - lib/isodoc/generic/html/wordstyle.scss
255
254
  - lib/isodoc/generic/html_convert.rb
255
+ - lib/isodoc/generic/i18n.rb
256
256
  - lib/isodoc/generic/init.rb
257
257
  - lib/isodoc/generic/metadata.rb
258
258
  - lib/isodoc/generic/pdf_convert.rb
259
259
  - lib/isodoc/generic/presentation_xml_convert.rb
260
+ - lib/isodoc/generic/utils.rb
260
261
  - lib/isodoc/generic/word_convert.rb
261
262
  - lib/isodoc/generic/xref.rb
262
263
  - lib/metanorma-generic.rb
@@ -1,38 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/ubuntu.yml
11
- - .github/workflows/windows.yml
12
-
13
- jobs:
14
- test-macos:
15
- name: Test on Ruby ${{ matrix.ruby }} macOS
16
- runs-on: macos-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Use Ruby
29
- uses: actions/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- - name: Update gems
33
- run: |
34
- sudo gem install bundler --force
35
- bundle install --jobs 4 --retry 3
36
- - name: Run specs
37
- run: |
38
- bundle exec rake
@@ -1,56 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- tags:
9
- - '*'
10
- pull_request:
11
- paths-ignore:
12
- - .github/workflows/macos.yml
13
- - .github/workflows/windows.yml
14
-
15
- jobs:
16
- test-linux:
17
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
18
- runs-on: ubuntu-latest
19
- continue-on-error: ${{ matrix.experimental }}
20
- strategy:
21
- fail-fast: false
22
- matrix:
23
- ruby: [ '2.6', '2.5', '2.4' ]
24
- experimental: [false]
25
- include:
26
- - ruby: '2.7'
27
- experimental: true
28
- steps:
29
- - uses: actions/checkout@master
30
- - name: Use Ruby
31
- uses: actions/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- - name: Update gems
35
- run: |
36
- gem install bundler
37
- bundle install --jobs 4 --retry 3
38
- - name: Run specs
39
- run: |
40
- bundle exec rake
41
- - name: Trigger repositories
42
- if: matrix.ruby == '2.6'
43
- env:
44
- GH_USERNAME: metanorma-ci
45
- GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
46
- run: |
47
- curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
48
- [[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
49
- CLIENT_PAYLOAD=$(cat <<EOF
50
- "{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
51
- EOF
52
- )
53
- for repo in $REPOS
54
- do
55
- sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
56
- done
@@ -1,40 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/macos.yml
11
- - .github/workflows/ubuntu.yml
12
-
13
- jobs:
14
- test-windows:
15
- name: Test on Ruby ${{ matrix.ruby }} Windows
16
- runs-on: windows-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Use Ruby
29
- uses: actions/setup-ruby@v1
30
- with:
31
- ruby-version: ${{ matrix.ruby }}
32
- - name: Update gems
33
- shell: pwsh
34
- run: |
35
- gem install bundler
36
- bundle config --local path vendor/bundle
37
- bundle install --jobs 4 --retry 3
38
- - name: Run specs
39
- run: |
40
- bundle exec rake