metanorma-iso 1.3.1 → 1.3.2
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/Gemfile +5 -1
- data/lib/asciidoctor/iso/cleanup.rb +13 -7
- data/lib/asciidoctor/iso/front.rb +4 -4
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/cleanup_spec.rb +50 -22
- data/spec/asciidoctor-iso/section_spec.rb +2 -2
- 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: c19e6c74f9375995e56a1e37a32ddb30772d952ace1c418e69a9a833c3ab2bd2
|
4
|
+
data.tar.gz: b0a914f36aea83bc10d3b01f699c6f0362d83e6f63827742dc27c8bea789c958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a98a998ebf542a21aa53996ba826827fcf6a5216b109356c40ea8edd86f4fcf18f4d8d20168e014817fac422632af5ff4326bc297600d4a5b9e42f671698aaa2
|
7
|
+
data.tar.gz: 004766f312b82a75a7b9831d6da6e024dcc1fc4db75f1971a4496255861e6b7a7a6d102b5e73c17c9872c3a09a0817d61d8a1614afab4c69ebe8a360527136ad
|
data/Gemfile
CHANGED
@@ -2,6 +2,10 @@ Encoding.default_external = Encoding::UTF_8
|
|
2
2
|
Encoding.default_internal = Encoding::UTF_8
|
3
3
|
|
4
4
|
source "https://rubygems.org"
|
5
|
+
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
5
6
|
|
6
|
-
# Specify your gem's dependencies in gemspec
|
7
7
|
gemspec
|
8
|
+
|
9
|
+
if File.exist? 'Gemfile.devel'
|
10
|
+
eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
|
11
|
+
end
|
@@ -66,10 +66,8 @@ module Asciidoctor
|
|
66
66
|
return 2 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
|
67
67
|
return 2 if bib.at("#{PUBLISHER}[name = 'International "\
|
68
68
|
"Electrotechnical Commission']")
|
69
|
-
return 3 if bib.at("./docidentifier[@type][not(@type = 'DOI'
|
70
|
-
"
|
71
|
-
return 3 if bib.at("./docidentifier[not(@type)]") &&
|
72
|
-
!bib.at("./docidentifier[@type]")
|
69
|
+
return 3 if bib.at("./docidentifier[@type][not(@type = 'DOI' or "\
|
70
|
+
"@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
|
73
71
|
4
|
74
72
|
end
|
75
73
|
|
@@ -80,15 +78,23 @@ module Asciidoctor
|
|
80
78
|
end
|
81
79
|
|
82
80
|
# TODO sort by authors
|
81
|
+
# sort by: doc class (ISO, IEC, other standard (not DOI &c), other
|
82
|
+
# then standard class (docid class other than DOI &c)
|
83
|
+
# then docnumber if present, numeric sort
|
84
|
+
# else alphanumeric metanorma id (abbreviation)
|
85
|
+
# then doc id (not DOI &c)
|
86
|
+
# then title
|
83
87
|
def sort_biblio_key(bib)
|
84
88
|
pubclass = pub_class(bib)
|
85
89
|
num = bib&.at("./docnumber")&.text
|
86
|
-
id = bib&.at("./docidentifier[not(@type = '
|
87
|
-
|
90
|
+
id = bib&.at("./docidentifier[not(@type = 'DOI' or "\
|
91
|
+
"@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
|
92
|
+
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
|
93
|
+
abbrid = metaid unless /^\[\d+\]$/.match(metaid)
|
88
94
|
type = id['type'] if id
|
89
95
|
title = bib&.at("./title[@type = 'main']")&.text ||
|
90
96
|
bib&.at("./title")&.text || bib&.at("./formattedref")&.text
|
91
|
-
"#{pubclass} :: #{type} :: #{num.nil? ?
|
97
|
+
"#{pubclass} :: #{type} :: #{num.nil? ? abbrid : sprintf("%09d", num.to_i)} :: #{id&.text} :: #{title}"
|
92
98
|
end
|
93
99
|
end
|
94
100
|
end
|
@@ -138,20 +138,20 @@ module Asciidoctor
|
|
138
138
|
def title_intro(node, t, lang, at)
|
139
139
|
return unless node.attr("title-intro-#{lang}")
|
140
140
|
t.title(**attr_code(at.merge(type: "title-intro"))) do |t1|
|
141
|
-
t1 << asciidoc_sub(node.attr("title-intro-#{lang}"))
|
141
|
+
t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
145
|
def title_main(node, t, lang, at)
|
146
146
|
t.title **attr_code(at.merge(type: "title-main")) do |t1|
|
147
|
-
t1 << asciidoc_sub(node.attr("title-main-#{lang}"))
|
147
|
+
t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
def title_part(node, t, lang, at)
|
152
152
|
return unless node.attr("title-part-#{lang}")
|
153
153
|
t.title(**attr_code(at.merge(type: "title-part"))) do |t1|
|
154
|
-
t1 << asciidoc_sub(node.attr("title-part-#{lang}"))
|
154
|
+
t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
@@ -162,7 +162,7 @@ module Asciidoctor
|
|
162
162
|
title = "#{intro} -- #{title}" if intro
|
163
163
|
title = "#{title} -- #{part}" if part
|
164
164
|
t.title **attr_code(at.merge(type: "main")) do |t1|
|
165
|
-
t1 << asciidoc_sub(title)
|
165
|
+
t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -799,28 +799,32 @@ r = 1 %</stem>
|
|
799
799
|
* [[[ref1,ISO 123]]], _Standard ISO 123_
|
800
800
|
* [[[ref4,GB 123]]], _Standard GB 123_
|
801
801
|
* [[[ref2,ISO/IEC 123]]], _Standard ISO/IEC 123_
|
802
|
+
* [[[ref6,(B)]]], _Standard 20_
|
803
|
+
* [[[ref7,(A)]]], _Standard 30_
|
802
804
|
|
803
805
|
[bibliography]
|
804
806
|
=== {blank}
|
805
|
-
* [[[
|
806
|
-
* [[[
|
807
|
-
* [[[
|
808
|
-
* [[[
|
809
|
-
* [[[
|
807
|
+
* [[[ref15,20]]], _Standard 10_
|
808
|
+
* [[[ref14,GB 123]]], _Standard GB 123_
|
809
|
+
* [[[ref13,IEC 123]]], _Standard IEC 123_
|
810
|
+
* [[[ref11,ISO 123]]], _Standard ISO 123_
|
811
|
+
* [[[ref10,ISO/IEC 123]]], _Standard ISO/IEC 123_
|
812
|
+
* [[[ref16,(B)]]], _Standard 20_
|
813
|
+
* [[[ref17,(A)]]], _Standard 30_
|
810
814
|
INPUT
|
811
815
|
#{BLANK_HDR}
|
812
|
-
|
816
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
813
817
|
<title>Clause 1</title>
|
814
818
|
<p id="_"><eref type="inline" bibitemid="ref1" citeas="ISO 123"/>
|
815
819
|
<eref type="inline" bibitemid="ref2" citeas="ISO/IEC 123"/>
|
816
820
|
<eref type="inline" bibitemid="ref3" citeas="IEC 123"/>
|
817
821
|
<eref type="inline" bibitemid="ref4" citeas="GB 123"/>
|
818
|
-
<eref type="inline" bibitemid="ref5" citeas="[
|
819
|
-
<eref type="inline" bibitemid="ref6" citeas="
|
820
|
-
<eref type="inline" bibitemid="ref7" citeas="
|
821
|
-
<
|
822
|
-
<
|
823
|
-
<eref type="inline" bibitemid="ref10" citeas="
|
822
|
+
<eref type="inline" bibitemid="ref5" citeas="[4]"/>
|
823
|
+
<eref type="inline" bibitemid="ref6" citeas="[B]"/>
|
824
|
+
<eref type="inline" bibitemid="ref7" citeas="[A]"/>
|
825
|
+
<xref target="ref8"/>
|
826
|
+
<xref target="ref9"/>
|
827
|
+
<eref type="inline" bibitemid="ref10" citeas="ISO/IEC 123"/></p>
|
824
828
|
</clause>
|
825
829
|
</sections><bibliography><clause id="_" obligation="informative"><title>Bibliography</title><references id="_" obligation="informative">
|
826
830
|
<title>Clause 1</title><bibitem id="ref1" type="standard">
|
@@ -860,25 +864,37 @@ r = 1 %</stem>
|
|
860
864
|
<abbreviation>IEC</abbreviation>
|
861
865
|
</organization>
|
862
866
|
</contributor>
|
867
|
+
</bibitem><bibitem id="ref5">
|
868
|
+
<formattedref format="application/x-isodoc+xml">
|
869
|
+
<em>Standard 10</em>
|
870
|
+
</formattedref>
|
871
|
+
<docidentifier type="metanorma">[4]</docidentifier>
|
863
872
|
</bibitem><bibitem id="ref4">
|
864
873
|
<formattedref format="application/x-isodoc+xml">
|
865
874
|
<em>Standard GB 123</em>
|
866
875
|
</formattedref>
|
867
876
|
<docidentifier>GB 123</docidentifier>
|
868
|
-
</bibitem><bibitem id="
|
877
|
+
</bibitem><bibitem id="ref7">
|
869
878
|
<formattedref format="application/x-isodoc+xml">
|
870
|
-
<em>Standard
|
879
|
+
<em>Standard 30</em>
|
880
|
+
</formattedref>
|
881
|
+
<docidentifier type="metanorma">[A]</docidentifier>
|
882
|
+
</bibitem><bibitem id="ref6">
|
883
|
+
<formattedref format="application/x-isodoc+xml">
|
884
|
+
<em>Standard 20</em>
|
871
885
|
</formattedref>
|
872
|
-
<docidentifier type="metanorma">[
|
886
|
+
<docidentifier type="metanorma">[B]</docidentifier>
|
873
887
|
</bibitem>
|
874
888
|
|
875
889
|
|
876
890
|
|
877
891
|
|
878
892
|
|
893
|
+
|
894
|
+
|
879
895
|
</references>
|
880
896
|
<references id="_" obligation="informative">
|
881
|
-
<bibitem id="
|
897
|
+
<bibitem id="ref11" type="standard">
|
882
898
|
<title format="text/plain">Standard ISO 123</title>
|
883
899
|
<docidentifier>ISO 123</docidentifier>
|
884
900
|
<contributor>
|
@@ -888,7 +904,7 @@ r = 1 %</stem>
|
|
888
904
|
<abbreviation>ISO</abbreviation>
|
889
905
|
</organization>
|
890
906
|
</contributor>
|
891
|
-
</bibitem><bibitem id="
|
907
|
+
</bibitem><bibitem id="ref10" type="standard">
|
892
908
|
<title format="text/plain">Standard ISO/IEC 123</title>
|
893
909
|
<docidentifier>ISO/IEC 123</docidentifier>
|
894
910
|
<contributor>
|
@@ -905,7 +921,7 @@ r = 1 %</stem>
|
|
905
921
|
<abbreviation>IEC</abbreviation>
|
906
922
|
</organization>
|
907
923
|
</contributor>
|
908
|
-
</bibitem><bibitem id="
|
924
|
+
</bibitem><bibitem id="ref13" type="standard">
|
909
925
|
<title format="text/plain">Standard IEC 123</title>
|
910
926
|
<docidentifier>IEC 123</docidentifier>
|
911
927
|
<contributor>
|
@@ -915,22 +931,34 @@ r = 1 %</stem>
|
|
915
931
|
<abbreviation>IEC</abbreviation>
|
916
932
|
</organization>
|
917
933
|
</contributor>
|
918
|
-
</bibitem><bibitem id="
|
934
|
+
</bibitem><bibitem id="ref15">
|
935
|
+
<formattedref format="application/x-isodoc+xml">
|
936
|
+
<em>Standard 10</em>
|
937
|
+
</formattedref>
|
938
|
+
<docidentifier type="metanorma">[11]</docidentifier>
|
939
|
+
</bibitem><bibitem id="ref14">
|
919
940
|
<formattedref format="application/x-isodoc+xml">
|
920
941
|
<em>Standard GB 123</em>
|
921
942
|
</formattedref>
|
922
943
|
<docidentifier>GB 123</docidentifier>
|
923
|
-
</bibitem><bibitem id="
|
944
|
+
</bibitem><bibitem id="ref17">
|
924
945
|
<formattedref format="application/x-isodoc+xml">
|
925
|
-
<em>Standard
|
946
|
+
<em>Standard 30</em>
|
926
947
|
</formattedref>
|
927
|
-
<docidentifier type="metanorma">[
|
948
|
+
<docidentifier type="metanorma">[A]</docidentifier>
|
949
|
+
</bibitem><bibitem id="ref16">
|
950
|
+
<formattedref format="application/x-isodoc+xml">
|
951
|
+
<em>Standard 20</em>
|
952
|
+
</formattedref>
|
953
|
+
<docidentifier type="metanorma">[B]</docidentifier>
|
928
954
|
</bibitem>
|
929
955
|
|
930
956
|
|
931
957
|
|
932
958
|
|
933
959
|
|
960
|
+
|
961
|
+
|
934
962
|
</references></clause></bibliography>
|
935
963
|
</iso-standard>
|
936
964
|
OUTPUT
|
@@ -355,7 +355,7 @@ standardization at the following addresses:</p>
|
|
355
355
|
</foreword></preface><sections>
|
356
356
|
<terms id="_" obligation="normative">
|
357
357
|
<title>Terms and definitions</title><p>For the purposes of this document, the terms and definitions
|
358
|
-
given in <eref
|
358
|
+
given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
|
359
359
|
<p>ISO and IEC maintain terminological databases for use in
|
360
360
|
standardization at the following addresses:</p>
|
361
361
|
|
@@ -427,7 +427,7 @@ standardization at the following addresses:</p>
|
|
427
427
|
<terms id="_" obligation="normative">
|
428
428
|
<title>Terms and definitions</title>
|
429
429
|
<p>For the purposes of this document,
|
430
|
-
the terms and definitions given in <eref
|
430
|
+
the terms and definitions given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> apply.</p>
|
431
431
|
<p>ISO and IEC maintain terminological databases for use in
|
432
432
|
standardization at the following addresses:</p>
|
433
433
|
|
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: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|