metanorma-bsi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.hound.yml +3 -0
- data/.rubocop.yml +14 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE +25 -0
- data/README.adoc +199 -0
- data/Rakefile +8 -0
- data/bin/rspec +18 -0
- data/lib/asciidoctor/bsi/basicdoc.rng +1131 -0
- data/lib/asciidoctor/bsi/biblio.rng +1235 -0
- data/lib/asciidoctor/bsi/bsi.rng +120 -0
- data/lib/asciidoctor/bsi/bsi_intro_en.xml +105 -0
- data/lib/asciidoctor/bsi/cleanup.rb +78 -0
- data/lib/asciidoctor/bsi/cleanup_ref.rb +183 -0
- data/lib/asciidoctor/bsi/converter.rb +83 -0
- data/lib/asciidoctor/bsi/front.rb +67 -0
- data/lib/asciidoctor/bsi/isodoc.rng +1870 -0
- data/lib/asciidoctor/bsi/isostandard.rng +477 -0
- data/lib/asciidoctor/bsi/reqt.rng +194 -0
- data/lib/asciidoctor/bsi/validate.rb +224 -0
- data/lib/asciidoctor/bsi/validate_list.rb +72 -0
- data/lib/asciidoctor/bsi/validate_requirement.rb +163 -0
- data/lib/isodoc/bsi/base_convert.rb +91 -0
- data/lib/isodoc/bsi/bsi.international-standard.xsl +6540 -0
- data/lib/isodoc/bsi/html/html_bsi_intro.html +8 -0
- data/lib/isodoc/bsi/html/html_bsi_titlepage.html +50 -0
- data/lib/isodoc/bsi/html/htmlstyle.css +968 -0
- data/lib/isodoc/bsi/html/htmlstyle.scss +699 -0
- data/lib/isodoc/bsi/html_convert.rb +56 -0
- data/lib/isodoc/bsi/i18n-en.yaml +56 -0
- data/lib/isodoc/bsi/i18n.rb +15 -0
- data/lib/isodoc/bsi/init.rb +24 -0
- data/lib/isodoc/bsi/metadata.rb +33 -0
- data/lib/isodoc/bsi/pdf_convert.rb +17 -0
- data/lib/isodoc/bsi/presentation_xml_convert.rb +72 -0
- data/lib/isodoc/bsi/sts_convert.rb +30 -0
- data/lib/isodoc/bsi/xref.rb +134 -0
- data/lib/metanorma-bsi.rb +15 -0
- data/lib/metanorma/bsi.rb +6 -0
- data/lib/metanorma/bsi/processor.rb +51 -0
- data/lib/metanorma/bsi/version.rb +6 -0
- data/metanorma-bsi.gemspec +47 -0
- data/spec/asciidoctor/base_spec.rb +778 -0
- data/spec/asciidoctor/blocks_spec.rb +553 -0
- data/spec/asciidoctor/cleanup_spec.rb +547 -0
- data/spec/asciidoctor/inline_spec.rb +176 -0
- data/spec/asciidoctor/lists_spec.rb +194 -0
- data/spec/asciidoctor/refs_spec.rb +318 -0
- data/spec/asciidoctor/section_spec.rb +382 -0
- data/spec/asciidoctor/validate_spec.rb +858 -0
- data/spec/assets/header.html +7 -0
- data/spec/assets/html.css +2 -0
- data/spec/assets/iso.xml +71 -0
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/word.css +2 -0
- data/spec/assets/wordintro.html +4 -0
- data/spec/assets/xref_error.adoc +7 -0
- data/spec/isodoc/blocks_spec.rb +259 -0
- data/spec/isodoc/i18n_spec.rb +442 -0
- data/spec/isodoc/inline_spec.rb +287 -0
- data/spec/isodoc/iso_spec.rb +116 -0
- data/spec/isodoc/metadata_spec.rb +262 -0
- data/spec/isodoc/postproc_spec.rb +137 -0
- data/spec/isodoc/ref_spec.rb +376 -0
- data/spec/isodoc/section_spec.rb +467 -0
- data/spec/isodoc/terms_spec.rb +246 -0
- data/spec/isodoc/xref_spec.rb +1730 -0
- data/spec/metanorma/processor_spec.rb +76 -0
- data/spec/spec_helper.rb +291 -0
- data/spec/vcr_cassettes/iso-639.yml +182 -0
- data/spec/vcr_cassettes/isobib_get_639_1967.yml +136 -0
- data/spec/vcr_cassettes/multistandard.yml +352 -0
- metadata +343 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
require "asciidoctor" unless defined? Asciidoctor::Converter
|
2
|
+
require_relative "asciidoctor/bsi/converter"
|
3
|
+
require_relative "metanorma/bsi/version"
|
4
|
+
require "isodoc/bsi/html_convert"
|
5
|
+
require "isodoc/bsi/sts_convert"
|
6
|
+
require "isodoc/bsi/pdf_convert"
|
7
|
+
require "isodoc/bsi/presentation_xml_convert"
|
8
|
+
require "isodoc/bsi/metadata"
|
9
|
+
require "isodoc/bsi/xref"
|
10
|
+
|
11
|
+
if defined? Metanorma
|
12
|
+
require_relative "metanorma/bsi"
|
13
|
+
Metanorma::Registry.instance.register(Metanorma::BSI::Processor)
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "metanorma/processor"
|
2
|
+
|
3
|
+
module Metanorma
|
4
|
+
module BSI
|
5
|
+
class Processor < Metanorma::Processor
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@short = :bsi
|
9
|
+
@input_format = :asciidoc
|
10
|
+
@asciidoctor_backend = :bsi
|
11
|
+
end
|
12
|
+
|
13
|
+
def output_formats
|
14
|
+
super.merge(
|
15
|
+
html: "html",
|
16
|
+
pdf: "pdf",
|
17
|
+
sts: "sts.xml"
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def fonts_manifest
|
22
|
+
{
|
23
|
+
"Tahoma" => nil,
|
24
|
+
"STIX Two Math" => nil,
|
25
|
+
"Source Han Sans" => nil,
|
26
|
+
"Courier" => nil,
|
27
|
+
"Courier New" => nil,
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def version
|
32
|
+
"Metanorma::BSI #{Metanorma::BSI::VERSION}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def output(xml, inname, outname, format, options = {})
|
36
|
+
case format
|
37
|
+
when :html
|
38
|
+
IsoDoc::BSI::HtmlConvert.new(options).convert(inname, xml, nil, outname)
|
39
|
+
when :pdf
|
40
|
+
IsoDoc::BSI::PdfConvert.new(options).convert(inname, xml, nil, outname)
|
41
|
+
when :sts
|
42
|
+
IsoDoc::BSI::StsConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
43
|
+
when :presentation
|
44
|
+
IsoDoc::BSI::PresentationXMLConvert.new(options).convert(inname, xml, nil, outname)
|
45
|
+
else
|
46
|
+
super
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "metanorma/bsi/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "metanorma-bsi"
|
9
|
+
spec.version = Metanorma::BSI::VERSION
|
10
|
+
spec.authors = ["Ribose Inc."]
|
11
|
+
spec.email = ["open.source@ribose.com"]
|
12
|
+
|
13
|
+
spec.summary = "metanorma-bsi lets you write BSI standards "\
|
14
|
+
"in AsciiDoc."
|
15
|
+
spec.description = <<~DESCRIPTION
|
16
|
+
metanorma-bsi lets you write BSI standards in AsciiDoc syntax.
|
17
|
+
|
18
|
+
This gem is in active development.
|
19
|
+
DESCRIPTION
|
20
|
+
|
21
|
+
spec.homepage = "https://github.com/metanorma/metanorma-bsi"
|
22
|
+
spec.license = "BSD-2-Clause"
|
23
|
+
|
24
|
+
spec.bindir = "bin"
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
spec.files = `git ls-files`.split("\n")
|
27
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
28
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
29
|
+
|
30
|
+
spec.add_dependency "metanorma-iso", "~> 1.8.0"
|
31
|
+
spec.add_dependency "mn2sts", "~> 1.5.0"
|
32
|
+
spec.add_dependency "ruby-jing"
|
33
|
+
|
34
|
+
spec.add_development_dependency "byebug"
|
35
|
+
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
36
|
+
spec.add_development_dependency "guard", "~> 2.14"
|
37
|
+
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
38
|
+
spec.add_development_dependency "iev", "~> 0.2.0"
|
39
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
41
|
+
spec.add_development_dependency "rubocop", "~> 1.5.2"
|
42
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
43
|
+
spec.add_development_dependency "simplecov", "~> 0.15"
|
44
|
+
spec.add_development_dependency "timecop", "~> 0.9"
|
45
|
+
spec.add_development_dependency "vcr", "~> 5.0.0"
|
46
|
+
spec.add_development_dependency "webmock"
|
47
|
+
end
|
@@ -0,0 +1,778 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
RSpec.describe Asciidoctor::BSI do
|
5
|
+
before(:all) do
|
6
|
+
@blank_hdr = blank_hdr_gen
|
7
|
+
end
|
8
|
+
|
9
|
+
it "has a version number" do
|
10
|
+
expect(Metanorma::BSI::VERSION).not_to be nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "processes a blank document" do
|
14
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
15
|
+
#{ASCIIDOC_BLANK_HDR}
|
16
|
+
INPUT
|
17
|
+
#{@blank_hdr}
|
18
|
+
<sections/>
|
19
|
+
</bsi-standard>
|
20
|
+
OUTPUT
|
21
|
+
end
|
22
|
+
|
23
|
+
it "converts a blank document" do
|
24
|
+
FileUtils.rm_f "test.doc"
|
25
|
+
FileUtils.rm_f "test.html"
|
26
|
+
FileUtils.rm_f "test.pdf"
|
27
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
28
|
+
= Document title
|
29
|
+
Author
|
30
|
+
:docfile: test.adoc
|
31
|
+
:novalid:
|
32
|
+
:no-isobib:
|
33
|
+
INPUT
|
34
|
+
#{@blank_hdr}
|
35
|
+
<sections/>
|
36
|
+
</bsi-standard>
|
37
|
+
OUTPUT
|
38
|
+
expect(File.exist?("test.pdf")).to be true
|
39
|
+
expect(File.exist?("test.html")).to be true
|
40
|
+
expect(File.exist?("test.doc")).to be true
|
41
|
+
expect(File.exist?("htmlstyle.css")).to be false
|
42
|
+
end
|
43
|
+
|
44
|
+
it "processes default metadata" do
|
45
|
+
expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)).at("//xmlns:bibdata").to_xml))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
46
|
+
= Document title
|
47
|
+
Author
|
48
|
+
:docfile: test.adoc
|
49
|
+
:nodoc:
|
50
|
+
:novalid:
|
51
|
+
:no-isobib:
|
52
|
+
:docnumber: 1000
|
53
|
+
:partnumber: 1
|
54
|
+
:edition: 2
|
55
|
+
:revdate: 2000-01-01
|
56
|
+
:draft: 0.3.4
|
57
|
+
:technical-committee: TC
|
58
|
+
:technical-committee-number: 1
|
59
|
+
:technical-committee-type: A
|
60
|
+
:subcommittee: SC
|
61
|
+
:subcommittee-number: 2
|
62
|
+
:subcommittee-type: B
|
63
|
+
:workgroup: WG
|
64
|
+
:workgroup-number: 3
|
65
|
+
:workgroup-type: C
|
66
|
+
:technical-committee_2: TC1
|
67
|
+
:technical-committee-number_2: 11
|
68
|
+
:technical-committee-type_2: A1
|
69
|
+
:subcommittee_2: SC1
|
70
|
+
:subcommittee-number_2: 21
|
71
|
+
:subcommittee-type_2: B1
|
72
|
+
:workgroup_2: WG1
|
73
|
+
:workgroup-number_2: 31
|
74
|
+
:workgroup-type_2: C1
|
75
|
+
:secretariat: SECRETARIAT
|
76
|
+
:docstage: 10
|
77
|
+
:docsubstage: 20
|
78
|
+
:iteration: 3
|
79
|
+
:language: en
|
80
|
+
:title-intro-en: Introduction
|
81
|
+
:title-main-en: Main Title -- Title
|
82
|
+
:title-part-en: Title Part
|
83
|
+
:title-intro-fr: Introduction Française
|
84
|
+
:title-main-fr: Titre Principal
|
85
|
+
:title-part-fr: Part du Titre
|
86
|
+
:library-ics: 1,2,3
|
87
|
+
:accessibility-color-inside: true
|
88
|
+
:price-code: XC
|
89
|
+
:cen-processing: true
|
90
|
+
:secretary: Fred Nerk
|
91
|
+
:interest-to-committees: TC 6121, SC 12
|
92
|
+
:obsoletes: ABC; DEF
|
93
|
+
INPUT
|
94
|
+
<bibdata type="standard">
|
95
|
+
<title language="en" format="text/plain" type="main">Introduction — Main Title — Title — Title Part</title>
|
96
|
+
<title language="en" format="text/plain" type="title-intro">Introduction</title>
|
97
|
+
<title language="en" format="text/plain" type="title-main">Main Title — Title</title>
|
98
|
+
<title language="en" format="text/plain" type="title-part">Title Part</title>
|
99
|
+
<title language="fr" format="text/plain" type="main">Introduction Française — Titre Principal — Part du Titre</title>
|
100
|
+
<title language="fr" format="text/plain" type="title-intro">Introduction Française</title>
|
101
|
+
<title language="fr" format="text/plain" type="title-main">Titre Principal</title>
|
102
|
+
<title language="fr" format="text/plain" type="title-part">Part du Titre</title>
|
103
|
+
<docidentifier type="BS">BS/PreNP 1000-1</docidentifier>
|
104
|
+
<docnumber>1000</docnumber>
|
105
|
+
<contributor>
|
106
|
+
<role type="author"/>
|
107
|
+
<organization>
|
108
|
+
<name>British Standards Institute</name>
|
109
|
+
<abbreviation>BSI</abbreviation>
|
110
|
+
</organization>
|
111
|
+
</contributor>
|
112
|
+
<contributor>
|
113
|
+
<role type="publisher"/>
|
114
|
+
<organization>
|
115
|
+
<name>British Standards Institute</name>
|
116
|
+
<abbreviation>BSI</abbreviation>
|
117
|
+
</organization>
|
118
|
+
</contributor>
|
119
|
+
<edition>2</edition>
|
120
|
+
<version>
|
121
|
+
<revision-date>2000-01-01</revision-date>
|
122
|
+
<draft>0.3.4</draft>
|
123
|
+
</version>
|
124
|
+
<language>en</language>
|
125
|
+
<script>Latn</script>
|
126
|
+
<status>
|
127
|
+
<stage abbreviation="NP">10</stage>
|
128
|
+
<substage>20</substage>
|
129
|
+
<iteration>3</iteration>
|
130
|
+
</status>
|
131
|
+
<copyright>
|
132
|
+
<from>#{Date.today.year}</from>
|
133
|
+
<owner>
|
134
|
+
<organization>
|
135
|
+
<name>British Standards Institute</name>
|
136
|
+
<abbreviation>BSI</abbreviation>
|
137
|
+
</organization>
|
138
|
+
</owner>
|
139
|
+
</copyright>
|
140
|
+
<relation type='obsoletes'>
|
141
|
+
<bibitem>
|
142
|
+
<title>--</title>
|
143
|
+
<docidentifier>ABC</docidentifier>
|
144
|
+
</bibitem>
|
145
|
+
</relation>
|
146
|
+
<relation type='obsoletes'>
|
147
|
+
<bibitem>
|
148
|
+
<title>--</title>
|
149
|
+
<docidentifier>DEF</docidentifier>
|
150
|
+
</bibitem>
|
151
|
+
</relation>
|
152
|
+
<ext>
|
153
|
+
<doctype>article</doctype>
|
154
|
+
<editorialgroup>
|
155
|
+
<technical-committee number="1" type="A">TC</technical-committee>
|
156
|
+
<technical-committee number="11" type="A1">TC1</technical-committee>
|
157
|
+
<subcommittee number="2" type="B">SC</subcommittee>
|
158
|
+
<subcommittee number="21" type="B1">SC1</subcommittee>
|
159
|
+
<workgroup number="3" type="C">WG</workgroup>
|
160
|
+
<workgroup number="31" type="C1">WG1</workgroup>
|
161
|
+
<secretariat>SECRETARIAT</secretariat>
|
162
|
+
</editorialgroup>
|
163
|
+
<ics>
|
164
|
+
<code>1</code>
|
165
|
+
</ics>
|
166
|
+
<ics>
|
167
|
+
<code>2</code>
|
168
|
+
</ics>
|
169
|
+
<ics>
|
170
|
+
<code>3</code>
|
171
|
+
</ics>
|
172
|
+
<structuredidentifier>
|
173
|
+
<project-number part="1">BS 1000</project-number>
|
174
|
+
</structuredidentifier>
|
175
|
+
<stagename>New work item proposal</stagename>
|
176
|
+
</ext>
|
177
|
+
</bibdata>
|
178
|
+
OUTPUT
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
it "processes complex metadata" do
|
183
|
+
expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)).at("//xmlns:bibdata").to_xml))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
184
|
+
= Document title
|
185
|
+
Author
|
186
|
+
:docfile: test.adoc
|
187
|
+
:nodoc:
|
188
|
+
:novalid:
|
189
|
+
:no-isobib:
|
190
|
+
:docnumber: 1000
|
191
|
+
:partnumber: 1-1
|
192
|
+
:tc-docnumber: 2000
|
193
|
+
:language: el
|
194
|
+
:script: Grek
|
195
|
+
:publisher: BSI;IETF;ISO
|
196
|
+
:copyright-year: 2001
|
197
|
+
:docstage: 50
|
198
|
+
:doctype: technical-specification
|
199
|
+
:function: emc
|
200
|
+
:horizontal: true
|
201
|
+
INPUT
|
202
|
+
<bibdata type="standard">
|
203
|
+
<docidentifier type="BS">BS/IETF/ISO/FDTS TS 1000-1-1</docidentifier>
|
204
|
+
<docidentifier type="iso-tc">2000</docidentifier>
|
205
|
+
<docnumber>1000</docnumber>
|
206
|
+
<contributor>
|
207
|
+
<role type="author"/>
|
208
|
+
<organization>
|
209
|
+
<name>British Standards Institute</name>
|
210
|
+
<abbreviation>BSI</abbreviation>
|
211
|
+
</organization>
|
212
|
+
</contributor>
|
213
|
+
<contributor>
|
214
|
+
<role type="author"/>
|
215
|
+
<organization>
|
216
|
+
<name>IETF</name>
|
217
|
+
</organization>
|
218
|
+
</contributor>
|
219
|
+
<contributor>
|
220
|
+
<role type="author"/>
|
221
|
+
<organization>
|
222
|
+
<name>International Organization for Standardization</name>
|
223
|
+
<abbreviation>ISO</abbreviation>
|
224
|
+
</organization>
|
225
|
+
</contributor>
|
226
|
+
<contributor>
|
227
|
+
<role type="publisher"/>
|
228
|
+
<organization>
|
229
|
+
<name>British Standards Institute</name>
|
230
|
+
<abbreviation>BSI</abbreviation>
|
231
|
+
</organization>
|
232
|
+
</contributor>
|
233
|
+
<contributor>
|
234
|
+
<role type="publisher"/>
|
235
|
+
<organization>
|
236
|
+
<name>IETF</name>
|
237
|
+
</organization>
|
238
|
+
</contributor>
|
239
|
+
<contributor>
|
240
|
+
<role type="publisher"/>
|
241
|
+
<organization>
|
242
|
+
<name>International Organization for Standardization</name>
|
243
|
+
<abbreviation>ISO</abbreviation>
|
244
|
+
</organization>
|
245
|
+
</contributor>
|
246
|
+
<language>el</language>
|
247
|
+
<script>Grek</script>
|
248
|
+
<status>
|
249
|
+
<stage abbreviation="FDTS TS">50</stage>
|
250
|
+
<substage>00</substage>
|
251
|
+
</status>
|
252
|
+
<copyright>
|
253
|
+
<from>2001</from>
|
254
|
+
<owner>
|
255
|
+
<organization>
|
256
|
+
<name>British Standards Institute</name>
|
257
|
+
<abbreviation>BSI</abbreviation>
|
258
|
+
</organization>
|
259
|
+
</owner>
|
260
|
+
</copyright>
|
261
|
+
<copyright>
|
262
|
+
<from>2001</from>
|
263
|
+
<owner>
|
264
|
+
<organization>
|
265
|
+
<name>IETF</name>
|
266
|
+
</organization>
|
267
|
+
</owner>
|
268
|
+
</copyright>
|
269
|
+
<copyright>
|
270
|
+
<from>2001</from>
|
271
|
+
<owner>
|
272
|
+
<organization>
|
273
|
+
<name>International Organization for Standardization</name>
|
274
|
+
<abbreviation>ISO</abbreviation>
|
275
|
+
</organization>
|
276
|
+
</owner>
|
277
|
+
</copyright>
|
278
|
+
<ext>
|
279
|
+
<doctype>technical-specification</doctype>
|
280
|
+
<editorialgroup>
|
281
|
+
<technical-committee/>
|
282
|
+
<subcommittee/>
|
283
|
+
<workgroup/>
|
284
|
+
</editorialgroup>
|
285
|
+
<structuredidentifier>
|
286
|
+
<project-number part="1" subpart="1">BS/IETF/ISO 1000</project-number>
|
287
|
+
</structuredidentifier>
|
288
|
+
<stagename>Final draft</stagename>
|
289
|
+
</ext>
|
290
|
+
</bibdata>
|
291
|
+
OUTPUT
|
292
|
+
end
|
293
|
+
|
294
|
+
it "processes adoption of ISO standards" do
|
295
|
+
VCR.use_cassette "iso-639" do
|
296
|
+
expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)).at("//xmlns:bibdata").to_xml))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
297
|
+
= Document title
|
298
|
+
Author
|
299
|
+
:docfile: test.adoc
|
300
|
+
:docnumber: ISO 639
|
301
|
+
:partnumber: 2
|
302
|
+
:nodoc:
|
303
|
+
:novalid:
|
304
|
+
:adopted-from: ISO 639-2
|
305
|
+
:copyright-year: 2001
|
306
|
+
INPUT
|
307
|
+
<bibdata type='standard'>
|
308
|
+
<docidentifier type='BS'>BS ISO 639-2:2001</docidentifier>
|
309
|
+
<docnumber>ISO 639</docnumber>
|
310
|
+
<contributor>
|
311
|
+
<role type='author'/>
|
312
|
+
<organization>
|
313
|
+
<name>British Standards Institute</name>
|
314
|
+
<abbreviation>BSI</abbreviation>
|
315
|
+
</organization>
|
316
|
+
</contributor>
|
317
|
+
<contributor>
|
318
|
+
<role type='publisher'/>
|
319
|
+
<organization>
|
320
|
+
<name>British Standards Institute</name>
|
321
|
+
<abbreviation>BSI</abbreviation>
|
322
|
+
</organization>
|
323
|
+
</contributor>
|
324
|
+
<language>en</language>
|
325
|
+
<script>Latn</script>
|
326
|
+
<status>
|
327
|
+
<stage abbreviation='IS'>60</stage>
|
328
|
+
<substage>60</substage>
|
329
|
+
</status>
|
330
|
+
<copyright>
|
331
|
+
<from>2001</from>
|
332
|
+
<owner>
|
333
|
+
<organization>
|
334
|
+
<name>British Standards Institute</name>
|
335
|
+
<abbreviation>BSI</abbreviation>
|
336
|
+
</organization>
|
337
|
+
</owner>
|
338
|
+
</copyright>
|
339
|
+
<relation type='adoptedFrom'>
|
340
|
+
<bibitem type='standard'>
|
341
|
+
<fetched>2021-04-25</fetched>
|
342
|
+
<title type='title-main' format='text/plain' language='en' script='Latn'>Codes for the representation of names of languages</title>
|
343
|
+
<title type='title-part' format='text/plain' language='en' script='Latn'>Part 2: Alpha-3 code</title>
|
344
|
+
<title type='main' format='text/plain' language='en' script='Latn'>
|
345
|
+
Codes for the representation of names of
|
346
|
+
languages — Part 2: Alpha-3 code
|
347
|
+
</title>
|
348
|
+
<title type='title-main' format='text/plain' language='fr' script='Latn'>Codes pour la représentation des noms de langue</title>
|
349
|
+
<title type='title-part' format='text/plain' language='fr' script='Latn'>Partie 2: Code alpha-3</title>
|
350
|
+
<title type='main' format='text/plain' language='fr' script='Latn'>
|
351
|
+
Codes pour la représentation des noms de
|
352
|
+
langue — Partie 2: Code alpha-3
|
353
|
+
</title>
|
354
|
+
<uri type='src'>https://www.iso.org/standard/4767.html</uri>
|
355
|
+
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:4767:en</uri>
|
356
|
+
<uri type='rss'>https://www.iso.org/contents/data/standard/00/47/4767.detail.rss</uri>
|
357
|
+
<docidentifier type='ISO'>ISO 639-2</docidentifier>
|
358
|
+
<docidentifier type='URN'>urn:iso:std:iso:639:-2:stage-90.20:ed-1:en,fr</docidentifier>
|
359
|
+
<docnumber>639</docnumber>
|
360
|
+
<contributor>
|
361
|
+
<role type='publisher'/>
|
362
|
+
<organization>
|
363
|
+
<name>International Organization for Standardization</name>
|
364
|
+
<abbreviation>ISO</abbreviation>
|
365
|
+
<uri>www.iso.org</uri>
|
366
|
+
</organization>
|
367
|
+
</contributor>
|
368
|
+
<edition>1</edition>
|
369
|
+
<language>en</language>
|
370
|
+
<language>fr</language>
|
371
|
+
<script>Latn</script>
|
372
|
+
<status>
|
373
|
+
<stage>90</stage>
|
374
|
+
<substage>20</substage>
|
375
|
+
</status>
|
376
|
+
<copyright>
|
377
|
+
<from>1998</from>
|
378
|
+
<owner>
|
379
|
+
<organization>
|
380
|
+
<name>ISO</name>
|
381
|
+
</organization>
|
382
|
+
</owner>
|
383
|
+
</copyright>
|
384
|
+
<relation type='instance'>
|
385
|
+
<bibitem type='standard'>
|
386
|
+
<fetched>2021-04-25</fetched>
|
387
|
+
<title type='title-main' format='text/plain' language='en' script='Latn'>Codes for the representation of names of languages</title>
|
388
|
+
<title type='title-part' format='text/plain' language='en' script='Latn'>Part 2: Alpha-3 code</title>
|
389
|
+
<title type='main' format='text/plain' language='en' script='Latn'>
|
390
|
+
Codes for the representation of names of
|
391
|
+
languages — Part 2: Alpha-3 code
|
392
|
+
</title>
|
393
|
+
<title type='title-main' format='text/plain' language='fr' script='Latn'>Codes pour la représentation des noms de langue</title>
|
394
|
+
<title type='title-part' format='text/plain' language='fr' script='Latn'>Partie 2: Code alpha-3</title>
|
395
|
+
<title type='main' format='text/plain' language='fr' script='Latn'>
|
396
|
+
Codes pour la représentation des noms de
|
397
|
+
langue — Partie 2: Code alpha-3
|
398
|
+
</title>
|
399
|
+
<uri type='src'>https://www.iso.org/standard/4767.html</uri>
|
400
|
+
<uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:4767:en</uri>
|
401
|
+
<uri type='rss'>https://www.iso.org/contents/data/standard/00/47/4767.detail.rss</uri>
|
402
|
+
<docidentifier type='ISO'>ISO 639-2:1998</docidentifier>
|
403
|
+
<docidentifier type='URN'>urn:iso:std:iso:639:-2:stage-90.20:ed-1:en,fr</docidentifier>
|
404
|
+
<docnumber>639</docnumber>
|
405
|
+
<date type='published'>
|
406
|
+
<on>1998-11</on>
|
407
|
+
</date>
|
408
|
+
<contributor>
|
409
|
+
<role type='publisher'/>
|
410
|
+
<organization>
|
411
|
+
<name>International Organization for Standardization</name>
|
412
|
+
<abbreviation>ISO</abbreviation>
|
413
|
+
<uri>www.iso.org</uri>
|
414
|
+
</organization>
|
415
|
+
</contributor>
|
416
|
+
<edition>1</edition>
|
417
|
+
<language>en</language>
|
418
|
+
<language>fr</language>
|
419
|
+
<script>Latn</script>
|
420
|
+
<abstract format='text/plain' language='fr' script='Latn'>
|
421
|
+
La présente partie de l’ISO 639 fournit deux jeux de
|
422
|
+
codets à trois caractères pour la représentation des
|
423
|
+
noms de langue, l’un destiné à des applications en
|
424
|
+
terminologie, l’autre destiné à des applications
|
425
|
+
bibliographiques. Les deux jeux de codets sont les mêmes,
|
426
|
+
excepté pour vingt-cinq langues qui ont des codets
|
427
|
+
différents à cause du critère utilisé pour les
|
428
|
+
former . À l’origine, des codets de langues ont
|
429
|
+
été créés à l’usage des
|
430
|
+
bibliothèques, des services documentaires et des éditeurs,
|
431
|
+
pour indiquer la langue dans l’échange
|
432
|
+
d’information, particulièrement entre des systèmes
|
433
|
+
informatisés. Ces codets ont été utilisés
|
434
|
+
largement à l’intérieur de la communauté des
|
435
|
+
bibliothèques, et ils peuvent être adoptés pour toute
|
436
|
+
application qui requiert l’expression de la langue sous forme
|
437
|
+
codée, en terminologie ou en lexicographie. Le code alpha-2 a
|
438
|
+
été créé pour un usage pratique pour la plupart
|
439
|
+
des grandes langues du monde, langues qui sont les plus souvent
|
440
|
+
représentées dans le corpus de la littérature
|
441
|
+
mondiale. De nouveaux codets sont créés quand il devient
|
442
|
+
évident qu’il existe un corpus significatif de
|
443
|
+
littérature dans une langue particulière. Les langages
|
444
|
+
créés pour être utilisés exclusivement par des
|
445
|
+
machines, comme les langages de programmation, ne sont pas inclus
|
446
|
+
dans le présent code.
|
447
|
+
</abstract>
|
448
|
+
<status>
|
449
|
+
<stage>90</stage>
|
450
|
+
<substage>20</substage>
|
451
|
+
</status>
|
452
|
+
<copyright>
|
453
|
+
<from>1998</from>
|
454
|
+
<owner>
|
455
|
+
<organization>
|
456
|
+
<name>ISO</name>
|
457
|
+
</organization>
|
458
|
+
</owner>
|
459
|
+
</copyright>
|
460
|
+
<place>Geneva</place>
|
461
|
+
</bibitem>
|
462
|
+
</relation>
|
463
|
+
<place>Geneva</place>
|
464
|
+
</bibitem>
|
465
|
+
</relation>
|
466
|
+
<ext>
|
467
|
+
<doctype>article</doctype>
|
468
|
+
<editorialgroup>
|
469
|
+
<technical-committee/>
|
470
|
+
<subcommittee/>
|
471
|
+
<workgroup/>
|
472
|
+
</editorialgroup>
|
473
|
+
<structuredidentifier>
|
474
|
+
<project-number part='2'>BS ISO 639</project-number>
|
475
|
+
</structuredidentifier>
|
476
|
+
<stagename>International standard</stagename>
|
477
|
+
</ext>
|
478
|
+
</bibdata>
|
479
|
+
OUTPUT
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
it "processes boilerplate in English" do
|
484
|
+
doc = (strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)))
|
485
|
+
= Document title
|
486
|
+
Author
|
487
|
+
:docfile: test.adoc
|
488
|
+
:nodoc:
|
489
|
+
:novalid:
|
490
|
+
:no-isobib:
|
491
|
+
:docnumber: 1000
|
492
|
+
:partnumber: 1-1
|
493
|
+
:tc-docnumber: 2000
|
494
|
+
:language: en
|
495
|
+
:script: Latn
|
496
|
+
:publisher: IEC,IETF,ISO
|
497
|
+
:copyright-year: 2001
|
498
|
+
INPUT
|
499
|
+
expect(doc).to include "Unless otherwise specified"
|
500
|
+
end
|
501
|
+
|
502
|
+
it "defaults substage" do
|
503
|
+
expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)).at("//xmlns:bibdata").to_xml))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
504
|
+
= Document title
|
505
|
+
Author
|
506
|
+
:docfile: test.adoc
|
507
|
+
:nodoc:
|
508
|
+
:novalid:
|
509
|
+
:no-isobib:
|
510
|
+
:docnumber: 1000
|
511
|
+
:docstage: 50
|
512
|
+
INPUT
|
513
|
+
<bibdata type="standard">
|
514
|
+
<docidentifier type="BS">BS/FDIS 1000</docidentifier>
|
515
|
+
<docnumber>1000</docnumber>
|
516
|
+
<contributor>
|
517
|
+
<role type="author"/>
|
518
|
+
<organization>
|
519
|
+
<name>British Standards Institute</name>
|
520
|
+
<abbreviation>BSI</abbreviation>
|
521
|
+
</organization>
|
522
|
+
</contributor>
|
523
|
+
<contributor>
|
524
|
+
<role type="publisher"/>
|
525
|
+
<organization>
|
526
|
+
<name>British Standards Institute</name>
|
527
|
+
<abbreviation>BSI</abbreviation>
|
528
|
+
</organization>
|
529
|
+
</contributor>
|
530
|
+
|
531
|
+
<language>en</language>
|
532
|
+
<script>Latn</script>
|
533
|
+
<status>
|
534
|
+
<stage abbreviation="FDIS">50</stage>
|
535
|
+
<substage>00</substage>
|
536
|
+
</status>
|
537
|
+
<copyright>
|
538
|
+
<from>#{Date.today.year}</from>
|
539
|
+
<owner>
|
540
|
+
<organization>
|
541
|
+
<name>British Standards Institute</name>
|
542
|
+
<abbreviation>BSI</abbreviation>
|
543
|
+
</organization>
|
544
|
+
</owner>
|
545
|
+
</copyright>
|
546
|
+
<ext>
|
547
|
+
<doctype>article</doctype>
|
548
|
+
<editorialgroup>
|
549
|
+
<technical-committee/>
|
550
|
+
<subcommittee/>
|
551
|
+
<workgroup/>
|
552
|
+
</editorialgroup>
|
553
|
+
<structuredidentifier>
|
554
|
+
<project-number>BS 1000</project-number>
|
555
|
+
</structuredidentifier>
|
556
|
+
<stagename>Final draft</stagename>
|
557
|
+
</ext>
|
558
|
+
</bibdata>
|
559
|
+
OUTPUT
|
560
|
+
end
|
561
|
+
|
562
|
+
it "defaults substage for stage 60" do
|
563
|
+
expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)).at("//xmlns:bibdata").to_xml))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
564
|
+
= Document title
|
565
|
+
Author
|
566
|
+
:docfile: test.adoc
|
567
|
+
:nodoc:
|
568
|
+
:novalid:
|
569
|
+
:no-isobib:
|
570
|
+
:docnumber: 1000
|
571
|
+
:docstage: 60
|
572
|
+
INPUT
|
573
|
+
<bibdata type="standard">
|
574
|
+
<docidentifier type="BS">BS 1000</docidentifier>
|
575
|
+
<docnumber>1000</docnumber>
|
576
|
+
<contributor>
|
577
|
+
<role type="author"/>
|
578
|
+
<organization>
|
579
|
+
<name>British Standards Institute</name>
|
580
|
+
<abbreviation>BSI</abbreviation>
|
581
|
+
</organization>
|
582
|
+
</contributor>
|
583
|
+
<contributor>
|
584
|
+
<role type="publisher"/>
|
585
|
+
<organization>
|
586
|
+
<name>British Standards Institute</name>
|
587
|
+
<abbreviation>BSI</abbreviation>
|
588
|
+
</organization>
|
589
|
+
</contributor>
|
590
|
+
|
591
|
+
<language>en</language>
|
592
|
+
<script>Latn</script>
|
593
|
+
<status>
|
594
|
+
<stage abbreviation='IS'>60</stage>
|
595
|
+
<substage>60</substage>
|
596
|
+
</status>
|
597
|
+
<copyright>
|
598
|
+
<from>#{Date.today.year}</from>
|
599
|
+
<owner>
|
600
|
+
<organization>
|
601
|
+
<name>British Standards Institute</name>
|
602
|
+
<abbreviation>BSI</abbreviation>
|
603
|
+
</organization>
|
604
|
+
</owner>
|
605
|
+
</copyright>
|
606
|
+
<ext>
|
607
|
+
<doctype>article</doctype>
|
608
|
+
<editorialgroup>
|
609
|
+
<technical-committee/>
|
610
|
+
<subcommittee/>
|
611
|
+
<workgroup/>
|
612
|
+
</editorialgroup>
|
613
|
+
<structuredidentifier>
|
614
|
+
<project-number>BS 1000</project-number>
|
615
|
+
</structuredidentifier>
|
616
|
+
<stagename>International standard</stagename>
|
617
|
+
</ext>
|
618
|
+
</bibdata>
|
619
|
+
OUTPUT
|
620
|
+
end
|
621
|
+
|
622
|
+
it "populates metadata for PRF" do
|
623
|
+
expect(xmlpp(strip_guid(Nokogiri::XML(Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)).at("//xmlns:bibdata").to_xml))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
624
|
+
= Document title
|
625
|
+
Author
|
626
|
+
:docfile: test.adoc
|
627
|
+
:nodoc:
|
628
|
+
:novalid:
|
629
|
+
:no-isobib:
|
630
|
+
:docnumber: 1000
|
631
|
+
:docstage: 60
|
632
|
+
:docsubstage: 00
|
633
|
+
INPUT
|
634
|
+
<bibdata type="standard">
|
635
|
+
<docidentifier type="BS">BS 1000</docidentifier>
|
636
|
+
<docnumber>1000</docnumber>
|
637
|
+
<contributor>
|
638
|
+
<role type="author"/>
|
639
|
+
<organization>
|
640
|
+
<name>British Standards Institute</name>
|
641
|
+
<abbreviation>BSI</abbreviation>
|
642
|
+
</organization>
|
643
|
+
</contributor>
|
644
|
+
<contributor>
|
645
|
+
<role type="publisher"/>
|
646
|
+
<organization>
|
647
|
+
<name>British Standards Institute</name>
|
648
|
+
<abbreviation>BSI</abbreviation>
|
649
|
+
</organization>
|
650
|
+
</contributor>
|
651
|
+
|
652
|
+
<language>en</language>
|
653
|
+
<script>Latn</script>
|
654
|
+
<status>
|
655
|
+
<stage abbreviation='PRF'>60</stage>
|
656
|
+
<substage>00</substage>
|
657
|
+
</status>
|
658
|
+
<copyright>
|
659
|
+
<from>#{Date.today.year}</from>
|
660
|
+
<owner>
|
661
|
+
<organization>
|
662
|
+
<name>British Standards Institute</name>
|
663
|
+
<abbreviation>BSI</abbreviation>
|
664
|
+
</organization>
|
665
|
+
</owner>
|
666
|
+
</copyright>
|
667
|
+
<ext>
|
668
|
+
<doctype>article</doctype>
|
669
|
+
<editorialgroup>
|
670
|
+
<technical-committee/>
|
671
|
+
<subcommittee/>
|
672
|
+
<workgroup/>
|
673
|
+
</editorialgroup>
|
674
|
+
<structuredidentifier>
|
675
|
+
<project-number>BS 1000</project-number>
|
676
|
+
</structuredidentifier>
|
677
|
+
<stagename>Proof</stagename>
|
678
|
+
</ext>
|
679
|
+
</bibdata>
|
680
|
+
OUTPUT
|
681
|
+
end
|
682
|
+
|
683
|
+
|
684
|
+
it "reads scripts into blank HTML document" do
|
685
|
+
FileUtils.rm_f "test.html"
|
686
|
+
Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)
|
687
|
+
= Document title
|
688
|
+
Author
|
689
|
+
:docfile: test.adoc
|
690
|
+
:novalid:
|
691
|
+
:no-isobib:
|
692
|
+
:no-pdf:
|
693
|
+
INPUT
|
694
|
+
html = File.read("test.html", encoding: "utf-8")
|
695
|
+
expect(html).to match(%r{<script>})
|
696
|
+
end
|
697
|
+
|
698
|
+
it "uses default fonts" do
|
699
|
+
FileUtils.rm_f "test.html"
|
700
|
+
Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)
|
701
|
+
= Document title
|
702
|
+
Author
|
703
|
+
:docfile: test.adoc
|
704
|
+
:novalid:
|
705
|
+
:no-isobib:
|
706
|
+
:no-pdf:
|
707
|
+
INPUT
|
708
|
+
html = File.read("test.html", encoding: "utf-8")
|
709
|
+
expect(html)
|
710
|
+
.to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
711
|
+
expect(html)
|
712
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: "Tahoma", sans-serif;]m)
|
713
|
+
expect(html)
|
714
|
+
.to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Tahoma", sans-serif;]m)
|
715
|
+
end
|
716
|
+
|
717
|
+
it "uses Chinese fonts" do
|
718
|
+
FileUtils.rm_f "test.html"
|
719
|
+
Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)
|
720
|
+
= Document title
|
721
|
+
Author
|
722
|
+
:docfile: test.adoc
|
723
|
+
:novalid:
|
724
|
+
:no-isobib:
|
725
|
+
:script: Hans
|
726
|
+
:no-pdf:
|
727
|
+
INPUT
|
728
|
+
html = File.read("test.html", encoding: "utf-8")
|
729
|
+
expect(html)
|
730
|
+
.to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
731
|
+
expect(html)
|
732
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
733
|
+
expect(html)
|
734
|
+
.to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
735
|
+
end
|
736
|
+
|
737
|
+
it "uses specified fonts" do
|
738
|
+
FileUtils.rm_f "test.html"
|
739
|
+
Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)
|
740
|
+
= Document title
|
741
|
+
Author
|
742
|
+
:docfile: test.adoc
|
743
|
+
:novalid:
|
744
|
+
:no-isobib:
|
745
|
+
:script: Hans
|
746
|
+
:body-font: Zapf Chancery
|
747
|
+
:header-font: Comic Sans
|
748
|
+
:monospace-font: Andale Mono
|
749
|
+
:no-pdf:
|
750
|
+
INPUT
|
751
|
+
html = File.read("test.html", encoding: "utf-8")
|
752
|
+
expect(html)
|
753
|
+
.to match(%r[\bpre[^{]+\{[^{]+font-family: Andale Mono;]m)
|
754
|
+
expect(html)
|
755
|
+
.to match(%r[blockquote[^{]+\{[^{]+font-family: Zapf Chancery;]m)
|
756
|
+
expect(html)
|
757
|
+
.to match(%r[\.h2Annex[^{]+\{[^{]+font-family: Comic Sans;]m)
|
758
|
+
end
|
759
|
+
|
760
|
+
it "strips MS-specific CSS" do
|
761
|
+
FileUtils.rm_f "test.html"
|
762
|
+
FileUtils.rm_f "test.doc"
|
763
|
+
Asciidoctor.convert(<<~"INPUT", backend: :bsi, header_footer: true)
|
764
|
+
= Document title
|
765
|
+
Author
|
766
|
+
:docfile: test.adoc
|
767
|
+
:novalid:
|
768
|
+
:no-isobib:
|
769
|
+
:no-pdf:
|
770
|
+
INPUT
|
771
|
+
word = File.read("test.doc", encoding: "utf-8")
|
772
|
+
html = File.read("test.html", encoding: "utf-8")
|
773
|
+
expect(word).to match(%r[mso-style-name: "Intro Title";]m)
|
774
|
+
expect(html).not_to match(%r[mso-style-name: "Intro Title";]m)
|
775
|
+
end
|
776
|
+
|
777
|
+
|
778
|
+
end
|