metanorma-iho 0.1.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -1
- data/lib/asciidoctor/iho/basicdoc.rng +31 -1
- data/lib/asciidoctor/iho/converter.rb +12 -4
- data/lib/asciidoctor/iho/iho.rng +30 -6
- data/lib/asciidoctor/iho/isodoc.rng +124 -15
- data/lib/isodoc/iho/base_convert.rb +121 -10
- data/lib/isodoc/iho/html/htmlstyle.css +1007 -0
- data/lib/isodoc/iho/html/iho.css +810 -0
- data/lib/isodoc/iho/html/iho.scss +18 -4
- data/lib/isodoc/iho/html/wordstyle.css +1252 -0
- data/lib/isodoc/iho/html_convert.rb +14 -12
- data/lib/isodoc/iho/i18n-en.yaml +2 -0
- data/lib/isodoc/iho/iho.specification.xsl +2093 -1478
- data/lib/isodoc/iho/iho.standard.xsl +2093 -1478
- data/lib/isodoc/iho/init.rb +25 -0
- data/lib/isodoc/iho/pdf_convert.rb +0 -1
- data/lib/isodoc/iho/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/iho/word_convert.rb +3 -1
- data/lib/isodoc/iho/xref.rb +11 -1
- data/lib/metanorma/iho/version.rb +1 -1
- data/metanorma-iho.gemspec +3 -3
- data/metanorma.yml +1 -0
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d513e582275fa2fbac4716c2367a85aefd6f5b26dd8e4f2f7d10608d98c6c96
|
4
|
+
data.tar.gz: 3e9150114684366020f5c8516cb737931c07c5973a0abe5a08120d9867c97f19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7c802926f806a98b5a9da05b1553c46ae56d827a11d0336afeb5faa87c029eb33f997dbfd4fc9c7d9f407d9e24075c85a6d0d6b5ddae2e61ec2385af47b5554
|
7
|
+
data.tar.gz: 0c9fe3c49478aa81331e460d5d2b1375c49c38c26ce647b3bec270c0f6b87fb79502d147790ba51c6ec608c6736a3203935f087698cb5745de4c3257c3cabd4a
|
@@ -39,7 +39,7 @@ jobs:
|
|
39
39
|
polling_interval_seconds: 5
|
40
40
|
timeout_minutes: 5
|
41
41
|
max_attempts: 3
|
42
|
-
command: sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
42
|
+
command: sudo apt-get update -y && sudo bash -c "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
|
43
43
|
- name: Run specs
|
44
44
|
run: |
|
45
45
|
bundle exec rake
|
@@ -158,7 +158,17 @@
|
|
158
158
|
<data type="ID"/>
|
159
159
|
</attribute>
|
160
160
|
<oneOrMore>
|
161
|
-
<
|
161
|
+
<choice>
|
162
|
+
<ref name="formula"/>
|
163
|
+
<ref name="ul"/>
|
164
|
+
<ref name="ol"/>
|
165
|
+
<ref name="dl"/>
|
166
|
+
<ref name="quote"/>
|
167
|
+
<ref name="sourcecode"/>
|
168
|
+
<ref name="paragraph"/>
|
169
|
+
<ref name="table"/>
|
170
|
+
<ref name="figure"/>
|
171
|
+
</choice>
|
162
172
|
</oneOrMore>
|
163
173
|
</element>
|
164
174
|
</define>
|
@@ -402,6 +412,16 @@
|
|
402
412
|
</choice>
|
403
413
|
</attribute>
|
404
414
|
</optional>
|
415
|
+
<optional>
|
416
|
+
<attribute name="valign">
|
417
|
+
<choice>
|
418
|
+
<value>top</value>
|
419
|
+
<value>middle</value>
|
420
|
+
<value>bottom</value>
|
421
|
+
<value>baseline</value>
|
422
|
+
</choice>
|
423
|
+
</attribute>
|
424
|
+
</optional>
|
405
425
|
<choice>
|
406
426
|
<zeroOrMore>
|
407
427
|
<ref name="TextElement"/>
|
@@ -429,6 +449,16 @@
|
|
429
449
|
</choice>
|
430
450
|
</attribute>
|
431
451
|
</optional>
|
452
|
+
<optional>
|
453
|
+
<attribute name="valign">
|
454
|
+
<choice>
|
455
|
+
<value>top</value>
|
456
|
+
<value>middle</value>
|
457
|
+
<value>bottom</value>
|
458
|
+
<value>baseline</value>
|
459
|
+
</choice>
|
460
|
+
</attribute>
|
461
|
+
</optional>
|
432
462
|
<choice>
|
433
463
|
<zeroOrMore>
|
434
464
|
<ref name="TextElement"/>
|
@@ -67,14 +67,22 @@ module Asciidoctor
|
|
67
67
|
|
68
68
|
def metadata_committee1(node, xml)
|
69
69
|
xml.editorialgroup do |a|
|
70
|
-
a.committee
|
71
|
-
|
70
|
+
a.committee do |n|
|
71
|
+
n.abbreviation node.attr("committee").upcase
|
72
|
+
end
|
73
|
+
a.workgroup do |n|
|
74
|
+
n.abbreviation node.attr("workgroup").upcase
|
75
|
+
end
|
72
76
|
end
|
73
77
|
i = 2
|
74
78
|
while node.attr("workgroup_#{i}") do
|
75
79
|
xml.editorialgroup do |a|
|
76
|
-
a.committee
|
77
|
-
|
80
|
+
a.committee do |n|
|
81
|
+
n.abbreviation node.attr("committee_#{i}").upcase
|
82
|
+
end
|
83
|
+
a.workgroup do |n|
|
84
|
+
n.abbreviation node.attr("workgroup_#{i}").upcase
|
85
|
+
end
|
78
86
|
end
|
79
87
|
i += 1
|
80
88
|
end
|
data/lib/asciidoctor/iho/iho.rng
CHANGED
@@ -23,8 +23,13 @@
|
|
23
23
|
</define>
|
24
24
|
<define name="editorialgroup">
|
25
25
|
<element name="editorialgroup">
|
26
|
-
<
|
27
|
-
|
26
|
+
<oneOrMore>
|
27
|
+
<choice>
|
28
|
+
<ref name="committee"/>
|
29
|
+
<ref name="workgroup"/>
|
30
|
+
<ref name="commission"/>
|
31
|
+
</choice>
|
32
|
+
</oneOrMore>
|
28
33
|
</element>
|
29
34
|
</define>
|
30
35
|
<define name="BibDataExtensionType">
|
@@ -94,16 +99,35 @@
|
|
94
99
|
</include>
|
95
100
|
<define name="committee">
|
96
101
|
<element name="committee">
|
97
|
-
<
|
98
|
-
<value>hssc</value>
|
99
|
-
<value>ircc</value>
|
100
|
-
</choice>
|
102
|
+
<ref name="IHO_Group"/>
|
101
103
|
</element>
|
102
104
|
</define>
|
103
105
|
<define name="workgroup">
|
104
106
|
<element name="workgroup">
|
107
|
+
<ref name="IHO_Group"/>
|
108
|
+
</element>
|
109
|
+
</define>
|
110
|
+
<define name="commission">
|
111
|
+
<element name="commission">
|
112
|
+
<ref name="IHO_Group"/>
|
113
|
+
</element>
|
114
|
+
</define>
|
115
|
+
<define name="IHO_Group">
|
116
|
+
<optional>
|
117
|
+
<element name="name">
|
118
|
+
<text/>
|
119
|
+
</element>
|
120
|
+
</optional>
|
121
|
+
<element name="abbreviation">
|
105
122
|
<text/>
|
106
123
|
</element>
|
124
|
+
<optional>
|
125
|
+
<choice>
|
126
|
+
<ref name="committee"/>
|
127
|
+
<ref name="workgroup"/>
|
128
|
+
<ref name="commission"/>
|
129
|
+
</choice>
|
130
|
+
</optional>
|
107
131
|
</define>
|
108
132
|
<define name="annex-appendix">
|
109
133
|
<element name="appendix">
|
@@ -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="
|
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">
|
@@ -578,6 +581,8 @@
|
|
578
581
|
<ref name="ol"/>
|
579
582
|
<ref name="dl"/>
|
580
583
|
<ref name="formula"/>
|
584
|
+
<ref name="quote"/>
|
585
|
+
<ref name="sourcecode"/>
|
581
586
|
</choice>
|
582
587
|
</oneOrMore>
|
583
588
|
</element>
|
@@ -661,6 +666,16 @@
|
|
661
666
|
</choice>
|
662
667
|
</attribute>
|
663
668
|
</optional>
|
669
|
+
<optional>
|
670
|
+
<attribute name="valign">
|
671
|
+
<choice>
|
672
|
+
<value>top</value>
|
673
|
+
<value>middle</value>
|
674
|
+
<value>bottom</value>
|
675
|
+
<value>baseline</value>
|
676
|
+
</choice>
|
677
|
+
</attribute>
|
678
|
+
</optional>
|
664
679
|
<choice>
|
665
680
|
<zeroOrMore>
|
666
681
|
<choice>
|
@@ -697,6 +712,16 @@
|
|
697
712
|
</choice>
|
698
713
|
</attribute>
|
699
714
|
</optional>
|
715
|
+
<optional>
|
716
|
+
<attribute name="valign">
|
717
|
+
<choice>
|
718
|
+
<value>top</value>
|
719
|
+
<value>middle</value>
|
720
|
+
<value>bottom</value>
|
721
|
+
<value>baseline</value>
|
722
|
+
</choice>
|
723
|
+
</attribute>
|
724
|
+
</optional>
|
700
725
|
<choice>
|
701
726
|
<zeroOrMore>
|
702
727
|
<choice>
|
@@ -922,6 +947,9 @@
|
|
922
947
|
<optional>
|
923
948
|
<attribute name="script"/>
|
924
949
|
</optional>
|
950
|
+
<optional>
|
951
|
+
<attribute name="type"/>
|
952
|
+
</optional>
|
925
953
|
<optional>
|
926
954
|
<attribute name="obligation">
|
927
955
|
<choice>
|
@@ -961,9 +989,6 @@
|
|
961
989
|
</define>
|
962
990
|
<define name="content-subsection">
|
963
991
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
992
|
<ref name="Content-Section"/>
|
968
993
|
</element>
|
969
994
|
</define>
|
@@ -992,6 +1017,9 @@
|
|
992
1017
|
</choice>
|
993
1018
|
</attribute>
|
994
1019
|
</optional>
|
1020
|
+
<optional>
|
1021
|
+
<attribute name="type"/>
|
1022
|
+
</optional>
|
995
1023
|
<optional>
|
996
1024
|
<ref name="section-title"/>
|
997
1025
|
</optional>
|
@@ -1011,9 +1039,6 @@
|
|
1011
1039
|
</define>
|
1012
1040
|
<define name="clause">
|
1013
1041
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1042
|
<ref name="Clause-Section"/>
|
1018
1043
|
</element>
|
1019
1044
|
</define>
|
@@ -1042,18 +1067,24 @@
|
|
1042
1067
|
</choice>
|
1043
1068
|
</attribute>
|
1044
1069
|
</optional>
|
1070
|
+
<optional>
|
1071
|
+
<attribute name="type"/>
|
1072
|
+
</optional>
|
1045
1073
|
<optional>
|
1046
1074
|
<ref name="section-title"/>
|
1047
1075
|
</optional>
|
1048
1076
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1077
|
+
<choice>
|
1078
|
+
<group>
|
1079
|
+
<zeroOrMore>
|
1080
|
+
<ref name="BasicBlock"/>
|
1081
|
+
</zeroOrMore>
|
1082
|
+
<zeroOrMore>
|
1083
|
+
<ref name="note"/>
|
1084
|
+
</zeroOrMore>
|
1085
|
+
</group>
|
1086
|
+
<ref name="amend"/>
|
1087
|
+
</choice>
|
1057
1088
|
<zeroOrMore>
|
1058
1089
|
<choice>
|
1059
1090
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1211,9 @@
|
|
1180
1211
|
<optional>
|
1181
1212
|
<attribute name="script"/>
|
1182
1213
|
</optional>
|
1214
|
+
<optional>
|
1215
|
+
<attribute name="type"/>
|
1216
|
+
</optional>
|
1183
1217
|
<optional>
|
1184
1218
|
<attribute name="obligation">
|
1185
1219
|
<choice>
|
@@ -1501,4 +1535,79 @@
|
|
1501
1535
|
<ref name="CitationType"/>
|
1502
1536
|
</element>
|
1503
1537
|
</define>
|
1538
|
+
<define name="amend">
|
1539
|
+
<element name="amend">
|
1540
|
+
<optional>
|
1541
|
+
<attribute name="id">
|
1542
|
+
<data type="ID"/>
|
1543
|
+
</attribute>
|
1544
|
+
</optional>
|
1545
|
+
<attribute name="change">
|
1546
|
+
<choice>
|
1547
|
+
<value>add</value>
|
1548
|
+
<value>modify</value>
|
1549
|
+
<value>delete</value>
|
1550
|
+
</choice>
|
1551
|
+
</attribute>
|
1552
|
+
<optional>
|
1553
|
+
<attribute name="path"/>
|
1554
|
+
</optional>
|
1555
|
+
<optional>
|
1556
|
+
<attribute name="path_end"/>
|
1557
|
+
</optional>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="title"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<element name="location">
|
1563
|
+
<zeroOrMore>
|
1564
|
+
<ref name="locality"/>
|
1565
|
+
</zeroOrMore>
|
1566
|
+
</element>
|
1567
|
+
</optional>
|
1568
|
+
<zeroOrMore>
|
1569
|
+
<ref name="autonumber"/>
|
1570
|
+
</zeroOrMore>
|
1571
|
+
<optional>
|
1572
|
+
<element name="description">
|
1573
|
+
<zeroOrMore>
|
1574
|
+
<ref name="BasicBlock"/>
|
1575
|
+
</zeroOrMore>
|
1576
|
+
</element>
|
1577
|
+
</optional>
|
1578
|
+
<optional>
|
1579
|
+
<element name="newcontent">
|
1580
|
+
<zeroOrMore>
|
1581
|
+
<ref name="BasicBlock"/>
|
1582
|
+
</zeroOrMore>
|
1583
|
+
</element>
|
1584
|
+
</optional>
|
1585
|
+
<optional>
|
1586
|
+
<element name="description">
|
1587
|
+
<zeroOrMore>
|
1588
|
+
<ref name="BasicBlock"/>
|
1589
|
+
</zeroOrMore>
|
1590
|
+
</element>
|
1591
|
+
</optional>
|
1592
|
+
</element>
|
1593
|
+
</define>
|
1594
|
+
<define name="autonumber">
|
1595
|
+
<element name="autonumber">
|
1596
|
+
<attribute name="type">
|
1597
|
+
<choice>
|
1598
|
+
<value>requirement</value>
|
1599
|
+
<value>recommendation</value>
|
1600
|
+
<value>permission</value>
|
1601
|
+
<value>table</value>
|
1602
|
+
<value>figure</value>
|
1603
|
+
<value>admonition</value>
|
1604
|
+
<value>formula</value>
|
1605
|
+
<value>sourcecode</value>
|
1606
|
+
<value>example</value>
|
1607
|
+
<value>note</value>
|
1608
|
+
</choice>
|
1609
|
+
</attribute>
|
1610
|
+
<text/>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1504
1613
|
</grammar>
|
@@ -1,16 +1,6 @@
|
|
1
|
-
require_relative "xref"
|
2
|
-
|
3
1
|
module IsoDoc
|
4
2
|
module IHO
|
5
3
|
module BaseConvert
|
6
|
-
def metadata_init(lang, script, labels)
|
7
|
-
@meta = Metadata.new(lang, script, labels)
|
8
|
-
end
|
9
|
-
|
10
|
-
def xref_init(lang, script, klass, labels, options)
|
11
|
-
@xrefs = Xref.new(lang, script, klass, labels, options)
|
12
|
-
end
|
13
|
-
|
14
4
|
# terms not defined in standoc
|
15
5
|
def error_parse(node, out)
|
16
6
|
case node.name
|
@@ -25,6 +15,127 @@ module IsoDoc
|
|
25
15
|
@meta.commentperiod isoxml, out
|
26
16
|
super
|
27
17
|
end
|
18
|
+
|
19
|
+
def std_bibitem_entry(list, b, ordinal, biblio)
|
20
|
+
list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
|
21
|
+
prefix_bracketed_ref(ref, "[#{ordinal}]")
|
22
|
+
standard_citation(ref, b)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def nodes_to_span(n)
|
27
|
+
noko do |xml|
|
28
|
+
xml.span do |s|
|
29
|
+
n&.children&.each { |x| parse(x, s) }
|
30
|
+
end
|
31
|
+
end.join("")
|
32
|
+
end
|
33
|
+
|
34
|
+
def multiplenames_and(names)
|
35
|
+
return "" if names.length == 0
|
36
|
+
return names[0] if names.length == 1
|
37
|
+
return "#{names[0]} and #{names[1]}" if names.length == 2
|
38
|
+
names[0..-2].join(", ") + " and #{names[-1]}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def extract_publisher(b)
|
42
|
+
c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
|
43
|
+
abbrs = []
|
44
|
+
names = []
|
45
|
+
c&.each do |c1|
|
46
|
+
n = c1.at(ns("./organization/name")) or next
|
47
|
+
abbrs << (c1.at(ns("./organization/abbreviation")) || n)
|
48
|
+
names << nodes_to_span(n)
|
49
|
+
end
|
50
|
+
return [nil, nil] if names.empty?
|
51
|
+
return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
|
52
|
+
end
|
53
|
+
|
54
|
+
def inline_bibitem_ref_code(b)
|
55
|
+
id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
|
56
|
+
"or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
|
57
|
+
id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
|
58
|
+
return [nil, id, nil] if id
|
59
|
+
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
60
|
+
id << "(NO ID)"
|
61
|
+
[nil, id, nil]
|
62
|
+
end
|
63
|
+
|
64
|
+
def extract_edition(b)
|
65
|
+
b&.at(ns("./edition"))&.text
|
66
|
+
end
|
67
|
+
|
68
|
+
def extract_uri(b)
|
69
|
+
b.at(ns("./uri"))
|
70
|
+
end
|
71
|
+
|
72
|
+
def omit_docid_prefix(prefix)
|
73
|
+
return true if prefix == "IHO"
|
74
|
+
super
|
75
|
+
end
|
76
|
+
|
77
|
+
def render_identifier(id)
|
78
|
+
if !id[1].nil? and id[1]["type"] == "IHO"
|
79
|
+
id[1].children = id[1].text.sub(/^IHO /, "")
|
80
|
+
end
|
81
|
+
super
|
82
|
+
end
|
83
|
+
|
84
|
+
def extract_publisher(b)
|
85
|
+
c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
|
86
|
+
abbrs = []
|
87
|
+
names = []
|
88
|
+
c&.each do |c1|
|
89
|
+
n = c1.at(ns("./organization/name")) or next
|
90
|
+
abbrs << (c1.at(ns("./organization/abbreviation")) || n)
|
91
|
+
names << nodes_to_span(n)
|
92
|
+
end
|
93
|
+
return [nil, nil] if names.empty?
|
94
|
+
return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
|
95
|
+
end
|
96
|
+
|
97
|
+
def extract_author(b)
|
98
|
+
c = b.xpath(ns("./contributor[role/@type = 'author']"))
|
99
|
+
c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
|
100
|
+
return extract_publisher(b)[0] if c.empty?
|
101
|
+
c.map do |c1|
|
102
|
+
c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
|
103
|
+
end.reject { |e| e.nil? || e.empty? }.join(", ")
|
104
|
+
end
|
105
|
+
|
106
|
+
def extract_person_name(b)
|
107
|
+
p = b.at(ns("./person/name")) or return
|
108
|
+
c = p.at(ns("./completename")) and return c.text
|
109
|
+
s = p&.at(ns("./surname"))&.text or return
|
110
|
+
i = p.xpath(ns("./initial")) and
|
111
|
+
front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join("")
|
112
|
+
i.empty? and f = p.xpath(ns("./forename")) and
|
113
|
+
front = f.map { |e| e.text[0].upcase }.join("")
|
114
|
+
front ? "#{s} #{front}" : s
|
115
|
+
end
|
116
|
+
|
117
|
+
def is_iho?(b)
|
118
|
+
extract_publisher(b)[1] == "IHO"
|
119
|
+
end
|
120
|
+
|
121
|
+
# [{number}] {docID} edition {edition}: {title}, {author/organization}
|
122
|
+
def standard_citation(out, b)
|
123
|
+
if ftitle = b.at(ns("./formattedref"))
|
124
|
+
ftitle&.children&.each { |n| parse(n, out) }
|
125
|
+
else
|
126
|
+
id = render_identifier(inline_bibitem_ref_code(b))
|
127
|
+
out << id[1] if id[1]
|
128
|
+
ed = extract_edition(b) if is_iho?(b)
|
129
|
+
out << " edition #{ed}" if ed
|
130
|
+
out << ": " if id[1] || ed
|
131
|
+
iso_title(b)&.children&.each { |n| parse(n, out) }
|
132
|
+
out << ", "
|
133
|
+
author = extract_author(b)
|
134
|
+
out << author
|
135
|
+
u = extract_uri(b)
|
136
|
+
out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
|
137
|
+
end
|
138
|
+
end
|
28
139
|
end
|
29
140
|
end
|
30
141
|
end
|