metanorma-iso 1.5.13 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +17 -0
- data/lib/asciidoctor/iso/base.rb +1 -6
- data/lib/asciidoctor/iso/basicdoc.rng +52 -3
- data/lib/asciidoctor/iso/cleanup.rb +0 -6
- data/lib/asciidoctor/iso/front.rb +5 -5
- data/lib/asciidoctor/iso/isodoc.rng +114 -3
- data/lib/asciidoctor/iso/isostandard-amd.rng +8 -4
- data/lib/asciidoctor/iso/isostandard.rng +19 -10
- data/lib/asciidoctor/iso/validate.rb +78 -0
- data/lib/asciidoctor/iso/validate_section.rb +12 -9
- data/lib/isodoc/iso/html/header.html +12 -12
- data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
- data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
- data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
- data/lib/isodoc/iso/html_convert.rb +2 -2
- data/lib/isodoc/iso/i18n-en.yaml +2 -0
- data/lib/isodoc/iso/i18n-fr.yaml +1 -1
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +486 -206
- data/lib/isodoc/iso/iso.international-standard.xsl +486 -206
- data/lib/isodoc/iso/sections.rb +1 -1
- data/lib/isodoc/iso/word_convert.rb +2 -2
- data/lib/isodoc/iso/xref.rb +28 -12
- data/lib/metanorma/iso/processor.rb +11 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +2 -2
- data/spec/asciidoctor-iso/amd_spec.rb +14 -14
- data/spec/asciidoctor-iso/base_spec.rb +20 -20
- data/spec/asciidoctor-iso/blocks_spec.rb +21 -21
- data/spec/asciidoctor-iso/cleanup_spec.rb +32 -26
- data/spec/asciidoctor-iso/inline_spec.rb +7 -7
- data/spec/asciidoctor-iso/lists_spec.rb +3 -3
- data/spec/asciidoctor-iso/refs_spec.rb +4 -4
- data/spec/asciidoctor-iso/section_spec.rb +7 -7
- data/spec/asciidoctor-iso/table_spec.rb +4 -4
- data/spec/asciidoctor-iso/validate_spec.rb +457 -87
- data/spec/isodoc/amd_spec.rb +13 -13
- data/spec/isodoc/iso_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +1 -0
- data/spec/spec_helper.rb +12 -0
- metadata +7 -11
- data/lib/asciidoctor/iso/macros.rb +0 -21
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
- data/lib/metanorma/iso/fonts_manifest.yaml +0 -6
- data/spec/asciidoctor-iso/macros_spec.rb +0 -310
data/spec/isodoc/amd_spec.rb
CHANGED
@@ -66,9 +66,9 @@ RSpec.describe IsoDoc do
|
|
66
66
|
<preface>
|
67
67
|
<foreword>
|
68
68
|
<p>
|
69
|
-
<xref target='N'>
|
70
|
-
<xref target='note1'>
|
71
|
-
<xref target='note2'>
|
69
|
+
<xref target='N'>Scope, Note</xref>
|
70
|
+
<xref target='note1'>Widgets, 1, Note 1</xref>
|
71
|
+
<xref target='note2'>Widgets, 1, Note 2</xref>
|
72
72
|
<xref target='AN'>A.1, Note</xref>
|
73
73
|
<xref target='Anote1'>A.2, Note 1</xref>
|
74
74
|
<xref target='Anote2'>A.2, Note 2</xref>
|
@@ -231,15 +231,15 @@ RSpec.describe IsoDoc do
|
|
231
231
|
This is a preamble
|
232
232
|
<xref target='C'>0.1</xref>
|
233
233
|
<xref target='C1'>0.2</xref>
|
234
|
-
<xref target='D'>
|
234
|
+
<xref target='D'>Scope</xref>
|
235
235
|
<xref target='H'>[H]</xref>
|
236
236
|
<xref target='I'>[I]</xref>
|
237
237
|
<xref target='J'>[J]</xref>
|
238
238
|
<xref target='K'>[K]</xref>
|
239
239
|
<xref target='L'>[L]</xref>
|
240
|
-
<xref target='M'>
|
241
|
-
<xref target='N'>
|
242
|
-
<xref target='O'>
|
240
|
+
<xref target='M'>Clause 4</xref>
|
241
|
+
<xref target='N'>Introduction</xref>
|
242
|
+
<xref target='O'>Clause 4.2</xref>
|
243
243
|
<xref target='P'>Annex A</xref>
|
244
244
|
<xref target='Q'>A.1</xref>
|
245
245
|
<xref target='Q1'>A.1.1</xref>
|
@@ -263,10 +263,10 @@ RSpec.describe IsoDoc do
|
|
263
263
|
<clause id='M' inline-header='false' obligation='normative'>
|
264
264
|
<title depth="1">Clause 4</title>
|
265
265
|
<clause id='N' inline-header='false' obligation='normative'>
|
266
|
-
<title depth="
|
266
|
+
<title depth="2">Introduction</title>
|
267
267
|
</clause>
|
268
268
|
<clause id='O' inline-header='false' obligation='normative'>
|
269
|
-
<title depth="
|
269
|
+
<title depth="2">Clause 4.2</title>
|
270
270
|
</clause>
|
271
271
|
</clause>
|
272
272
|
</sections>
|
@@ -452,10 +452,10 @@ RSpec.describe IsoDoc do
|
|
452
452
|
<clause id='M' inline-header='false' obligation='normative'>
|
453
453
|
<title depth='1'>Clause 4</title>
|
454
454
|
<clause id='N' inline-header='false' obligation='normative'>
|
455
|
-
<title depth='
|
455
|
+
<title depth='2'>Introduction</title>
|
456
456
|
</clause>
|
457
457
|
<clause id='O' inline-header='false' obligation='normative'>
|
458
|
-
<title depth='
|
458
|
+
<title depth='2'>Clause 4.2</title>
|
459
459
|
</clause>
|
460
460
|
<clause id='O1' inline-header='true' obligation='normative'> </clause>
|
461
461
|
</clause>
|
@@ -570,10 +570,10 @@ RSpec.describe IsoDoc do
|
|
570
570
|
<div id='M'>
|
571
571
|
<h1>Clause 4</h1>
|
572
572
|
<div id='N'>
|
573
|
-
<
|
573
|
+
<h2>Introduction</h2>
|
574
574
|
</div>
|
575
575
|
<div id='O'>
|
576
|
-
<
|
576
|
+
<h2>Clause 4.2</h2>
|
577
577
|
</div>
|
578
578
|
<div id='O1'>
|
579
579
|
</div>
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -49,8 +49,8 @@ RSpec.describe IsoDoc::Iso do
|
|
49
49
|
INPUT
|
50
50
|
html = File.read("test.html", encoding: "utf-8")
|
51
51
|
expect(html).to match(%r[\bpre[^{]+\{[^{]+font-family: "Courier New", monospace;]m)
|
52
|
-
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "
|
53
|
-
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "
|
52
|
+
expect(html).to match(%r[blockquote[^{]+\{[^{]+font-family: "Source Han Sans", serif;]m)
|
53
|
+
expect(html).to match(%r[\.h2Annex[^{]+\{[^{]+font-family: "Source Han Sans", sans-serif;]m)
|
54
54
|
end
|
55
55
|
|
56
56
|
it "processes isodoc as ISO: user nominated fonts" do
|
@@ -94,6 +94,7 @@ RSpec.describe IsoDoc do
|
|
94
94
|
|
95
95
|
it "generates Pdf output docs with null configuration from file" do
|
96
96
|
FileUtils.rm_f "spec/assets/iso.pdf"
|
97
|
+
mock_pdf
|
97
98
|
IsoDoc::Iso::PdfConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
|
98
99
|
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
99
100
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -259,6 +259,18 @@ def stub_fetch_ref(**opts)
|
|
259
259
|
end.at_least :once
|
260
260
|
end
|
261
261
|
|
262
|
+
def mock_pdf
|
263
|
+
allow(::Mn2pdf).to receive(:convert) do |url, output, c, d|
|
264
|
+
FileUtils.cp(url.gsub(/"/, ""), output.gsub(/"/, ""))
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
def mock_sts
|
269
|
+
allow(::Mn2sts).to receive(:convert) do |url, output, c, d|
|
270
|
+
FileUtils.cp(url.gsub(/"/, ""), output.gsub(/"/, ""))
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
262
274
|
private
|
263
275
|
|
264
276
|
def get_xml(search, code, opts)
|
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.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-jing
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.5.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metanorma-standoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: tokenizer
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,10 +292,8 @@ files:
|
|
292
292
|
- lib/asciidoctor/iso/isostandard-amd.rng
|
293
293
|
- lib/asciidoctor/iso/isostandard.rnc
|
294
294
|
- lib/asciidoctor/iso/isostandard.rng
|
295
|
-
- lib/asciidoctor/iso/macros.rb
|
296
295
|
- lib/asciidoctor/iso/reqt.rng
|
297
296
|
- lib/asciidoctor/iso/section.rb
|
298
|
-
- lib/asciidoctor/iso/term_lookup_cleanup.rb
|
299
297
|
- lib/asciidoctor/iso/validate.rb
|
300
298
|
- lib/asciidoctor/iso/validate_requirements.rb
|
301
299
|
- lib/asciidoctor/iso/validate_section.rb
|
@@ -336,7 +334,6 @@ files:
|
|
336
334
|
- lib/isodoc/iso/xref.rb
|
337
335
|
- lib/metanorma-iso.rb
|
338
336
|
- lib/metanorma/iso.rb
|
339
|
-
- lib/metanorma/iso/fonts_manifest.yaml
|
340
337
|
- lib/metanorma/iso/processor.rb
|
341
338
|
- lib/metanorma/iso/version.rb
|
342
339
|
- metanorma-iso.gemspec
|
@@ -346,7 +343,6 @@ files:
|
|
346
343
|
- spec/asciidoctor-iso/cleanup_spec.rb
|
347
344
|
- spec/asciidoctor-iso/inline_spec.rb
|
348
345
|
- spec/asciidoctor-iso/lists_spec.rb
|
349
|
-
- spec/asciidoctor-iso/macros_spec.rb
|
350
346
|
- spec/asciidoctor-iso/refs_spec.rb
|
351
347
|
- spec/asciidoctor-iso/section_spec.rb
|
352
348
|
- spec/asciidoctor-iso/table_spec.rb
|
@@ -414,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
414
410
|
- !ruby/object:Gem::Version
|
415
411
|
version: '0'
|
416
412
|
requirements: []
|
417
|
-
rubygems_version: 3.
|
413
|
+
rubygems_version: 3.1.4
|
418
414
|
signing_key:
|
419
415
|
specification_version: 4
|
420
416
|
summary: metanorma-iso lets you write ISO standards in AsciiDoc.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'asciidoctor/extensions'
|
4
|
-
|
5
|
-
module Asciidoctor
|
6
|
-
module Iso
|
7
|
-
# Macro to transform `term[X,Y]` into em, termxref xml
|
8
|
-
class TermRefInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
9
|
-
use_dsl
|
10
|
-
|
11
|
-
named :term
|
12
|
-
name_positional_attributes 'name', 'termxref'
|
13
|
-
using_format :short
|
14
|
-
|
15
|
-
def process(_parent, _target, attrs)
|
16
|
-
termref = attrs['termxref'] || attrs['name']
|
17
|
-
"<em>#{attrs['name']}</em> (<termxref>#{termref}</termxref>)"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true.
|
2
|
-
|
3
|
-
module Asciidoctor
|
4
|
-
module ISO
|
5
|
-
# Intelligent term lookup xml modifier
|
6
|
-
# Lookup all `term` and `calause` tags and replace `termxref` tags with
|
7
|
-
# `xref`:target tag
|
8
|
-
class TermLookupCleanup
|
9
|
-
AUTOMATIC_GENERATED_ID_REGEXP = /\A_/
|
10
|
-
EXISTING_TERM_REGEXP = /\Aterm-/
|
11
|
-
|
12
|
-
attr_reader :xmldoc, :termlookup, :log
|
13
|
-
|
14
|
-
def initialize(xmldoc, log)
|
15
|
-
@xmldoc = xmldoc
|
16
|
-
@log = log
|
17
|
-
@termlookup = {}
|
18
|
-
end
|
19
|
-
|
20
|
-
def call
|
21
|
-
@termlookup = replace_automatic_generated_ids_terms
|
22
|
-
set_termxref_tags_target
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def set_termxref_tags_target
|
28
|
-
xmldoc.xpath('//termxref').each do |node|
|
29
|
-
target = normalize_ref_id(node.text)
|
30
|
-
if termlookup[target].nil?
|
31
|
-
remove_missing_ref(node, target)
|
32
|
-
next
|
33
|
-
end
|
34
|
-
modify_ref_node(node, target)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def remove_missing_ref(node, target)
|
39
|
-
log.add('AsciiDoc Input', node,
|
40
|
-
%(Error: Term reference in `term[#{target}]` missing: \
|
41
|
-
"#{target}" is not defined in document))
|
42
|
-
term_name_node = node.previous.previous
|
43
|
-
term_name_node.remove
|
44
|
-
term_name_node.name = "strong"
|
45
|
-
term_name_node.children.first.content =
|
46
|
-
%(term "#{term_name_node.text}" not resolved)
|
47
|
-
node.add_previous_sibling(term_name_node)
|
48
|
-
node.remove
|
49
|
-
end
|
50
|
-
|
51
|
-
def modify_ref_node(node, target)
|
52
|
-
node.name = 'xref'
|
53
|
-
node['target'] = termlookup[target]
|
54
|
-
node.children.remove
|
55
|
-
node.remove_attribute('defaultref')
|
56
|
-
end
|
57
|
-
|
58
|
-
def replace_automatic_generated_ids_terms
|
59
|
-
xmldoc.xpath('//term').each.with_object({}) do |term_node, res|
|
60
|
-
normalize_id_and_memorize(term_node, res, './preferred')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def normalize_id_and_memorize(term_node, res_table, text_selector)
|
65
|
-
term_text = normalize_ref_id(term_node.at(text_selector).text)
|
66
|
-
unless AUTOMATIC_GENERATED_ID_REGEXP.match(term_node['id']).nil?
|
67
|
-
term_node['id'] = unique_text_id(term_text)
|
68
|
-
end
|
69
|
-
res_table[term_text] = term_node['id']
|
70
|
-
end
|
71
|
-
|
72
|
-
def normalize_ref_id(text)
|
73
|
-
text.downcase.gsub(/[[:space:]]/, '-')
|
74
|
-
end
|
75
|
-
|
76
|
-
def unique_text_id(text)
|
77
|
-
return "term-#{text}" if xmldoc.at("//*[@id = 'term-#{text}']").nil?
|
78
|
-
(1..Float::INFINITY).lazy.each do |index|
|
79
|
-
if xmldoc.at("//*[@id = 'term-#{text}-#{index}']").nil?
|
80
|
-
break("term-#{text}-#{index}")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,310 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe Asciidoctor::ISO do
|
4
|
-
it "processes the Asciidoctor::ISO inline macros" do
|
5
|
-
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
|
-
#{ASCIIDOC_BLANK_HDR}
|
7
|
-
alt:[term1]
|
8
|
-
deprecated:[term1]
|
9
|
-
domain:[term1]
|
10
|
-
INPUT
|
11
|
-
#{BLANK_HDR}
|
12
|
-
<sections>
|
13
|
-
<admitted>term1</admitted>
|
14
|
-
<deprecates>term1</deprecates>
|
15
|
-
<domain>term1</domain>
|
16
|
-
</sections>
|
17
|
-
</iso-standard>
|
18
|
-
OUTPUT
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'term inline macros' do
|
22
|
-
subject(:convert) do
|
23
|
-
xmlpp(
|
24
|
-
strip_guid(
|
25
|
-
Asciidoctor.convert(
|
26
|
-
input, backend: :iso, header_footer: true)))
|
27
|
-
end
|
28
|
-
let(:input) do
|
29
|
-
<<~XML
|
30
|
-
#{ASCIIDOC_BLANK_HDR}
|
31
|
-
== Terms and Definitions
|
32
|
-
|
33
|
-
=== name2
|
34
|
-
|
35
|
-
== Main
|
36
|
-
|
37
|
-
term:[name,name2] is a term
|
38
|
-
XML
|
39
|
-
end
|
40
|
-
let(:output) do
|
41
|
-
<<~XML
|
42
|
-
#{BLANK_HDR}
|
43
|
-
<sections>
|
44
|
-
<terms id='_' obligation='normative'>
|
45
|
-
<title>Terms and definitions</title>
|
46
|
-
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
47
|
-
<p id='_'>
|
48
|
-
ISO and IEC maintain terminological databases for use in standardization
|
49
|
-
at the following addresses:
|
50
|
-
</p>
|
51
|
-
<ul id='_'>
|
52
|
-
<li>
|
53
|
-
<p id='_'>
|
54
|
-
ISO Online browsing platform: available at
|
55
|
-
<link target='http://www.iso.org/obp'/>
|
56
|
-
</p>
|
57
|
-
</li>
|
58
|
-
<li>
|
59
|
-
<p id='_'>
|
60
|
-
IEC Electropedia: available at
|
61
|
-
<link target='http://www.electropedia.org'/>
|
62
|
-
</p>
|
63
|
-
</li>
|
64
|
-
</ul>
|
65
|
-
<term id='term-name2'>
|
66
|
-
<preferred>name2</preferred>
|
67
|
-
</term>
|
68
|
-
</terms>
|
69
|
-
<clause id='_' inline-header='false' obligation='normative'>
|
70
|
-
<title>Main</title>
|
71
|
-
<p id='_'>
|
72
|
-
<em>name</em>
|
73
|
-
(
|
74
|
-
<xref target='term-name2'/>
|
75
|
-
) is a term
|
76
|
-
</p>
|
77
|
-
</clause>
|
78
|
-
</sections>
|
79
|
-
</iso-standard>
|
80
|
-
XML
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'converts macro into the correct xml' do
|
84
|
-
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
85
|
-
end
|
86
|
-
|
87
|
-
context 'default params' do
|
88
|
-
let(:input) do
|
89
|
-
<<~XML
|
90
|
-
#{ASCIIDOC_BLANK_HDR}
|
91
|
-
|
92
|
-
== Terms and Definitions
|
93
|
-
|
94
|
-
=== name
|
95
|
-
|
96
|
-
== Main
|
97
|
-
|
98
|
-
term:[name] is a term
|
99
|
-
XML
|
100
|
-
end
|
101
|
-
let(:output) do
|
102
|
-
<<~XML
|
103
|
-
#{BLANK_HDR}
|
104
|
-
<sections>
|
105
|
-
<terms id='_' obligation='normative'>
|
106
|
-
<title>Terms and definitions</title>
|
107
|
-
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
108
|
-
<p id='_'>
|
109
|
-
ISO and IEC maintain terminological databases for use in standardization
|
110
|
-
at the following addresses:
|
111
|
-
</p>
|
112
|
-
<ul id='_'>
|
113
|
-
<li>
|
114
|
-
<p id='_'>
|
115
|
-
ISO Online browsing platform: available at
|
116
|
-
<link target='http://www.iso.org/obp' />
|
117
|
-
</p>
|
118
|
-
</li>
|
119
|
-
<li>
|
120
|
-
<p id='_'>
|
121
|
-
IEC Electropedia: available at
|
122
|
-
<link target='http://www.electropedia.org' />
|
123
|
-
</p>
|
124
|
-
</li>
|
125
|
-
</ul>
|
126
|
-
<term id='term-name'>
|
127
|
-
<preferred>name</preferred>
|
128
|
-
</term>
|
129
|
-
</terms>
|
130
|
-
<clause id='_' inline-header='false' obligation='normative'>
|
131
|
-
<title>Main</title>
|
132
|
-
<p id='_'>
|
133
|
-
<em>name</em>
|
134
|
-
(
|
135
|
-
<xref target='term-name' />
|
136
|
-
) is a term
|
137
|
-
</p>
|
138
|
-
</clause>
|
139
|
-
</sections>
|
140
|
-
</iso-standard>
|
141
|
-
XML
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'uses `name` as termref name' do
|
145
|
-
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
context 'multiply exising ids in document' do
|
150
|
-
let(:input) do
|
151
|
-
<<~XML
|
152
|
-
#{ASCIIDOC_BLANK_HDR}
|
153
|
-
|
154
|
-
== Terms and Definitions
|
155
|
-
|
156
|
-
=== name
|
157
|
-
=== name2
|
158
|
-
|
159
|
-
[[term-name]]
|
160
|
-
== Main
|
161
|
-
|
162
|
-
paragraph
|
163
|
-
|
164
|
-
[[term-name2]]
|
165
|
-
== Second
|
166
|
-
|
167
|
-
term:[name] is a term
|
168
|
-
term:[name2] is a term
|
169
|
-
XML
|
170
|
-
end
|
171
|
-
let(:output) do
|
172
|
-
<<~XML
|
173
|
-
#{BLANK_HDR}
|
174
|
-
<sections>
|
175
|
-
<terms id='_' obligation='normative'>
|
176
|
-
<title>Terms and definitions</title>
|
177
|
-
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
178
|
-
<p id='_'>
|
179
|
-
ISO and IEC maintain terminological databases for use in standardization
|
180
|
-
at the following addresses:
|
181
|
-
</p>
|
182
|
-
<ul id='_'>
|
183
|
-
<li>
|
184
|
-
<p id='_'>
|
185
|
-
ISO Online browsing platform: available at
|
186
|
-
<link target='http://www.iso.org/obp' />
|
187
|
-
</p>
|
188
|
-
</li>
|
189
|
-
<li>
|
190
|
-
<p id='_'>
|
191
|
-
IEC Electropedia: available at
|
192
|
-
<link target='http://www.electropedia.org' />
|
193
|
-
</p>
|
194
|
-
</li>
|
195
|
-
</ul>
|
196
|
-
<term id='term-name-1'>
|
197
|
-
<preferred>name</preferred>
|
198
|
-
</term>
|
199
|
-
<term id='term-name2-1'>
|
200
|
-
<preferred>name2</preferred>
|
201
|
-
</term>
|
202
|
-
</terms>
|
203
|
-
<clause id='term-name' inline-header='false' obligation='normative'>
|
204
|
-
<title>Main</title>
|
205
|
-
<p id='_'>paragraph</p>
|
206
|
-
</clause>
|
207
|
-
<clause id='term-name2' inline-header='false' obligation='normative'>
|
208
|
-
<title>Second</title>
|
209
|
-
<p id='_'>
|
210
|
-
<em>name</em>
|
211
|
-
(
|
212
|
-
<xref target='term-name-1' />
|
213
|
-
) is a term
|
214
|
-
<em>name2</em>
|
215
|
-
(
|
216
|
-
<xref target='term-name2-1' />
|
217
|
-
) is a term
|
218
|
-
</p>
|
219
|
-
</clause>
|
220
|
-
</sections>
|
221
|
-
</iso-standard>
|
222
|
-
XML
|
223
|
-
end
|
224
|
-
|
225
|
-
it 'generates unique ids which dont match existing ids' do
|
226
|
-
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
context 'when missing actual ref' do
|
231
|
-
let(:input) do
|
232
|
-
<<~XML
|
233
|
-
#{ASCIIDOC_BLANK_HDR}
|
234
|
-
|
235
|
-
== Terms and Definitions
|
236
|
-
|
237
|
-
=== name identity
|
238
|
-
|
239
|
-
[[name-check]]
|
240
|
-
=== name check
|
241
|
-
|
242
|
-
paragraph
|
243
|
-
|
244
|
-
term:[name check] is a term
|
245
|
-
|
246
|
-
term:[name identity] is a term
|
247
|
-
|
248
|
-
Moreover, term:[missing] is a term
|
249
|
-
XML
|
250
|
-
end
|
251
|
-
let(:output) do
|
252
|
-
<<~XML
|
253
|
-
#{BLANK_HDR}
|
254
|
-
<sections>
|
255
|
-
<terms id='_' obligation='normative'>
|
256
|
-
<title>Terms and definitions</title>
|
257
|
-
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
258
|
-
<p id='_'>
|
259
|
-
ISO and IEC maintain terminological databases for use in standardization
|
260
|
-
at the following addresses:
|
261
|
-
</p>
|
262
|
-
<ul id='_'>
|
263
|
-
<li>
|
264
|
-
<p id='_'>
|
265
|
-
ISO Online browsing platform: available at
|
266
|
-
<link target='http://www.iso.org/obp'/>
|
267
|
-
</p>
|
268
|
-
</li>
|
269
|
-
<li>
|
270
|
-
<p id='_'>
|
271
|
-
IEC Electropedia: available at
|
272
|
-
<link target='http://www.electropedia.org'/>
|
273
|
-
</p>
|
274
|
-
</li>
|
275
|
-
</ul>
|
276
|
-
<term id='term-name-identity'>
|
277
|
-
<preferred>name identity</preferred>
|
278
|
-
</term>
|
279
|
-
<term id='name-check'>
|
280
|
-
<preferred>name check</preferred>
|
281
|
-
<definition>
|
282
|
-
<p id='_'>paragraph</p>
|
283
|
-
<p id='_'>
|
284
|
-
<em>name check</em>
|
285
|
-
(
|
286
|
-
<xref target='name-check'/>
|
287
|
-
) is a term
|
288
|
-
</p>
|
289
|
-
<p id='_'>
|
290
|
-
<em>name identity</em>
|
291
|
-
(
|
292
|
-
<xref target='term-name-identity'/>
|
293
|
-
) is a term
|
294
|
-
</p>
|
295
|
-
<p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
|
296
|
-
</p>
|
297
|
-
</definition>
|
298
|
-
</term>
|
299
|
-
</terms>
|
300
|
-
</sections>
|
301
|
-
</iso-standard>
|
302
|
-
XML
|
303
|
-
end
|
304
|
-
|
305
|
-
it 'generates unique ids which dont match existing ids' do
|
306
|
-
expect(convert).to(be_equivalent_to(xmlpp(output)))
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|