metanorma-iho 0.2.0 → 0.2.5
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 +23 -0
- data/lib/asciidoctor/iho/converter.rb +12 -4
- data/lib/asciidoctor/iho/iho.rng +37 -6
- data/lib/asciidoctor/iho/isodoc.rng +124 -15
- data/lib/isodoc/iho/base_convert.rb +121 -1
- data/lib/isodoc/iho/html/htmlstyle.css +1 -1
- data/lib/isodoc/iho/html/iho.css +16 -4
- data/lib/isodoc/iho/html/iho.scss +18 -4
- data/lib/isodoc/iho/html_convert.rb +1 -0
- data/lib/isodoc/iho/i18n-en.yaml +2 -0
- data/lib/isodoc/iho/iho.specification.xsl +1227 -260
- data/lib/isodoc/iho/iho.standard.xsl +1227 -260
- data/lib/isodoc/iho/init.rb +3 -1
- data/lib/isodoc/iho/metadata.rb +0 -8
- data/lib/isodoc/iho/word_convert.rb +1 -0
- data/lib/isodoc/iho/xref.rb +11 -1
- data/lib/metanorma/iho/version.rb +1 -1
- data/metanorma-iho.gemspec +1 -2
- data/metanorma.yml +1 -0
- metadata +5 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 220adb84380d83295f89f7657a7311c2242c0b36ca7ad3cf8f87badc7a53d9a9
|
4
|
+
data.tar.gz: b5d713d761cc297c8cb434912eb1ebb3b8ee541036f05679341c62d94141ec45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1046417d144ae07ced41c663572cc23f4b95526b61d0a59f5f8525b3b4e38906e70c2737cc54de5488f556e2e58f878008792f82352485875829662b1372bbb3
|
7
|
+
data.tar.gz: 7f1a7d1208ace1b629eb26214ac2938f8e1bc45b1c6897b4cdac08d67182d609d5c5ee06d7ed9cbd259aa007a7eaf43856f1c606068fa969734375715db991db
|
@@ -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
|
@@ -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>
|
@@ -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">
|
@@ -124,6 +148,13 @@
|
|
124
148
|
</define>
|
125
149
|
<define name="iho-standard">
|
126
150
|
<element name="iho-standard">
|
151
|
+
<attribute name="version"/>
|
152
|
+
<attribute name="type">
|
153
|
+
<choice>
|
154
|
+
<value>semantic</value>
|
155
|
+
<value>presentation</value>
|
156
|
+
</choice>
|
157
|
+
</attribute>
|
127
158
|
<ref name="bibdata"/>
|
128
159
|
<zeroOrMore>
|
129
160
|
<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="
|
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="
|
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
|
-
<
|
1053
|
-
<
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1057
|
-
<
|
1058
|
-
|
1059
|
-
|
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"/>
|
@@ -1453,11 +1492,6 @@
|
|
1453
1492
|
</optional>
|
1454
1493
|
</element>
|
1455
1494
|
</define>
|
1456
|
-
<define name="preface_abstract">
|
1457
|
-
<element name="abstract">
|
1458
|
-
<ref name="Basic-Section"/>
|
1459
|
-
</element>
|
1460
|
-
</define>
|
1461
1495
|
<define name="term-clause">
|
1462
1496
|
<element name="clause">
|
1463
1497
|
<optional>
|
@@ -1507,4 +1541,79 @@
|
|
1507
1541
|
<ref name="CitationType"/>
|
1508
1542
|
</element>
|
1509
1543
|
</define>
|
1544
|
+
<define name="amend">
|
1545
|
+
<element name="amend">
|
1546
|
+
<optional>
|
1547
|
+
<attribute name="id">
|
1548
|
+
<data type="ID"/>
|
1549
|
+
</attribute>
|
1550
|
+
</optional>
|
1551
|
+
<attribute name="change">
|
1552
|
+
<choice>
|
1553
|
+
<value>add</value>
|
1554
|
+
<value>modify</value>
|
1555
|
+
<value>delete</value>
|
1556
|
+
</choice>
|
1557
|
+
</attribute>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="path"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<attribute name="path_end"/>
|
1563
|
+
</optional>
|
1564
|
+
<optional>
|
1565
|
+
<attribute name="title"/>
|
1566
|
+
</optional>
|
1567
|
+
<optional>
|
1568
|
+
<element name="location">
|
1569
|
+
<zeroOrMore>
|
1570
|
+
<ref name="locality"/>
|
1571
|
+
</zeroOrMore>
|
1572
|
+
</element>
|
1573
|
+
</optional>
|
1574
|
+
<zeroOrMore>
|
1575
|
+
<ref name="autonumber"/>
|
1576
|
+
</zeroOrMore>
|
1577
|
+
<optional>
|
1578
|
+
<element name="description">
|
1579
|
+
<zeroOrMore>
|
1580
|
+
<ref name="BasicBlock"/>
|
1581
|
+
</zeroOrMore>
|
1582
|
+
</element>
|
1583
|
+
</optional>
|
1584
|
+
<optional>
|
1585
|
+
<element name="newcontent">
|
1586
|
+
<zeroOrMore>
|
1587
|
+
<ref name="BasicBlock"/>
|
1588
|
+
</zeroOrMore>
|
1589
|
+
</element>
|
1590
|
+
</optional>
|
1591
|
+
<optional>
|
1592
|
+
<element name="description">
|
1593
|
+
<zeroOrMore>
|
1594
|
+
<ref name="BasicBlock"/>
|
1595
|
+
</zeroOrMore>
|
1596
|
+
</element>
|
1597
|
+
</optional>
|
1598
|
+
</element>
|
1599
|
+
</define>
|
1600
|
+
<define name="autonumber">
|
1601
|
+
<element name="autonumber">
|
1602
|
+
<attribute name="type">
|
1603
|
+
<choice>
|
1604
|
+
<value>requirement</value>
|
1605
|
+
<value>recommendation</value>
|
1606
|
+
<value>permission</value>
|
1607
|
+
<value>table</value>
|
1608
|
+
<value>figure</value>
|
1609
|
+
<value>admonition</value>
|
1610
|
+
<value>formula</value>
|
1611
|
+
<value>sourcecode</value>
|
1612
|
+
<value>example</value>
|
1613
|
+
<value>note</value>
|
1614
|
+
</choice>
|
1615
|
+
</attribute>
|
1616
|
+
<text/>
|
1617
|
+
</element>
|
1618
|
+
</define>
|
1510
1619
|
</grammar>
|
@@ -12,9 +12,129 @@ module IsoDoc
|
|
12
12
|
|
13
13
|
def info(isoxml, out)
|
14
14
|
@meta.series isoxml, out
|
15
|
-
@meta.commentperiod isoxml, out
|
16
15
|
super
|
17
16
|
end
|
17
|
+
|
18
|
+
def std_bibitem_entry(list, b, ordinal, biblio)
|
19
|
+
list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
|
20
|
+
prefix_bracketed_ref(ref, "[#{ordinal}]")
|
21
|
+
standard_citation(ref, b)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def nodes_to_span(n)
|
26
|
+
noko do |xml|
|
27
|
+
xml.span do |s|
|
28
|
+
n&.children&.each { |x| parse(x, s) }
|
29
|
+
end
|
30
|
+
end.join("")
|
31
|
+
end
|
32
|
+
|
33
|
+
def multiplenames_and(names)
|
34
|
+
return "" if names.length == 0
|
35
|
+
return names[0] if names.length == 1
|
36
|
+
return "#{names[0]} and #{names[1]}" if names.length == 2
|
37
|
+
names[0..-2].join(", ") + " and #{names[-1]}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def extract_publisher(b)
|
41
|
+
c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
|
42
|
+
abbrs = []
|
43
|
+
names = []
|
44
|
+
c&.each do |c1|
|
45
|
+
n = c1.at(ns("./organization/name")) or next
|
46
|
+
abbrs << (c1.at(ns("./organization/abbreviation")) || n)
|
47
|
+
names << nodes_to_span(n)
|
48
|
+
end
|
49
|
+
return [nil, nil] if names.empty?
|
50
|
+
return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
|
51
|
+
end
|
52
|
+
|
53
|
+
def inline_bibitem_ref_code(b)
|
54
|
+
id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
|
55
|
+
"or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
|
56
|
+
id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
|
57
|
+
return [nil, id, nil] if id
|
58
|
+
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
59
|
+
id << "(NO ID)"
|
60
|
+
[nil, id, nil]
|
61
|
+
end
|
62
|
+
|
63
|
+
def extract_edition(b)
|
64
|
+
b&.at(ns("./edition"))&.text
|
65
|
+
end
|
66
|
+
|
67
|
+
def extract_uri(b)
|
68
|
+
b.at(ns("./uri"))
|
69
|
+
end
|
70
|
+
|
71
|
+
def omit_docid_prefix(prefix)
|
72
|
+
return true if prefix == "IHO"
|
73
|
+
super
|
74
|
+
end
|
75
|
+
|
76
|
+
def render_identifier(id)
|
77
|
+
if !id[1].nil? and id[1]["type"] == "IHO"
|
78
|
+
id[1].children = id[1].text.sub(/^IHO /, "")
|
79
|
+
end
|
80
|
+
super
|
81
|
+
end
|
82
|
+
|
83
|
+
def extract_publisher(b)
|
84
|
+
c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
|
85
|
+
abbrs = []
|
86
|
+
names = []
|
87
|
+
c&.each do |c1|
|
88
|
+
n = c1.at(ns("./organization/name")) or next
|
89
|
+
abbrs << (c1.at(ns("./organization/abbreviation")) || n)
|
90
|
+
names << nodes_to_span(n)
|
91
|
+
end
|
92
|
+
return [nil, nil] if names.empty?
|
93
|
+
return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
|
94
|
+
end
|
95
|
+
|
96
|
+
def extract_author(b)
|
97
|
+
c = b.xpath(ns("./contributor[role/@type = 'author']"))
|
98
|
+
c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
|
99
|
+
return extract_publisher(b)[0] if c.empty?
|
100
|
+
c.map do |c1|
|
101
|
+
c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
|
102
|
+
end.reject { |e| e.nil? || e.empty? }.join(", ")
|
103
|
+
end
|
104
|
+
|
105
|
+
def extract_person_name(b)
|
106
|
+
p = b.at(ns("./person/name")) or return
|
107
|
+
c = p.at(ns("./completename")) and return c.text
|
108
|
+
s = p&.at(ns("./surname"))&.text or return
|
109
|
+
i = p.xpath(ns("./initial")) and
|
110
|
+
front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join("")
|
111
|
+
i.empty? and f = p.xpath(ns("./forename")) and
|
112
|
+
front = f.map { |e| e.text[0].upcase }.join("")
|
113
|
+
front ? "#{s} #{front}" : s
|
114
|
+
end
|
115
|
+
|
116
|
+
def is_iho?(b)
|
117
|
+
extract_publisher(b)[1] == "IHO"
|
118
|
+
end
|
119
|
+
|
120
|
+
# [{number}] {docID} edition {edition}: {title}, {author/organization}
|
121
|
+
def standard_citation(out, b)
|
122
|
+
if ftitle = b.at(ns("./formattedref"))
|
123
|
+
ftitle&.children&.each { |n| parse(n, out) }
|
124
|
+
else
|
125
|
+
id = render_identifier(inline_bibitem_ref_code(b))
|
126
|
+
out << id[1] if id[1]
|
127
|
+
ed = extract_edition(b) if is_iho?(b)
|
128
|
+
out << " edition #{ed}" if ed
|
129
|
+
out << ": " if id[1] || ed
|
130
|
+
iso_title(b)&.children&.each { |n| parse(n, out) }
|
131
|
+
out << ", "
|
132
|
+
author = extract_author(b)
|
133
|
+
out << author
|
134
|
+
u = extract_uri(b)
|
135
|
+
out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
|
136
|
+
end
|
137
|
+
end
|
18
138
|
end
|
19
139
|
end
|
20
140
|
end
|