metanorma-iho 0.1.2 → 0.2.4
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 +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 +137 -21
- data/lib/isodoc/iho/base_convert.rb +121 -10
- 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 +14 -12
- data/lib/isodoc/iho/i18n-en.yaml +2 -0
- data/lib/isodoc/iho/iho.specification.xsl +2216 -1464
- data/lib/isodoc/iho/iho.standard.xsl +2216 -1464
- 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 +12 -2
- data/lib/metanorma/iho/version.rb +1 -1
- data/metanorma-iho.gemspec +2 -3
- data/metanorma.yml +1 -0
- metadata +8 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfcef8b84ef111f6f524d3be2ab6e10a1f5a167e78340028484ddce1e2dbcd2e
|
4
|
+
data.tar.gz: b43a8f171ddce0f39422172bce91c522abbbb26cd4ed71374feaa4156b544766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f394dc0d1fb60c38446fc4c9331b8e8d6c7a21a9669584740912cc7c4c299a5ea80d0a026af23d2f2b519a3bbe2bf500cb64d4cdb3721fe27aa86c3960ae924
|
7
|
+
data.tar.gz: d009ab8824da4788e723e734320c3d95641fc52541fbce2f3f2af843bcf653382c52b15c78114389bf4da46abd9b3b484c7da51b7f7d6c239c2db0925dd6939b
|
@@ -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"/>
|
@@ -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">
|
@@ -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="
|
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
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
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,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
|