metanorma-standoc 2.2.6 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/html/htmlstyle.css +6 -0
- data/lib/metanorma/standoc/base.rb +3 -5
- data/lib/metanorma/standoc/biblio.rng +5 -0
- data/lib/metanorma/standoc/cleanup.rb +17 -17
- data/lib/metanorma/standoc/cleanup_amend.rb +2 -2
- data/lib/metanorma/standoc/cleanup_biblio.rb +5 -4
- data/lib/metanorma/standoc/cleanup_maths.rb +12 -4
- data/lib/metanorma/standoc/cleanup_section.rb +19 -9
- data/lib/metanorma/standoc/cleanup_symbols.rb +14 -7
- data/lib/metanorma/standoc/cleanup_text.rb +10 -4
- data/lib/metanorma/standoc/cleanup_toc.rb +1 -2
- data/lib/metanorma/standoc/cleanup_xref.rb +58 -16
- data/lib/metanorma/standoc/inline.rb +27 -12
- data/lib/metanorma/standoc/isodoc.rng +47 -13
- data/lib/metanorma/standoc/ref_utility.rb +1 -0
- data/lib/metanorma/standoc/render.rb +12 -3
- data/lib/metanorma/standoc/section.rb +10 -3
- data/lib/metanorma/standoc/utils.rb +6 -1
- data/lib/metanorma/standoc/validate.rb +1 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +5 -2
- metadata +4 -128
- data/.github/workflows/automerge.yml +0 -31
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/Rakefile +0 -8
- data/bin/rspec +0 -18
- data/spec/assets/a1.adoc +0 -8
- data/spec/assets/a2.adoc +0 -10
- data/spec/assets/a3.adoc +0 -9
- data/spec/assets/a3a.adoc +0 -7
- data/spec/assets/a4.adoc +0 -4
- data/spec/assets/boilerplate.xml +0 -4
- data/spec/assets/codes.yml +0 -695
- data/spec/assets/correct.png +0 -0
- data/spec/assets/corrupt.png +0 -0
- data/spec/assets/header.html +0 -7
- data/spec/assets/html-override.css +0 -1
- data/spec/assets/html.scss +0 -13
- data/spec/assets/htmlcover.html +0 -4
- data/spec/assets/htmlintro.html +0 -5
- data/spec/assets/i18n.yaml +0 -17
- data/spec/assets/iso.adoc +0 -10
- data/spec/assets/iso.headless.html +0 -33
- data/spec/assets/iso.xml +0 -8
- data/spec/assets/iso123.rxl +0 -107
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/scripts.html +0 -3
- data/spec/assets/std.css +0 -2
- data/spec/assets/word-override.css +0 -1
- data/spec/assets/word.scss +0 -13
- data/spec/assets/wordcover.html +0 -3
- data/spec/assets/wordintro.html +0 -4
- data/spec/assets/xref_error.adoc +0 -8
- data/spec/examples/103_01_02.html +0 -247
- data/spec/examples/codes_table.html +0 -3174
- data/spec/examples/datamodel/address_class_profile.adoc +0 -5
- data/spec/examples/datamodel/address_class_profile.presentation.xml +0 -14
- data/spec/examples/datamodel/address_component_profile.adoc +0 -5
- data/spec/examples/datamodel/blank_definition_profile.adoc +0 -5
- data/spec/examples/datamodel/common_models_diagram.adoc +0 -5
- data/spec/examples/datamodel/models/models/AddressClassProfile.yml +0 -90
- data/spec/examples/datamodel/models/models/AddressComponentProfile.yml +0 -63
- data/spec/examples/datamodel/models/models/AddressComponentSpecification.yml +0 -15
- data/spec/examples/datamodel/models/models/AddressProfile.yml +0 -36
- data/spec/examples/datamodel/models/models/AttributeProfile.yml +0 -32
- data/spec/examples/datamodel/models/models/InterchangeAddressClassProfile.yml +0 -79
- data/spec/examples/datamodel/models/models/Localization copy.yml +0 -23
- data/spec/examples/datamodel/models/models/Localization.yml +0 -23
- data/spec/examples/datamodel/models/models/ProfileCompliantAddress.yml +0 -36
- data/spec/examples/datamodel/models/models/ProfileCompliantAddressComponent.yml +0 -15
- data/spec/examples/datamodel/models/models/Signature.yml +0 -20
- data/spec/examples/datamodel/models/models/SignatureBlankDefinition.yml +0 -20
- data/spec/examples/datamodel/models/models/TextDirectionCode copy.yml +0 -16
- data/spec/examples/datamodel/models/models/TextDirectionCode.yml +0 -16
- data/spec/examples/datamodel/models/models/Validity.yml +0 -14
- data/spec/examples/datamodel/models/models/iso19160-1/Address.yml +0 -22
- data/spec/examples/datamodel/models/models/iso19160-1/AddressComponent.yml +0 -2
- data/spec/examples/datamodel/models/style.uml.inc +0 -37
- data/spec/examples/datamodel/models/views/CommonModels.yml +0 -9
- data/spec/examples/datamodel/models/views/TopDown.yml +0 -62
- data/spec/examples/datamodel/top_down_diagram.adoc +0 -5
- data/spec/examples/english.yaml +0 -69
- data/spec/examples/iso_123_.xml +0 -46
- data/spec/examples/iso_123_all_parts.xml +0 -46
- data/spec/examples/iso_123_no_year_note.xml +0 -47
- data/spec/examples/iso_124_.xml +0 -42
- data/spec/examples/iso_216_.xml +0 -48
- data/spec/examples/iso_iec_12382_.xml +0 -49
- data/spec/examples/rice.adoc +0 -715
- data/spec/examples/rice.preview.html +0 -1877
- data/spec/examples/rice.sh +0 -4
- data/spec/examples/rice_images/rice_image1.png +0 -0
- data/spec/examples/rice_images/rice_image2.png +0 -0
- data/spec/examples/rice_images/rice_image3_1.png +0 -0
- data/spec/examples/rice_images/rice_image3_2.png +0 -0
- data/spec/examples/rice_images/rice_image3_3.png +0 -0
- data/spec/fixtures/action_schemaexpg1.svg +0 -122
- data/spec/fixtures/datamodel_description_sections_tree.xml +0 -327
- data/spec/fixtures/diagram_definitions.lutaml +0 -22
- data/spec/fixtures/macros_datamodel/address_class_profile.xml +0 -149
- data/spec/fixtures/macros_datamodel/address_component_profile.xml +0 -71
- data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +0 -51
- data/spec/fixtures/macros_datamodel/common_models_diagram.xml +0 -7
- data/spec/fixtures/macros_datamodel/top_down_diagram.xml +0 -7
- data/spec/fixtures/test.exp +0 -121
- data/spec/fixtures/test.xmi +0 -9250
- data/spec/metanorma/base_spec.rb +0 -1125
- data/spec/metanorma/biblio_spec.rb +0 -1012
- data/spec/metanorma/blank_spec.rb +0 -37
- data/spec/metanorma/blocks_spec.rb +0 -1784
- data/spec/metanorma/cleanup_blocks_spec.rb +0 -1099
- data/spec/metanorma/cleanup_sections_spec.rb +0 -1849
- data/spec/metanorma/cleanup_spec.rb +0 -1931
- data/spec/metanorma/cleanup_terms_spec.rb +0 -1543
- data/spec/metanorma/datamodel/attributes_table_preprocessor_spec.rb +0 -111
- data/spec/metanorma/datamodel/diagram_preprocessor_spec.rb +0 -72
- data/spec/metanorma/inline_spec.rb +0 -785
- data/spec/metanorma/isobib_cache_spec.rb +0 -742
- data/spec/metanorma/lists_spec.rb +0 -232
- data/spec/metanorma/macros_concept_spec.rb +0 -1052
- data/spec/metanorma/macros_json2text_spec.rb +0 -10
- data/spec/metanorma/macros_plantuml_spec.rb +0 -402
- data/spec/metanorma/macros_spec.rb +0 -1183
- data/spec/metanorma/macros_yaml2text_spec.rb +0 -10
- data/spec/metanorma/processor_spec.rb +0 -96
- data/spec/metanorma/refs_spec.rb +0 -2807
- data/spec/metanorma/reqt_spec.rb +0 -130
- data/spec/metanorma/section_spec.rb +0 -1325
- data/spec/metanorma/table_spec.rb +0 -474
- data/spec/metanorma/validate_spec.rb +0 -886
- data/spec/spec_helper.rb +0 -290
- data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +0 -781
- data/spec/vcr_cassettes/bsi16341.yml +0 -486
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +0 -611
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +0 -149
- data/spec/vcr_cassettes/hide_refs.yml +0 -587
- data/spec/vcr_cassettes/isobib_get_123.yml +0 -149
- data/spec/vcr_cassettes/isobib_get_123_1.yml +0 -295
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +0 -385
- data/spec/vcr_cassettes/isobib_get_123_2.yml +0 -295
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +0 -149
- data/spec/vcr_cassettes/isobib_get_124.yml +0 -149
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +0 -367
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +0 -560
- data/spec/vcr_cassettes/std-link.yml +0 -149
data/spec/spec_helper.rb
DELETED
@@ -1,290 +0,0 @@
|
|
1
|
-
require "vcr"
|
2
|
-
|
3
|
-
VCR.configure do |config|
|
4
|
-
config.cassette_library_dir = "spec/vcr_cassettes"
|
5
|
-
config.hook_into :webmock
|
6
|
-
config.default_cassette_options = {
|
7
|
-
clean_outdated_http_interactions: true,
|
8
|
-
re_record_interval: 1512000,
|
9
|
-
record: :once,
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
require "simplecov"
|
14
|
-
SimpleCov.start do
|
15
|
-
add_filter "/spec/"
|
16
|
-
end
|
17
|
-
|
18
|
-
require "bundler/setup"
|
19
|
-
require "asciidoctor"
|
20
|
-
require "metanorma-standoc"
|
21
|
-
require "rspec/matchers"
|
22
|
-
require "equivalent-xml"
|
23
|
-
require "metanorma/standoc"
|
24
|
-
require "rexml/document"
|
25
|
-
|
26
|
-
Dir[File.expand_path("./support/**/**/*.rb", __dir__)]
|
27
|
-
.sort.each { |f| require f }
|
28
|
-
|
29
|
-
RSpec.configure do |config|
|
30
|
-
# Enable flags like --only-failures and --next-failure
|
31
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
32
|
-
|
33
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
34
|
-
config.disable_monkey_patching!
|
35
|
-
|
36
|
-
config.expect_with :rspec do |c|
|
37
|
-
c.syntax = :expect
|
38
|
-
end
|
39
|
-
|
40
|
-
config.around :each do |example|
|
41
|
-
example.run
|
42
|
-
rescue SystemExit
|
43
|
-
fail "Unexpected exit encountered"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
OPTIONS = [backend: :standoc, header_footer: true, agree_to_terms: true].freeze
|
48
|
-
|
49
|
-
def strip_guid(xml)
|
50
|
-
xml.gsub(%r{ id="_[^"]+"}, ' id="_"')
|
51
|
-
.gsub(%r{ target="_[^"]+"}, ' target="_"')
|
52
|
-
end
|
53
|
-
|
54
|
-
def strip_src(xml)
|
55
|
-
xml.gsub(/\ssrc="[^"]+"/, ' src="_"')
|
56
|
-
end
|
57
|
-
|
58
|
-
def xmlpp(xml)
|
59
|
-
s = ""
|
60
|
-
f = REXML::Formatters::Pretty.new(2)
|
61
|
-
f.compact = true
|
62
|
-
f.write(REXML::Document.new(xml
|
63
|
-
.gsub(%r{<fetched>[^<]+</fetched>}, "<fetched/>")), s)
|
64
|
-
s
|
65
|
-
end
|
66
|
-
|
67
|
-
ASCIIDOC_BLANK_HDR = <<~"HDR".freeze
|
68
|
-
= Document title
|
69
|
-
Author
|
70
|
-
:docfile: test.adoc
|
71
|
-
:nodoc:
|
72
|
-
:novalid:
|
73
|
-
:no-isobib:
|
74
|
-
:data-uri-image: false
|
75
|
-
|
76
|
-
HDR
|
77
|
-
|
78
|
-
DUMBQUOTE_BLANK_HDR = <<~"HDR".freeze
|
79
|
-
= Document title
|
80
|
-
Author
|
81
|
-
:docfile: test.adoc
|
82
|
-
:nodoc:
|
83
|
-
:novalid:
|
84
|
-
:no-isobib:
|
85
|
-
:smartquotes: false
|
86
|
-
|
87
|
-
HDR
|
88
|
-
|
89
|
-
ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
90
|
-
= Document title
|
91
|
-
Author
|
92
|
-
:docfile: test.adoc
|
93
|
-
:nodoc:
|
94
|
-
:novalid:
|
95
|
-
:no-isobib-cache:
|
96
|
-
|
97
|
-
HDR
|
98
|
-
|
99
|
-
FLUSH_CACHE_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
100
|
-
= Document title
|
101
|
-
Author
|
102
|
-
:docfile: test.adoc
|
103
|
-
:nodoc:
|
104
|
-
:novalid:
|
105
|
-
:flush-caches:
|
106
|
-
|
107
|
-
HDR
|
108
|
-
|
109
|
-
CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
110
|
-
= Document title
|
111
|
-
Author
|
112
|
-
:docfile: test.adoc
|
113
|
-
:nodoc:
|
114
|
-
:novalid:
|
115
|
-
|
116
|
-
HDR
|
117
|
-
|
118
|
-
LOCAL_CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
119
|
-
= Document title
|
120
|
-
Author
|
121
|
-
:docfile: test.adoc
|
122
|
-
:nodoc:
|
123
|
-
:novalid:
|
124
|
-
:local-cache:
|
125
|
-
|
126
|
-
HDR
|
127
|
-
|
128
|
-
LOCAL_ONLY_CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
129
|
-
= Document title
|
130
|
-
Author
|
131
|
-
:docfile: test.adoc
|
132
|
-
:nodoc:
|
133
|
-
:novalid:
|
134
|
-
:local-cache-only:
|
135
|
-
|
136
|
-
HDR
|
137
|
-
|
138
|
-
VALIDATING_BLANK_HDR = <<~"HDR".freeze
|
139
|
-
= Document title
|
140
|
-
Author
|
141
|
-
:docfile: test.adoc
|
142
|
-
:nodoc:
|
143
|
-
:no-isobib:
|
144
|
-
|
145
|
-
HDR
|
146
|
-
|
147
|
-
NORM_REF_BOILERPLATE = <<~"HDR".freeze
|
148
|
-
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
149
|
-
HDR
|
150
|
-
|
151
|
-
BLANK_HDR = <<~"HDR".freeze
|
152
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
153
|
-
<standard-document xmlns="https://www.metanorma.org/ns/standoc" version="#{Metanorma::Standoc::VERSION}" type="semantic">
|
154
|
-
<bibdata type="standard">
|
155
|
-
<title language="en" format="text/plain">Document title</title>
|
156
|
-
<language>en</language>
|
157
|
-
<script>Latn</script>
|
158
|
-
<status><stage>published</stage></status>
|
159
|
-
<copyright>
|
160
|
-
<from>#{Time.new.year}</from>
|
161
|
-
</copyright>
|
162
|
-
<ext>
|
163
|
-
<doctype>standard</doctype>
|
164
|
-
</ext>
|
165
|
-
</bibdata>
|
166
|
-
HDR
|
167
|
-
|
168
|
-
BLANK_METANORMA_HDR = <<~"HDR".freeze
|
169
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
170
|
-
<?xml version="1.0" encoding="UTF-8"?><html><body>
|
171
|
-
<standard-document xmlns="https://www.metanorma.org/ns/standoc" version="#{Metanorma::Standoc::VERSION}" type="semantic">
|
172
|
-
<bibdata type="standard">
|
173
|
-
<title language="en" format="text/plain">Document title</title>
|
174
|
-
<language>en</language>
|
175
|
-
<script>Latn</script>
|
176
|
-
<status><stage>published</stage></status>
|
177
|
-
<copyright>
|
178
|
-
<from>#{Time.new.year}</from>
|
179
|
-
</copyright>
|
180
|
-
<ext>
|
181
|
-
<doctype>article</doctype>
|
182
|
-
</ext>
|
183
|
-
</bibdata>
|
184
|
-
HDR
|
185
|
-
|
186
|
-
HTML_HDR = <<~HDR.freeze
|
187
|
-
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
188
|
-
<head>
|
189
|
-
<title>test</title>
|
190
|
-
</head>
|
191
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
192
|
-
<div class="title-section">
|
193
|
-
<p> </p>
|
194
|
-
</div>
|
195
|
-
<br/>
|
196
|
-
<div class="prefatory-section">
|
197
|
-
<p> </p>
|
198
|
-
</div>
|
199
|
-
<br/>
|
200
|
-
<div class="main-section">
|
201
|
-
HDR
|
202
|
-
|
203
|
-
WORD_HDR = <<~HDR.freeze
|
204
|
-
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
205
|
-
<head>
|
206
|
-
<title>test</title>
|
207
|
-
</head>
|
208
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
209
|
-
<div class="WordSection1">
|
210
|
-
<p> </p>
|
211
|
-
</div>
|
212
|
-
<br clear="all" class="section"/>
|
213
|
-
<div class="WordSection2">
|
214
|
-
<p> </p>
|
215
|
-
</div>
|
216
|
-
<br clear="all" class="section"/>
|
217
|
-
<div class="WordSection3">
|
218
|
-
HDR
|
219
|
-
|
220
|
-
def examples_path(path)
|
221
|
-
File.join(File.expand_path("./examples", __dir__), path)
|
222
|
-
end
|
223
|
-
|
224
|
-
def fixtures_path(path)
|
225
|
-
File.join(File.expand_path("./fixtures", __dir__), path)
|
226
|
-
end
|
227
|
-
|
228
|
-
def stub_fetch_ref(**opts)
|
229
|
-
xml = ""
|
230
|
-
|
231
|
-
hit = double("hit")
|
232
|
-
expect(hit).to receive(:[]).with("title") do
|
233
|
-
Nokogiri::XML(xml).at("//docidentifier").content
|
234
|
-
end.at_least(:once)
|
235
|
-
|
236
|
-
hit_instance = double("hit_instance")
|
237
|
-
expect(hit_instance).to receive(:hit).and_return(hit).at_least(:once)
|
238
|
-
expect(hit_instance).to receive(:to_xml) do |builder, opt|
|
239
|
-
expect(builder).to be_instance_of Nokogiri::XML::Builder
|
240
|
-
expect(opt).to eq opts
|
241
|
-
builder << xml
|
242
|
-
end.at_least :once
|
243
|
-
|
244
|
-
hit_page = double("hit_page")
|
245
|
-
expect(hit_page).to receive(:first).and_return(hit_instance).at_least :once
|
246
|
-
|
247
|
-
hit_pages = double("hit_pages")
|
248
|
-
expect(hit_pages).to receive(:first).and_return(hit_page).at_least :once
|
249
|
-
|
250
|
-
expect(RelatonIso::IsoBibliography).to receive(:search)
|
251
|
-
.and_wrap_original do |search, *args|
|
252
|
-
code = args[0]
|
253
|
-
expect(code).to be_instance_of String
|
254
|
-
xml = get_xml(search, code, opts)
|
255
|
-
hit_pages
|
256
|
-
end.at_least :once
|
257
|
-
end
|
258
|
-
|
259
|
-
private
|
260
|
-
|
261
|
-
def get_xml(search, code, opts)
|
262
|
-
c = code.gsub(%r{[/\s:-]}, "_").sub(%r{_+$}, "").downcase
|
263
|
-
file = examples_path("#{[c, opts.keys.join('_')].join '_'}.xml")
|
264
|
-
if File.exist? file
|
265
|
-
File.read file
|
266
|
-
else
|
267
|
-
xml = search.call(code)&.first&.first&.to_xml nil, opts
|
268
|
-
File.write file, xml
|
269
|
-
xml
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
def mock_open_uri(code)
|
274
|
-
expect(OpenURI).to receive(:open_uri).and_wrap_original do |m, *args|
|
275
|
-
# expect(args[0]).to be_instance_of String
|
276
|
-
file = examples_path("#{code.tr('-', '_')}.html")
|
277
|
-
File.write file, m.call(*args).read unless File.exist? file
|
278
|
-
File.read file, encoding: "utf-8"
|
279
|
-
end.at_least :once
|
280
|
-
end
|
281
|
-
|
282
|
-
def metanorma_process(input)
|
283
|
-
Metanorma::Input::Asciidoc
|
284
|
-
.new
|
285
|
-
.process(input, "test.adoc", :standoc)
|
286
|
-
end
|
287
|
-
|
288
|
-
def xml_string_conent(xml)
|
289
|
-
strip_guid(Nokogiri::HTML(xml).to_s)
|
290
|
-
end
|