metanorma-iec 1.4.5 → 2.0.0
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/rake.yml +4 -32
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/lib/isodoc/iec/base_convert.rb +3 -2
- data/lib/isodoc/iec/html/htmlstyle.css +1 -1
- data/lib/isodoc/iec/html/htmlstyle.scss +1 -1
- data/lib/isodoc/iec/html_convert.rb +2 -1
- data/lib/isodoc/iec/iec.international-standard.xsl +294 -214
- data/lib/isodoc/iec/xref.rb +9 -8
- data/lib/{asciidoctor → metanorma}/iec/basicdoc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/iec/biblio.rng +0 -0
- data/lib/{asciidoctor → metanorma}/iec/converter.rb +22 -1
- data/lib/{asciidoctor → metanorma}/iec/front.rb +1 -1
- data/lib/{asciidoctor → metanorma}/iec/iec.rng +0 -0
- data/lib/{asciidoctor → metanorma}/iec/iec_intro_en.xml +0 -0
- data/lib/{asciidoctor → metanorma}/iec/iec_intro_fr.xml +0 -0
- data/lib/{asciidoctor → metanorma}/iec/isodoc.rng +29 -0
- data/lib/{asciidoctor → metanorma}/iec/isostandard.rng +0 -0
- data/lib/{asciidoctor → metanorma}/iec/reqt.rng +0 -0
- data/lib/metanorma/iec/version.rb +1 -1
- data/lib/metanorma-iec.rb +1 -1
- data/metanorma-iec.gemspec +1 -1
- data/spec/isodoc/iev_spec.rb +5 -4
- data/spec/isodoc/ref_spec.rb +359 -353
- data/spec/{asciidoctor → metanorma}/base_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/cleanup_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/iev_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/inline_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/section_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/validate_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +22 -22
data/lib/isodoc/iec/xref.rb
CHANGED
@@ -16,6 +16,7 @@ module IsoDoc
|
|
16
16
|
def initial_anchor_names(d)
|
17
17
|
super
|
18
18
|
return unless @is_iev
|
19
|
+
|
19
20
|
terms_iev_names(d)
|
20
21
|
middle_section_asset_names(d)
|
21
22
|
termnote_anchor_names(d)
|
@@ -24,21 +25,21 @@ module IsoDoc
|
|
24
25
|
|
25
26
|
def terms_iev_names(d)
|
26
27
|
d.xpath(ns("//sections/clause/terms")).each_with_index do |t, i|
|
27
|
-
num = "#{@iev_part}-%02d" % [i+1]
|
28
|
+
num = "#{@iev_part}-%02d" % [i + 1]
|
28
29
|
@anchors[t["id"]] =
|
29
|
-
{ label: num, xref: l10n("#{@labels[
|
30
|
-
type: "clause" }
|
31
|
-
t.xpath(ns("./term")).each_with_index do |c,
|
32
|
-
num2 = "%02d" % [
|
30
|
+
{ label: num, xref: l10n("#{@labels['section_iev']} #{num}"),
|
31
|
+
level: 2, type: "clause" }
|
32
|
+
t.xpath(ns("./term")).each_with_index do |c, j|
|
33
|
+
num2 = "%02d" % [j + 1]
|
33
34
|
section_names1(c, "#{num}-#{num2}", 3)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
39
|
def annex_name_lbl(clause, num)
|
39
|
-
obl = l10n("(#{@labels[
|
40
|
-
obl = l10n("(#{@labels[
|
41
|
-
l10n("<strong>#{@labels[
|
40
|
+
obl = l10n("(#{@labels['inform_annex']})")
|
41
|
+
obl = l10n("(#{@labels['norm_annex']})") if clause["obligation"] == "normative"
|
42
|
+
l10n("<strong>#{@labels['annex']} #{num}</strong><br/>#{obl}")
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
File without changes
|
File without changes
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require "asciidoctor"
|
2
2
|
require "metanorma-iso"
|
3
|
+
require "metanorma/iso/converter"
|
3
4
|
require_relative "./front"
|
4
5
|
|
5
|
-
module
|
6
|
+
module Metanorma
|
6
7
|
module Iec
|
7
8
|
class Converter < ISO::Converter
|
8
9
|
XML_ROOT_TAG = "iec-standard".freeze
|
@@ -117,6 +118,26 @@ module Asciidoctor
|
|
117
118
|
end
|
118
119
|
|
119
120
|
def image_name_validate(xmldoc); end
|
121
|
+
|
122
|
+
def toc_cleanup(xmldoc)
|
123
|
+
toc_iev_cleanup(xmldoc) if @is_iev
|
124
|
+
super
|
125
|
+
end
|
126
|
+
|
127
|
+
def toc_iev_cleanup(xmldoc)
|
128
|
+
iev_variant_titles(xmldoc)
|
129
|
+
end
|
130
|
+
|
131
|
+
def iev_variant_titles(xmldoc)
|
132
|
+
id = xmldoc&.at("//bibdata/docidentifier[@type = 'ISO']")&.text
|
133
|
+
m = /60050-(\d+)/.match(id) or return
|
134
|
+
xmldoc.xpath("//sections/clause/terms/title").each_with_index do |t, i|
|
135
|
+
num = "%02d" % [i + 1]
|
136
|
+
t.next = "<variant-title type='toc'>"\
|
137
|
+
"#{@i18n.section_iev} #{m[1]}-#{num} – "\
|
138
|
+
"#{t.children.to_xml}</variant-title>"
|
139
|
+
end
|
140
|
+
end
|
120
141
|
end
|
121
142
|
end
|
122
143
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -32,6 +32,19 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="bibitem">
|
36
|
+
<element name="bibitem">
|
37
|
+
<attribute name="id">
|
38
|
+
<data type="ID"/>
|
39
|
+
</attribute>
|
40
|
+
<optional>
|
41
|
+
<attribute name="hidden">
|
42
|
+
<data type="boolean"/>
|
43
|
+
</attribute>
|
44
|
+
</optional>
|
45
|
+
<ref name="BibliographicItem"/>
|
46
|
+
</element>
|
47
|
+
</define>
|
35
48
|
<define name="section-title">
|
36
49
|
<element name="title">
|
37
50
|
<zeroOrMore>
|
@@ -690,6 +703,7 @@
|
|
690
703
|
<ref name="terms"/>
|
691
704
|
<ref name="term-clause"/>
|
692
705
|
<ref name="definitions"/>
|
706
|
+
<ref name="floating-title"/>
|
693
707
|
</choice>
|
694
708
|
</oneOrMore>
|
695
709
|
</element>
|
@@ -1680,6 +1694,7 @@
|
|
1680
1694
|
<ref name="clause-subsection"/>
|
1681
1695
|
<ref name="terms"/>
|
1682
1696
|
<ref name="definitions"/>
|
1697
|
+
<ref name="floating-title"/>
|
1683
1698
|
</choice>
|
1684
1699
|
</oneOrMore>
|
1685
1700
|
</choice>
|
@@ -1722,6 +1737,7 @@
|
|
1722
1737
|
<ref name="terms"/>
|
1723
1738
|
<ref name="definitions"/>
|
1724
1739
|
<ref name="references"/>
|
1740
|
+
<ref name="floating-title"/>
|
1725
1741
|
</choice>
|
1726
1742
|
</zeroOrMore>
|
1727
1743
|
</group>
|
@@ -2534,4 +2550,17 @@
|
|
2534
2550
|
</oneOrMore>
|
2535
2551
|
</element>
|
2536
2552
|
</define>
|
2553
|
+
<define name="floating-title">
|
2554
|
+
<element name="floating-title">
|
2555
|
+
<attribute name="id">
|
2556
|
+
<data type="ID"/>
|
2557
|
+
</attribute>
|
2558
|
+
<attribute name="depth">
|
2559
|
+
<data type="int"/>
|
2560
|
+
</attribute>
|
2561
|
+
<zeroOrMore>
|
2562
|
+
<ref name="TextElement"/>
|
2563
|
+
</zeroOrMore>
|
2564
|
+
</element>
|
2565
|
+
</define>
|
2537
2566
|
</grammar>
|
File without changes
|
File without changes
|
data/lib/metanorma-iec.rb
CHANGED
data/metanorma-iec.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
29
29
|
|
30
|
-
spec.add_dependency "metanorma-iso", "~>
|
30
|
+
spec.add_dependency "metanorma-iso", "~> 2.0.0"
|
31
31
|
spec.add_dependency "ruby-jing"
|
32
32
|
|
33
33
|
spec.add_development_dependency "debug"
|
data/spec/isodoc/iev_spec.rb
CHANGED
@@ -211,6 +211,7 @@ RSpec.describe IsoDoc do
|
|
211
211
|
<formattedref format='application/x-isodoc+xml'>
|
212
212
|
<em>TITLE</em>
|
213
213
|
</formattedref>
|
214
|
+
<docidentifier type='metanorma-ordinal'>[1]</docidentifier>
|
214
215
|
<docidentifier>B</docidentifier>
|
215
216
|
</bibitem>
|
216
217
|
</references>
|
@@ -369,9 +370,9 @@ RSpec.describe IsoDoc do
|
|
369
370
|
<h1>1  Terms and definitions</h1>
|
370
371
|
<br/>
|
371
372
|
<div id='_general'>
|
372
|
-
<
|
373
|
+
<h2 class='zzSTDTitle2'>
|
373
374
|
<b>192-01 General</b>
|
374
|
-
</
|
375
|
+
</h2>
|
375
376
|
<p class='TermNum' id='paddy1'>192-01-01</p>
|
376
377
|
<p class='Terms' style='text-align:left;'>
|
377
378
|
<b>paddy</b>
|
@@ -537,9 +538,9 @@ RSpec.describe IsoDoc do
|
|
537
538
|
</p>
|
538
539
|
<div>
|
539
540
|
<a name='_general' id='_general'/>
|
540
|
-
<
|
541
|
+
<h2 class='zzSTDTitle2'>
|
541
542
|
<b>192-01 General</b>
|
542
|
-
</
|
543
|
+
</h2>
|
543
544
|
<p class='TermNum'>
|
544
545
|
<a name='paddy1' id='paddy1'/>
|
545
546
|
192-01-01
|