metanorma-bsi 0.0.1 → 0.1.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.
Potentially problematic release.
This version of metanorma-bsi might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +43 -0
- data/.github/workflows/release_github_packages.yml +49 -0
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/README.adoc +95 -11
- data/lib/asciidoctor/bsi/biblio.rng +1 -0
- data/lib/asciidoctor/bsi/bsi.rng +32 -4
- data/lib/asciidoctor/bsi/bsi_intro_en.xml +87 -61
- data/lib/asciidoctor/bsi/cleanup.rb +15 -8
- data/lib/asciidoctor/bsi/cleanup_ref.rb +10 -21
- data/lib/asciidoctor/bsi/converter.rb +7 -5
- data/lib/asciidoctor/bsi/front.rb +26 -5
- data/lib/asciidoctor/bsi/isodoc.rng +191 -3
- data/lib/asciidoctor/bsi/isostandard.rng +12 -0
- data/lib/asciidoctor/bsi/validate.rb +5 -6
- data/lib/asciidoctor/bsi/validate_list.rb +2 -2
- data/lib/isodoc/bsi/base_convert.rb +2 -1
- data/lib/isodoc/bsi/bsi.international-standard.xsl +3380 -2349
- data/lib/isodoc/bsi/html/htmlstyle.css +43 -22
- data/lib/isodoc/bsi/html/htmlstyle.scss +46 -22
- data/lib/isodoc/bsi/html_convert.rb +2 -2
- data/lib/isodoc/bsi/i18n-en.yaml +4 -4
- data/lib/isodoc/bsi/metadata.rb +2 -2
- data/lib/isodoc/bsi/presentation_xml_convert.rb +26 -5
- data/lib/isodoc/bsi/xref.rb +11 -4
- data/lib/metanorma/bsi/version.rb +1 -1
- data/metanorma-bsi.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +564 -494
- data/spec/asciidoctor/blocks_spec.rb +192 -195
- data/spec/asciidoctor/cleanup_spec.rb +361 -361
- data/spec/asciidoctor/refs_spec.rb +8 -78
- data/spec/asciidoctor/section_spec.rb +227 -227
- data/spec/asciidoctor/validate_spec.rb +26 -1
- data/spec/isodoc/blocks_spec.rb +56 -21
- data/spec/isodoc/i18n_spec.rb +156 -234
- data/spec/isodoc/inline_spec.rb +7 -7
- data/spec/isodoc/iso_spec.rb +4 -4
- data/spec/isodoc/metadata_spec.rb +0 -1
- data/spec/isodoc/ref_spec.rb +7 -7
- data/spec/isodoc/section_spec.rb +400 -343
- data/spec/isodoc/terms_spec.rb +224 -225
- data/spec/isodoc/xref_spec.rb +1347 -1360
- data/spec/metanorma/processor_spec.rb +37 -40
- data/spec/spec_helper.rb +6 -4
- data/spec/vcr_cassettes/iso-639.yml +19 -19
- data/spec/vcr_cassettes/isobib_get_639_1967.yml +17 -17
- data/spec/vcr_cassettes/multistandard.yml +15 -193
- metadata +7 -5
@@ -2,9 +2,7 @@ require "spec_helper"
|
|
2
2
|
require "metanorma"
|
3
3
|
require "fileutils"
|
4
4
|
|
5
|
-
#RSpec.describe Asciidoctor::Gb do
|
6
5
|
RSpec.describe Metanorma::BSI::Processor do
|
7
|
-
|
8
6
|
registry = Metanorma::Registry.instance
|
9
7
|
registry.register(Metanorma::BSI::Processor)
|
10
8
|
processor = registry.find_processor(:bsi)
|
@@ -15,7 +13,7 @@ RSpec.describe Metanorma::BSI::Processor do
|
|
15
13
|
|
16
14
|
it "registers output formats against metanorma" do
|
17
15
|
expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
|
18
|
-
|
16
|
+
[[:html, "html"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
19
17
|
OUTPUT
|
20
18
|
end
|
21
19
|
|
@@ -25,52 +23,51 @@ RSpec.describe Metanorma::BSI::Processor do
|
|
25
23
|
|
26
24
|
it "generates IsoDoc XML from a blank document" do
|
27
25
|
expect(xmlpp(strip_guid(processor.input_to_isodoc(<<~"INPUT", nil)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
28
|
-
|
26
|
+
#{ASCIIDOC_BLANK_HDR}
|
29
27
|
INPUT
|
30
|
-
|
31
|
-
<sections/>
|
32
|
-
</bsi-standard>
|
28
|
+
#{blank_hdr_gen}
|
29
|
+
<sections/>
|
30
|
+
</bsi-standard>
|
33
31
|
OUTPUT
|
34
32
|
end
|
35
33
|
|
36
34
|
it "generates HTML from IsoDoc XML" do
|
37
35
|
FileUtils.rm_f "test.xml"
|
38
36
|
processor.output(<<~"INPUT", "test.xml", "test.html", :html)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
37
|
+
<bsi-standard xmlns="http://riboseinc.com/isoxml">
|
38
|
+
<sections>
|
39
|
+
<terms id="H" obligation="normative"><title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
40
|
+
<term id="J">
|
41
|
+
<name>1.1</name>
|
42
|
+
<preferred>Term2</preferred>
|
43
|
+
</term>
|
44
|
+
</terms>
|
45
|
+
</sections>
|
46
|
+
</bsi-standard>
|
49
47
|
INPUT
|
50
48
|
expect(xmlpp(File.read("test.html", encoding: "utf-8").gsub(%r{^.*<main}m, "<main").gsub(%r{</main>.*}m, "</main>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
49
|
+
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
50
|
+
<br />
|
51
|
+
<p class="zzSTDTitle1">BRITISH STANDARDS INSTITUTION</p>
|
52
|
+
<p class="zzSTDTitle1">____________</p>
|
53
|
+
<p class="zzSTDTitle1"> </p>
|
54
|
+
<p class="zzSTDTitle1">
|
55
|
+
<b></b>
|
56
|
+
</p>
|
57
|
+
<p class="zzSTDTitle1"> </p>
|
58
|
+
<div id="">
|
59
|
+
<h1 class="ForewordTitle" id="toc0">Foreword</h1>
|
60
|
+
<div class="boilerplate_legal"></div>
|
61
|
+
</div>
|
62
|
+
<p class="zzSTDTitle1">
|
63
|
+
<b></b>
|
64
|
+
</p>
|
65
|
+
<p class="zzSTDTitle1"> </p>
|
66
|
+
<div id="H"><h1 id="toc1">1 Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
67
|
+
<h2 class="TermNum" id="J">1.1</h2>
|
68
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
69
|
+
</div>
|
70
|
+
</main>
|
73
71
|
OUTPUT
|
74
72
|
end
|
75
|
-
|
76
73
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -133,7 +133,9 @@ def boilerplate(xmldoc)
|
|
133
133
|
ret = Nokogiri::XML(
|
134
134
|
conv.boilerplate_isodoc(xmldoc).populate_template(file, nil)
|
135
135
|
.gsub(/<p>/, "<p id='_'>")
|
136
|
+
.gsub(/<p align="left">/, "<p align='left' id='_'>")
|
136
137
|
.gsub(/<ol>/, "<ol id='_' type='alphabet'>")
|
138
|
+
.gsub(/<ul>/, "<ul id='_'>")
|
137
139
|
)
|
138
140
|
conv.smartquotes_cleanup(ret)
|
139
141
|
HTMLEntities.new.decode(ret.to_xml)
|
@@ -146,14 +148,14 @@ BLANK_HDR = <<~"HDR".freeze
|
|
146
148
|
<contributor>
|
147
149
|
<role type="author"/>
|
148
150
|
<organization>
|
149
|
-
<name>British Standards
|
151
|
+
<name>British Standards Institution</name>
|
150
152
|
<abbreviation>BSI</abbreviation>
|
151
153
|
</organization>
|
152
154
|
</contributor>
|
153
155
|
<contributor>
|
154
156
|
<role type="publisher"/>
|
155
157
|
<organization>
|
156
|
-
<name>British Standards
|
158
|
+
<name>British Standards Institution</name>
|
157
159
|
<abbreviation>BSI</abbreviation>
|
158
160
|
</organization>
|
159
161
|
</contributor>
|
@@ -167,7 +169,7 @@ BLANK_HDR = <<~"HDR".freeze
|
|
167
169
|
<from>#{Time.new.year}</from>
|
168
170
|
<owner>
|
169
171
|
<organization>
|
170
|
-
<name>British Standards
|
172
|
+
<name>British Standards Institution</name>
|
171
173
|
<abbreviation>BSI</abbreviation>
|
172
174
|
</organization>
|
173
175
|
</owner>
|
@@ -192,7 +194,7 @@ def blank_hdr_gen
|
|
192
194
|
end
|
193
195
|
|
194
196
|
IEC_TITLE = <<~TITLE.freeze
|
195
|
-
<p class="zzSTDTitle1">BRITISH STANDARDS
|
197
|
+
<p class="zzSTDTitle1">BRITISH STANDARDS INSTITUTION</p>
|
196
198
|
<p class="zzSTDTitle1">____________</p>
|
197
199
|
<p class="zzSTDTitle1"> </p>
|
198
200
|
<p class="zzSTDTitle1">
|