metanorma-iso 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iso/base_convert.rb +2 -1
- data/lib/isodoc/iso/index.rb +2 -2
- data/lib/metanorma/iso/base.rb +4 -1
- data/lib/metanorma/iso/basicdoc.rng +18 -2
- data/lib/metanorma/iso/biblio.rng +1 -1
- data/lib/metanorma/iso/cleanup.rb +15 -13
- data/lib/metanorma/iso/front_id.rb +2 -1
- data/lib/metanorma/iso/isodoc.rng +26 -1
- data/lib/metanorma/iso/processor.rb +1 -0
- data/lib/metanorma/iso/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30229a0ddab3a83837d4f79b713bd7fa693798e810afeeb1fcdd85169aef9921
|
4
|
+
data.tar.gz: e09fbd0e70fbbe624ab4a82fb741715842e18f9a01d9e24fea986507a6b1710a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d34635dae39c8970d56bd3fb09c8366875c48ab705a3848ba52f3d61fb7b465788aa357ee5a31efd3a4088936fc1d46cfc3272892a8b1737ee7f0dcbbe0e2f9e
|
7
|
+
data.tar.gz: 1c72a98e61841ba18ec4f63f48edf6d1f8554ebd8d88b3d5f1a7d96c907c2c87fe5e576a81ae6b3ea589cbe76ab383abe76b3e5a74052d18ef5307f7bc36693a
|
@@ -125,8 +125,9 @@ module IsoDoc
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def figure_name_parse(_node, div, name)
|
128
|
+
name.nil? and return
|
128
129
|
div.p class: "FigureTitle", style: "text-align:center;" do |p|
|
129
|
-
name
|
130
|
+
name.children.each { |n| parse(n, p) }
|
130
131
|
end
|
131
132
|
end
|
132
133
|
|
data/lib/isodoc/iso/index.rb
CHANGED
@@ -8,7 +8,7 @@ module IsoDoc
|
|
8
8
|
def index(xml)
|
9
9
|
if xml.at(ns("//index"))
|
10
10
|
i = xml.at(ns("//indexsect")) ||
|
11
|
-
xml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
|
11
|
+
xml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}" \
|
12
12
|
"</title></indexsect>").first
|
13
13
|
index = sort_indexterms(xml.xpath(ns("//index")),
|
14
14
|
xml.xpath(ns("//index-xref[@also = 'false']")),
|
@@ -147,7 +147,7 @@ module IsoDoc
|
|
147
147
|
index2bookmark(t)
|
148
148
|
term_hash_init(v, term, term2, term3, :xref)
|
149
149
|
to = t["to"] ? "to='#{t['to']}' " : ""
|
150
|
-
v[term][term2][term3][:xref] << "<xref target='#{t['id']}' "\
|
150
|
+
v[term][term2][term3][:xref] << "<xref target='#{t['id']}' " \
|
151
151
|
"#{to}pagenumber='true'/>"
|
152
152
|
end
|
153
153
|
end
|
data/lib/metanorma/iso/base.rb
CHANGED
@@ -5,6 +5,7 @@ require "pathname"
|
|
5
5
|
require "open-uri"
|
6
6
|
require "isodoc"
|
7
7
|
require "fileutils"
|
8
|
+
require_relative "processor"
|
8
9
|
|
9
10
|
module Metanorma
|
10
11
|
module ISO
|
@@ -47,7 +48,9 @@ module Metanorma
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def presentation_xml_converter(node)
|
50
|
-
IsoDoc::Iso::PresentationXMLConvert
|
51
|
+
IsoDoc::Iso::PresentationXMLConvert
|
52
|
+
.new(html_extract_attributes(node)
|
53
|
+
.merge(output_formats: ::Metanorma::Iso::Processor.new.output_formats))
|
51
54
|
end
|
52
55
|
|
53
56
|
def init(node)
|
@@ -346,6 +346,8 @@
|
|
346
346
|
<ref name="keyword"/>
|
347
347
|
<ref name="xref"/>
|
348
348
|
<ref name="hyperlink"/>
|
349
|
+
<ref name="index"/>
|
350
|
+
<ref name="index-xref"/>
|
349
351
|
</choice>
|
350
352
|
</oneOrMore>
|
351
353
|
</element>
|
@@ -623,6 +625,8 @@
|
|
623
625
|
<ref name="eref"/>
|
624
626
|
<ref name="xref"/>
|
625
627
|
<ref name="hyperlink"/>
|
628
|
+
<ref name="index"/>
|
629
|
+
<ref name="index-xref"/>
|
626
630
|
</choice>
|
627
631
|
</zeroOrMore>
|
628
632
|
</element>
|
@@ -636,6 +640,8 @@
|
|
636
640
|
<ref name="eref"/>
|
637
641
|
<ref name="xref"/>
|
638
642
|
<ref name="hyperlink"/>
|
643
|
+
<ref name="index"/>
|
644
|
+
<ref name="index-xref"/>
|
639
645
|
</choice>
|
640
646
|
</zeroOrMore>
|
641
647
|
</element>
|
@@ -648,6 +654,8 @@
|
|
648
654
|
<ref name="eref"/>
|
649
655
|
<ref name="xref"/>
|
650
656
|
<ref name="hyperlink"/>
|
657
|
+
<ref name="index"/>
|
658
|
+
<ref name="index-xref"/>
|
651
659
|
</choice>
|
652
660
|
</zeroOrMore>
|
653
661
|
</element>
|
@@ -655,7 +663,11 @@
|
|
655
663
|
<define name="keyword">
|
656
664
|
<element name="keyword">
|
657
665
|
<zeroOrMore>
|
658
|
-
<
|
666
|
+
<choice>
|
667
|
+
<ref name="PureTextElement"/>
|
668
|
+
<ref name="index"/>
|
669
|
+
<ref name="index-xref"/>
|
670
|
+
</choice>
|
659
671
|
</zeroOrMore>
|
660
672
|
</element>
|
661
673
|
</define>
|
@@ -676,7 +688,11 @@
|
|
676
688
|
<define name="strike">
|
677
689
|
<element name="strike">
|
678
690
|
<zeroOrMore>
|
679
|
-
<
|
691
|
+
<choice>
|
692
|
+
<ref name="PureTextElement"/>
|
693
|
+
<ref name="index"/>
|
694
|
+
<ref name="index-xref"/>
|
695
|
+
</choice>
|
680
696
|
</zeroOrMore>
|
681
697
|
</element>
|
682
698
|
</define>
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require "date"
|
2
|
-
require "htmlentities"
|
3
|
-
|
4
1
|
module Metanorma
|
5
2
|
module ISO
|
6
3
|
class Converter < Standoc::Converter
|
@@ -37,7 +34,6 @@ module Metanorma
|
|
37
34
|
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
|
38
35
|
"/organization").each_with_object([]) do |x, prefix|
|
39
36
|
x1 = x.at("abbreviation")&.text || x.at("name")&.text
|
40
|
-
# (x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
41
37
|
prefix << x1
|
42
38
|
end
|
43
39
|
end
|
@@ -76,9 +72,7 @@ module Metanorma
|
|
76
72
|
end
|
77
73
|
|
78
74
|
def sort_biblio(bib)
|
79
|
-
bib.sort
|
80
|
-
sort_biblio_key(a) <=> sort_biblio_key(b)
|
81
|
-
end
|
75
|
+
bib.sort { |a, b| sort_biblio_key(a) <=> sort_biblio_key(b) }
|
82
76
|
end
|
83
77
|
|
84
78
|
# sort by: doc class (ISO, IEC, other standard (not DOI &c), other
|
@@ -90,15 +84,15 @@ module Metanorma
|
|
90
84
|
# then title
|
91
85
|
def sort_biblio_key(bib)
|
92
86
|
pubclass = pub_class(bib)
|
93
|
-
num = bib
|
94
|
-
id = bib
|
95
|
-
bib
|
96
|
-
metaid = bib
|
87
|
+
num = bib.at("./docnumber")&.text
|
88
|
+
id = bib.at("./docidentifier[@primary]") ||
|
89
|
+
bib.at("./docidentifier[not(#{skip_docid} or @type = 'metanorma')]")
|
90
|
+
metaid = bib.at("./docidentifier[@type = 'metanorma']")&.text
|
97
91
|
abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
|
98
92
|
/\d-(?<partid>\d+)/ =~ id&.text
|
99
93
|
type = id["type"] if id
|
100
|
-
title = bib
|
101
|
-
bib
|
94
|
+
title = bib.at("./title[@type = 'main']")&.text ||
|
95
|
+
bib.at("./title")&.text || bib&.at("./formattedref")&.text
|
102
96
|
"#{pubclass} :: #{type} :: " \
|
103
97
|
"#{num.nil? ? abbrid : sprintf('%09d', num.to_i)} :: " \
|
104
98
|
"#{sprintf('%09d', partid.to_i)} :: #{id&.text} :: #{title}"
|
@@ -241,6 +235,14 @@ module Metanorma
|
|
241
235
|
end
|
242
236
|
end
|
243
237
|
end
|
238
|
+
|
239
|
+
def termdef_boilerplate_insert_location(xmldoc)
|
240
|
+
f = xmldoc.at(self.class::TERM_CLAUSE)
|
241
|
+
root = xmldoc.at("//sections/terms | //sections/clause[.//terms]")
|
242
|
+
!f || !root and return f || root
|
243
|
+
f.at("./preceding-sibling::clause") and return root
|
244
|
+
f
|
245
|
+
end
|
244
246
|
end
|
245
247
|
end
|
246
248
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.6 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -485,6 +485,8 @@
|
|
485
485
|
<choice>
|
486
486
|
<text/>
|
487
487
|
<ref name="callout"/>
|
488
|
+
<ref name="xref"/>
|
489
|
+
<ref name="eref"/>
|
488
490
|
</choice>
|
489
491
|
</oneOrMore>
|
490
492
|
<zeroOrMore>
|
@@ -865,6 +867,7 @@
|
|
865
867
|
<ref name="PureTextElement"/>
|
866
868
|
<ref name="stem"/>
|
867
869
|
<ref name="index"/>
|
870
|
+
<ref name="index-xref"/>
|
868
871
|
<ref name="eref"/>
|
869
872
|
<ref name="erefstack"/>
|
870
873
|
<ref name="xref"/>
|
@@ -880,6 +883,7 @@
|
|
880
883
|
<ref name="PureTextElement"/>
|
881
884
|
<ref name="stem"/>
|
882
885
|
<ref name="index"/>
|
886
|
+
<ref name="index-xref"/>
|
883
887
|
<ref name="eref"/>
|
884
888
|
<ref name="erefstack"/>
|
885
889
|
<ref name="xref"/>
|
@@ -894,6 +898,7 @@
|
|
894
898
|
<choice>
|
895
899
|
<ref name="PureTextElement"/>
|
896
900
|
<ref name="index"/>
|
901
|
+
<ref name="index-xref"/>
|
897
902
|
<ref name="eref"/>
|
898
903
|
<ref name="erefstack"/>
|
899
904
|
<ref name="xref"/>
|
@@ -908,6 +913,7 @@
|
|
908
913
|
<choice>
|
909
914
|
<ref name="PureTextElement"/>
|
910
915
|
<ref name="index"/>
|
916
|
+
<ref name="index-xref"/>
|
911
917
|
</choice>
|
912
918
|
</zeroOrMore>
|
913
919
|
</element>
|
@@ -918,6 +924,7 @@
|
|
918
924
|
<choice>
|
919
925
|
<ref name="PureTextElement"/>
|
920
926
|
<ref name="index"/>
|
927
|
+
<ref name="index-xref"/>
|
921
928
|
</choice>
|
922
929
|
</zeroOrMore>
|
923
930
|
</element>
|
@@ -928,6 +935,7 @@
|
|
928
935
|
<choice>
|
929
936
|
<ref name="PureTextElement"/>
|
930
937
|
<ref name="index"/>
|
938
|
+
<ref name="index-xref"/>
|
931
939
|
</choice>
|
932
940
|
</zeroOrMore>
|
933
941
|
</element>
|
@@ -938,6 +946,7 @@
|
|
938
946
|
<choice>
|
939
947
|
<ref name="PureTextElement"/>
|
940
948
|
<ref name="index"/>
|
949
|
+
<ref name="index-xref"/>
|
941
950
|
</choice>
|
942
951
|
</zeroOrMore>
|
943
952
|
</element>
|
@@ -1004,6 +1013,14 @@
|
|
1004
1013
|
</oneOrMore>
|
1005
1014
|
</element>
|
1006
1015
|
</define>
|
1016
|
+
<define name="BasicBlock" combine="choice">
|
1017
|
+
<ref name="columnbreak"/>
|
1018
|
+
</define>
|
1019
|
+
<define name="columnbreak">
|
1020
|
+
<element name="columnbreak">
|
1021
|
+
<empty/>
|
1022
|
+
</element>
|
1023
|
+
</define>
|
1007
1024
|
<define name="MultilingualRenderingType">
|
1008
1025
|
<choice>
|
1009
1026
|
<value>common</value>
|
@@ -1047,6 +1064,8 @@
|
|
1047
1064
|
<ref name="keyword"/>
|
1048
1065
|
<ref name="xref"/>
|
1049
1066
|
<ref name="hyperlink"/>
|
1067
|
+
<ref name="index"/>
|
1068
|
+
<ref name="index-xref"/>
|
1050
1069
|
</choice>
|
1051
1070
|
</element>
|
1052
1071
|
</define>
|
@@ -1060,6 +1079,8 @@
|
|
1060
1079
|
<ref name="keyword"/>
|
1061
1080
|
<ref name="xref"/>
|
1062
1081
|
<ref name="hyperlink"/>
|
1082
|
+
<ref name="index"/>
|
1083
|
+
<ref name="index-xref"/>
|
1063
1084
|
</choice>
|
1064
1085
|
</element>
|
1065
1086
|
</define>
|
@@ -1126,6 +1147,8 @@
|
|
1126
1147
|
<choice>
|
1127
1148
|
<ref name="PureTextElement"/>
|
1128
1149
|
<ref name="stem"/>
|
1150
|
+
<ref name="index"/>
|
1151
|
+
<ref name="index-xref"/>
|
1129
1152
|
</choice>
|
1130
1153
|
</zeroOrMore>
|
1131
1154
|
</element>
|
@@ -1136,6 +1159,8 @@
|
|
1136
1159
|
<choice>
|
1137
1160
|
<ref name="PureTextElement"/>
|
1138
1161
|
<ref name="stem"/>
|
1162
|
+
<ref name="index"/>
|
1163
|
+
<ref name="index-xref"/>
|
1139
1164
|
</choice>
|
1140
1165
|
</zeroOrMore>
|
1141
1166
|
</element>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|