metanorma-generic 1.5.1 → 1.7.0

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: 1c1680dbc80de8b900946d582965cdb87975a2f796416441a9a5ad7958d3c5cf
4
- data.tar.gz: 361b7a5c7ecb51b5c3a2180e2f17b083384678e8e6a976a19f0b14e0fb704bf3
3
+ metadata.gz: dbd87f79baeb66107643bd3c6e9377853f72f3b19d17615aced5737609ea31e4
4
+ data.tar.gz: a1e014a6a7076b4f39c37bcb35d67fecb221ff0494ba38ce88482affb8aef854
5
5
  SHA512:
6
- metadata.gz: c1edbb399ba66ea7c7836c5f4644fc5da9f1080b19d52b37ca42e2679811a858a540a9cd7c165fceea10e150e32039a6613b1f0ce25915b88c24dfefc73c01bd
7
- data.tar.gz: 34981e89ab1542522d57f6840907e19b5d107ae6b20d2aba15090253655ff79c7ede49d81ac5b608377c77f6c93bf09a00b6db81d1f4d13a1c914cf61e9472da
6
+ metadata.gz: b26374f517b2c486fd6780a66f05357689990026dab52e88c8f8b9a1aec881653a4f23f915bf5e6944c83ae8fe943046ae42047382c3968a5b1cca11204f5a53
7
+ data.tar.gz: 35502f72cf8aa2f3f19848d4fe9326994f8af544531e71da3dabf61215329c164404cfd5d7fab6e72da66f43ae851272ceaf6a1d9fbf6a72fdf15552d6dcd4e6
@@ -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>
@@ -24,28 +24,30 @@ module Asciidoctor
24
24
 
25
25
  def baselocation(loc)
26
26
  return nil if loc.nil?
27
- File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
27
+ File.expand_path(File.join(File.dirname(
28
+ self.class::_file || __FILE__), "..", "..", "..", loc))
28
29
  end
29
30
 
30
- def metadata_author(node, xml)
31
- xml.contributor do |c|
32
- c.role **{ type: "author" }
33
- c.organization do |a|
34
- a.name configuration.organization_name_long
35
- end
36
- end
37
- personal_author(node, xml)
31
+ def default_publisher
32
+ configuration.organization_name_long
38
33
  end
39
34
 
40
- def metadata_publisher(node, xml)
41
- xml.contributor do |c|
42
- c.role **{ type: "publisher" }
43
- c.organization do |a|
44
- a.name configuration.organization_name_long
45
- end
35
+ def org_abbrev
36
+ if !configuration.organization_name_long.empty? &&
37
+ !configuration.organization_name_short.empty? &&
38
+ configuration.organization_name_long !=
39
+ configuration.organization_name_short
40
+ { configuration.organization_name_long =>
41
+ configuration.organization_name_short }
42
+ else
43
+ super
46
44
  end
47
45
  end
48
46
 
47
+ def relaton_relations
48
+ Array(configuration.relations) || []
49
+ end
50
+
49
51
  def metadata_committee(node, xml)
50
52
  return unless node.attr("committee")
51
53
  xml.editorialgroup do |a|
@@ -85,18 +87,6 @@ module Asciidoctor
85
87
  xml.docnumber { |i| i << node.attr("docnumber") }
86
88
  end
87
89
 
88
- def metadata_copyright(node, xml)
89
- from = node.attr("copyright-year") || Date.today.year
90
- xml.copyright do |c|
91
- c.from from
92
- c.owner do |owner|
93
- owner.organization do |o|
94
- o.name configuration.organization_name_long
95
- end
96
- end
97
- end
98
- end
99
-
100
90
  def metadata_ext(node, ext)
101
91
  super
102
92
  Array(configuration.metadata_extensions).each do |e|
@@ -105,7 +95,7 @@ module Asciidoctor
105
95
  end
106
96
 
107
97
  def doctype(node)
108
- d = node.attr("doctype")
98
+ d = super
109
99
  configuration.doctypes or return d == "article" ? "standard" : d
110
100
  default = configuration.default_doctype || Array(configuration.doctypes).dig(0) ||
111
101
  "standard"
@@ -143,10 +133,13 @@ module Asciidoctor
143
133
 
144
134
  def outputs(node, ret)
145
135
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
146
- presentation_xml_converter(node).convert(@filename + ".xml")
147
- html_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.html")
148
- doc_converter(node).convert(@filename + ".presentation.xml", nil, false, "#{@filename}.doc")
149
- pdf_converter(node)&.convert(@filename + ".presentation.xml", nil, false, "#{@filename}.pdf")
136
+ presentation_xml_converter(node)&.convert(@filename + ".xml")
137
+ html_converter(node)&.convert(@filename + ".presentation.xml",
138
+ nil, false, "#{@filename}.html")
139
+ doc_converter(node)&.convert(@filename + ".presentation.xml",
140
+ nil, false, "#{@filename}.doc")
141
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
142
+ nil, false, "#{@filename}.pdf")
150
143
 
151
144
  end
152
145
 
@@ -164,6 +157,7 @@ module Asciidoctor
164
157
 
165
158
  def bibdata_validate(doc)
166
159
  stage_validate(doc)
160
+ committee_validate(doc)
167
161
  end
168
162
 
169
163
  def stage_validate(xmldoc)
@@ -174,6 +168,15 @@ module Asciidoctor
174
168
  @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
175
169
  end
176
170
 
171
+ def committee_validate(xmldoc)
172
+ committees = Array(configuration&.committees) || return
173
+ committees.empty? and return
174
+ xmldoc.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
175
+ committees.include? c.text or
176
+ @log.add("Document Attributes", nil, "#{c.text} is not a recognised committee")
177
+ end
178
+ end
179
+
177
180
  def sections_cleanup(x)
178
181
  super
179
182
  x.xpath("//*[@inline-header]").each do |h|
@@ -206,10 +209,18 @@ module Asciidoctor
206
209
  def boilerplate_isodoc(xmldoc)
207
210
  conv = super
208
211
  Metanorma::Generic::Configuration::CONFIG_ATTRS.each do |a|
209
- conv.labels[a] = configuration.send a
212
+ conv.i18n.set(a, configuration.send(a))
210
213
  end
211
214
  conv
212
215
  end
216
+
217
+ def boilerplate_file(xmldoc)
218
+ f = configuration.boilerplate
219
+ f.nil? and return super
220
+ f.is_a? String and return baselocation(f)
221
+ f.is_a? Hash and f[@lang] and return baselocation(f[@lang])
222
+ super
223
+ end
213
224
  end
214
225
  end
215
226
  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"/>
@@ -42,8 +42,11 @@
42
42
  </define>
43
43
  <define name="xref">
44
44
  <element name="xref">
45
+ <!-- attribute target { xsd:IDREF }, -->
45
46
  <attribute name="target">
46
- <data type="IDREF"/>
47
+ <data type="string">
48
+ <param name="pattern">\i\c*|\c+#\c+</param>
49
+ </data>
47
50
  </attribute>
48
51
  <optional>
49
52
  <attribute name="type">
@@ -61,6 +64,11 @@
61
64
  </choice>
62
65
  </attribute>
63
66
  </optional>
67
+ <optional>
68
+ <attribute name="droploc">
69
+ <data type="boolean"/>
70
+ </attribute>
71
+ </optional>
64
72
  <text/>
65
73
  </element>
66
74
  </define>
@@ -578,6 +586,8 @@
578
586
  <ref name="ol"/>
579
587
  <ref name="dl"/>
580
588
  <ref name="formula"/>
589
+ <ref name="quote"/>
590
+ <ref name="sourcecode"/>
581
591
  </choice>
582
592
  </oneOrMore>
583
593
  </element>
@@ -661,6 +671,16 @@
661
671
  </choice>
662
672
  </attribute>
663
673
  </optional>
674
+ <optional>
675
+ <attribute name="valign">
676
+ <choice>
677
+ <value>top</value>
678
+ <value>middle</value>
679
+ <value>bottom</value>
680
+ <value>baseline</value>
681
+ </choice>
682
+ </attribute>
683
+ </optional>
664
684
  <choice>
665
685
  <zeroOrMore>
666
686
  <choice>
@@ -697,6 +717,16 @@
697
717
  </choice>
698
718
  </attribute>
699
719
  </optional>
720
+ <optional>
721
+ <attribute name="valign">
722
+ <choice>
723
+ <value>top</value>
724
+ <value>middle</value>
725
+ <value>bottom</value>
726
+ <value>baseline</value>
727
+ </choice>
728
+ </attribute>
729
+ </optional>
700
730
  <choice>
701
731
  <zeroOrMore>
702
732
  <choice>
@@ -834,6 +864,13 @@
834
864
  </define>
835
865
  <define name="standard-document">
836
866
  <element name="standard-document">
867
+ <attribute name="version"/>
868
+ <attribute name="type">
869
+ <choice>
870
+ <value>semantic</value>
871
+ <value>presentation</value>
872
+ </choice>
873
+ </attribute>
837
874
  <ref name="bibdata"/>
838
875
  <optional>
839
876
  <ref name="boilerplate"/>
@@ -855,7 +892,7 @@
855
892
  <oneOrMore>
856
893
  <choice>
857
894
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
895
+ <ref name="abstract"/>
859
896
  <ref name="foreword"/>
860
897
  <ref name="introduction"/>
861
898
  <ref name="acknowledgements"/>
@@ -922,6 +959,9 @@
922
959
  <optional>
923
960
  <attribute name="script"/>
924
961
  </optional>
962
+ <optional>
963
+ <attribute name="type"/>
964
+ </optional>
925
965
  <optional>
926
966
  <attribute name="obligation">
927
967
  <choice>
@@ -961,9 +1001,6 @@
961
1001
  </define>
962
1002
  <define name="content-subsection">
963
1003
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
1004
  <ref name="Content-Section"/>
968
1005
  </element>
969
1006
  </define>
@@ -992,6 +1029,9 @@
992
1029
  </choice>
993
1030
  </attribute>
994
1031
  </optional>
1032
+ <optional>
1033
+ <attribute name="type"/>
1034
+ </optional>
995
1035
  <optional>
996
1036
  <ref name="section-title"/>
997
1037
  </optional>
@@ -1011,9 +1051,6 @@
1011
1051
  </define>
1012
1052
  <define name="clause">
1013
1053
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1054
  <ref name="Clause-Section"/>
1018
1055
  </element>
1019
1056
  </define>
@@ -1042,18 +1079,24 @@
1042
1079
  </choice>
1043
1080
  </attribute>
1044
1081
  </optional>
1082
+ <optional>
1083
+ <attribute name="type"/>
1084
+ </optional>
1045
1085
  <optional>
1046
1086
  <ref name="section-title"/>
1047
1087
  </optional>
1048
1088
  <group>
1049
- <group>
1050
- <zeroOrMore>
1051
- <ref name="BasicBlock"/>
1052
- </zeroOrMore>
1053
- <zeroOrMore>
1054
- <ref name="note"/>
1055
- </zeroOrMore>
1056
- </group>
1089
+ <choice>
1090
+ <group>
1091
+ <zeroOrMore>
1092
+ <ref name="BasicBlock"/>
1093
+ </zeroOrMore>
1094
+ <zeroOrMore>
1095
+ <ref name="note"/>
1096
+ </zeroOrMore>
1097
+ </group>
1098
+ <ref name="amend"/>
1099
+ </choice>
1057
1100
  <zeroOrMore>
1058
1101
  <choice>
1059
1102
  <ref name="clause-subsection"/>
@@ -1180,6 +1223,9 @@
1180
1223
  <optional>
1181
1224
  <attribute name="script"/>
1182
1225
  </optional>
1226
+ <optional>
1227
+ <attribute name="type"/>
1228
+ </optional>
1183
1229
  <optional>
1184
1230
  <attribute name="obligation">
1185
1231
  <choice>
@@ -1447,11 +1493,6 @@
1447
1493
  </optional>
1448
1494
  </element>
1449
1495
  </define>
1450
- <define name="preface_abstract">
1451
- <element name="abstract">
1452
- <ref name="Basic-Section"/>
1453
- </element>
1454
- </define>
1455
1496
  <define name="term-clause">
1456
1497
  <element name="clause">
1457
1498
  <optional>
@@ -1501,4 +1542,79 @@
1501
1542
  <ref name="CitationType"/>
1502
1543
  </element>
1503
1544
  </define>
1545
+ <define name="amend">
1546
+ <element name="amend">
1547
+ <optional>
1548
+ <attribute name="id">
1549
+ <data type="ID"/>
1550
+ </attribute>
1551
+ </optional>
1552
+ <attribute name="change">
1553
+ <choice>
1554
+ <value>add</value>
1555
+ <value>modify</value>
1556
+ <value>delete</value>
1557
+ </choice>
1558
+ </attribute>
1559
+ <optional>
1560
+ <attribute name="path"/>
1561
+ </optional>
1562
+ <optional>
1563
+ <attribute name="path_end"/>
1564
+ </optional>
1565
+ <optional>
1566
+ <attribute name="title"/>
1567
+ </optional>
1568
+ <optional>
1569
+ <element name="location">
1570
+ <zeroOrMore>
1571
+ <ref name="locality"/>
1572
+ </zeroOrMore>
1573
+ </element>
1574
+ </optional>
1575
+ <zeroOrMore>
1576
+ <ref name="autonumber"/>
1577
+ </zeroOrMore>
1578
+ <optional>
1579
+ <element name="description">
1580
+ <zeroOrMore>
1581
+ <ref name="BasicBlock"/>
1582
+ </zeroOrMore>
1583
+ </element>
1584
+ </optional>
1585
+ <optional>
1586
+ <element name="newcontent">
1587
+ <zeroOrMore>
1588
+ <ref name="BasicBlock"/>
1589
+ </zeroOrMore>
1590
+ </element>
1591
+ </optional>
1592
+ <optional>
1593
+ <element name="description">
1594
+ <zeroOrMore>
1595
+ <ref name="BasicBlock"/>
1596
+ </zeroOrMore>
1597
+ </element>
1598
+ </optional>
1599
+ </element>
1600
+ </define>
1601
+ <define name="autonumber">
1602
+ <element name="autonumber">
1603
+ <attribute name="type">
1604
+ <choice>
1605
+ <value>requirement</value>
1606
+ <value>recommendation</value>
1607
+ <value>permission</value>
1608
+ <value>table</value>
1609
+ <value>figure</value>
1610
+ <value>admonition</value>
1611
+ <value>formula</value>
1612
+ <value>sourcecode</value>
1613
+ <value>example</value>
1614
+ <value>note</value>
1615
+ </choice>
1616
+ </attribute>
1617
+ <text/>
1618
+ </element>
1619
+ </define>
1504
1620
  </grammar>
@@ -1,41 +1,16 @@
1
1
  require "isodoc"
2
- require_relative "metadata"
3
- require_relative "xref"
4
2
  require "fileutils"
5
3
 
6
4
  module IsoDoc
7
5
  module Generic
8
6
  module BaseConvert
9
- def metadata_init(lang, script, labels)
10
- @meta = Metadata.new(lang, script, labels)
11
- end
12
-
13
- def xref_init(lang, script, klass, labels, options)
14
- @xrefs = Xref.new(lang, script, klass, labels, options)
15
- end
16
-
7
+ =begin
17
8
  def baselocation(loc)
18
9
  return nil if loc.nil?
19
- File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
20
- end
21
-
22
- def annex_name(annex, name, div)
23
- div.h1 **{ class: "Annex" } do |t|
24
- t << "#{@xrefs.anchor(annex['id'], :label)} "
25
- t.br
26
- t.b do |b|
27
- name&.children&.each { |c2| parse(c2, b) }
28
- end
29
- end
30
- end
31
-
32
- def i18n_init(lang, script)
33
- super
34
- end
35
-
36
- def fileloc(loc)
37
- File.join(File.dirname(__FILE__), loc)
10
+ File.expand_path(File.join(
11
+ File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
38
12
  end
13
+ =end
39
14
 
40
15
  def cleanup(docxml)
41
16
  super
@@ -52,7 +27,8 @@ module IsoDoc
52
27
  end
53
28
 
54
29
  def make_body(xml, docxml)
55
- body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72", "xml:lang": "EN-US", class: "container" }
30
+ body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
31
+ "xml:lang": "EN-US", class: "container" }
56
32
  xml.body **body_attr do |body|
57
33
  make_body1(body, docxml)
58
34
  make_body2(body, docxml)
@@ -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
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -23,10 +24,14 @@ module IsoDoc
23
24
 
24
25
  def default_fonts(options)
25
26
  {
26
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif'
27
- : configuration.html_bodyfont || '"Overpass",sans-serif'),
28
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
29
- 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
+ ),
30
35
  monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
31
36
  }
32
37
  end
@@ -34,27 +39,33 @@ module IsoDoc
34
39
  def default_file_locations(_options)
35
40
  {
36
41
  htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
37
- html_doc_path("htmlstyle.scss"),
42
+ html_doc_path("htmlstyle.scss"),
38
43
  htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
39
- html_doc_path("html_generic_titlepage.html"),
44
+ html_doc_path("html_generic_titlepage.html"),
40
45
  htmlintropage: baselocation(configuration.htmlintropage) ||
41
- html_doc_path("html_generic_intro.html"),
46
+ html_doc_path("html_generic_intro.html"),
42
47
  scripts: baselocation(configuration.scripts) ||
43
- html_doc_path("scripts.html"),
44
- i18nyaml: baselocation(configuration.i18nyaml)
48
+ html_doc_path("scripts.html"),
49
+ i18nyaml: (configuration.i18nyaml.is_a?(String) ?
50
+ baselocation(configuration.i18nyaml) : nil)
45
51
  }
46
52
  end
47
53
 
54
+ =begin
48
55
  def configuration
49
56
  Metanorma::Generic.configuration
50
57
  end
58
+ =end
51
59
 
52
60
  def googlefonts
53
61
  return unless configuration.webfont
54
- Array(configuration.webfont).map { |x| %{<link href="#{x.gsub(/\&amp;/, '&')}" rel="stylesheet">} }.join("\n")
62
+ Array(configuration.webfont).map do |x|
63
+ %{<link href="#{x.gsub(/\&amp;/, '&')}" rel="stylesheet">}
64
+ end.join("\n")
55
65
  end
56
66
 
57
67
  include BaseConvert
68
+ include Init
58
69
  end
59
70
  end
60
71
  end
@@ -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
@@ -0,0 +1,30 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+ require_relative "xref"
4
+ require_relative "i18n"
5
+ require_relative "utils"
6
+
7
+ module IsoDoc
8
+ module Generic
9
+ module Init
10
+ def metadata_init(lang, script, i18n)
11
+ @meta = Metadata.new(lang, script, i18n)
12
+ end
13
+
14
+ def xref_init(lang, script, klass, i18n, options)
15
+ html = HtmlConvert.new(language: lang, script: script)
16
+ @xrefs = Xref.new(lang, script, html, i18n, options)
17
+ end
18
+
19
+ def i18n_init(lang, script, i18nyaml = nil)
20
+ f = Metanorma::Generic.configuration.i18nyaml
21
+ f = nil unless f.is_a? String
22
+ @i18n = I18n.new(
23
+ lang, script, i18nyaml || f || @i18nyaml)
24
+ end
25
+
26
+ include Utils
27
+ end
28
+ end
29
+ end
30
+
@@ -1,4 +1,6 @@
1
1
  require "isodoc"
2
+ require_relative "init"
3
+ require_relative "utils"
2
4
 
3
5
  module IsoDoc
4
6
  module Generic
@@ -22,14 +24,19 @@ module IsoDoc
22
24
  k._file = caller_locations.first.absolute_path
23
25
  end
24
26
 
25
- def baselocation(loc)
27
+ =begin
28
+ def baselocation(loc)
26
29
  return nil if loc.nil?
27
- File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
30
+ File.expand_path(File.join(File.dirname(
31
+ self.class.respond_to?(:_file) ? (self.class::_file || __FILE__) :
32
+ __FILE__),
33
+ "..", "..", "..", loc))
28
34
  end
29
35
 
30
36
  def configuration
31
37
  Metanorma::Generic.configuration
32
38
  end
39
+ =end
33
40
 
34
41
  def author(isoxml, _out)
35
42
  super
@@ -53,6 +60,8 @@ module IsoDoc
53
60
  set(e.to_sym, b)
54
61
  end
55
62
  end
63
+
64
+ include Utils
56
65
  end
57
66
  end
58
67
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -58,6 +59,7 @@ module IsoDoc
58
59
  end
59
60
 
60
61
  include BaseConvert
62
+ include Init
61
63
  end
62
64
  end
63
65
  end
@@ -1,9 +1,19 @@
1
- require_relative "base_convert"
1
+ require_relative "init"
2
+ require_relative "metadata"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
5
6
  module Generic
6
7
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
8
+ def annex1(f)
9
+ lbl = @xrefs.anchor(f['id'], :label)
10
+ if t = f.at(ns("./title"))
11
+ t.children = "<strong>#{t.children.to_xml}</strong>"
12
+ end
13
+ prefix_name(f, "<br/>", lbl, "title")
14
+ end
15
+
16
+ include Init
7
17
  end
8
18
  end
9
19
  end
@@ -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
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "isodoc"
3
4
 
4
5
  module IsoDoc
@@ -22,8 +23,14 @@ module IsoDoc
22
23
 
23
24
  def default_fonts(options)
24
25
  {
25
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : configuration.word_bodyfont || '"Arial",sans-serif'),
26
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : 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
+ ),
27
34
  monospacefont: configuration.word_monospacefont || '"Courier New",monospace'
28
35
  }
29
36
  end
@@ -31,26 +38,30 @@ module IsoDoc
31
38
  def default_file_locations(options)
32
39
  {
33
40
  wordstylesheet: baselocation(configuration.wordstylesheet) ||
34
- html_doc_path("wordstyle.scss"),
41
+ html_doc_path("wordstyle.scss"),
35
42
  standardstylesheet: baselocation(configuration.standardstylesheet) ||
36
- html_doc_path("generic.scss"),
43
+ html_doc_path("generic.scss"),
37
44
  header: baselocation(configuration.header) ||
38
- html_doc_path("header.html"),
45
+ html_doc_path("header.html"),
39
46
  wordcoverpage: baselocation(configuration.wordcoverpage) ||
40
- html_doc_path("word_generic_titlepage.html"),
47
+ html_doc_path("word_generic_titlepage.html"),
41
48
  wordintropage: baselocation(configuration.wordintropage) ||
42
- html_doc_path("word_generic_intro.html"),
43
- i18nyaml: baselocation(configuration.i18nyaml),
44
- ulstyle: "l3",
45
- 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",
46
54
  }
47
55
  end
48
56
 
57
+ =begin
49
58
  def configuration
50
59
  Metanorma::Generic.configuration
51
60
  end
61
+ =end
52
62
 
53
63
  include BaseConvert
64
+ include Init
54
65
  end
55
66
  end
56
67
  end
@@ -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.5.1"
3
+ VERSION = "1.7.0"
4
4
  end
5
5
  end
@@ -28,10 +28,11 @@ 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.4.0"
32
- spec.add_dependency "isodoc", "~> 1.1.0"
31
+ spec.add_dependency "metanorma-standoc", "~> 1.6.0"
32
+ spec.add_dependency "isodoc", "~> 1.2.0"
33
33
 
34
34
  spec.add_development_dependency "byebug", "~> 9.1"
35
+ spec.add_development_dependency "sassc", "2.4.0"
35
36
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
36
37
  spec.add_development_dependency "guard", "~> 2.14"
37
38
  spec.add_development_dependency "guard-rspec", "~> 4.7"
@@ -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.5.1
4
+ version: 1.7.0
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-07-10 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.4.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.4.0
54
+ version: 1.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: isodoc
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.0
61
+ version: 1.2.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: 1.1.0
68
+ version: 1.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: byebug
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '9.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sassc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 2.4.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.4.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: equivalent-xml
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -239,9 +253,12 @@ files:
239
253
  - lib/isodoc/generic/html/word_generic_titlepage.html
240
254
  - lib/isodoc/generic/html/wordstyle.scss
241
255
  - lib/isodoc/generic/html_convert.rb
256
+ - lib/isodoc/generic/i18n.rb
257
+ - lib/isodoc/generic/init.rb
242
258
  - lib/isodoc/generic/metadata.rb
243
259
  - lib/isodoc/generic/pdf_convert.rb
244
260
  - lib/isodoc/generic/presentation_xml_convert.rb
261
+ - lib/isodoc/generic/utils.rb
245
262
  - lib/isodoc/generic/word_convert.rb
246
263
  - lib/isodoc/generic/xref.rb
247
264
  - lib/metanorma-generic.rb