metanorma-standoc 2.2.0.1 → 2.2.2
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 +1 -1
- data/.github/workflows/release.yml +24 -0
- data/lib/metanorma/standoc/base.rb +16 -0
- data/lib/metanorma/standoc/biblio.rng +8 -5
- data/lib/metanorma/standoc/blocks.rb +26 -13
- data/lib/metanorma/standoc/cleanup_biblio.rb +16 -10
- data/lib/metanorma/standoc/cleanup_reqt.rb +3 -136
- data/lib/metanorma/standoc/converter.rb +0 -7
- data/lib/metanorma/standoc/front.rb +6 -1
- data/lib/metanorma/standoc/front_contributor.rb +0 -10
- data/lib/metanorma/standoc/macros_terms.rb +5 -4
- data/lib/metanorma/standoc/reqt.rb +24 -73
- data/lib/metanorma/standoc/section.rb +35 -3
- data/lib/metanorma/standoc/terms.rb +13 -7
- data/lib/metanorma/standoc/utils.rb +9 -43
- data/lib/metanorma/standoc/validate.rb +18 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/lib/metanorma-standoc.rb +1 -1
- data/metanorma-standoc.gemspec +5 -4
- data/spec/assets/correct.png +0 -0
- data/spec/assets/corrupt.png +0 -0
- data/spec/metanorma/base_spec.rb +6 -7
- data/spec/metanorma/biblio_spec.rb +8 -8
- data/spec/metanorma/blocks_spec.rb +20 -266
- data/spec/metanorma/cleanup_blocks_spec.rb +0 -168
- data/spec/metanorma/macros_concept_spec.rb +1052 -0
- data/spec/metanorma/macros_spec.rb +0 -1126
- data/spec/metanorma/reqt_spec.rb +130 -0
- data/spec/metanorma/section_spec.rb +5 -0
- data/spec/metanorma/validate_spec.rb +49 -0
- data/spec/requirements/default/blocks_spec.rb +250 -0
- data/spec/requirements/default/cleanup_spec.rb +173 -0
- data/spec/requirements/modspec/cleanup_spec.rb +333 -0
- data/spec/requirements/modspec/validate_spec.rb +330 -0
- data/spec/vcr_cassettes/bsi16341.yml +52 -36
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +88 -88
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
- data/spec/vcr_cassettes/hide_refs.yml +65 -65
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +22 -22
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +30 -30
- data/spec/vcr_cassettes/isobib_get_123_2.yml +21 -21
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +11 -11
- data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +34 -58
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
- data/spec/vcr_cassettes/std-link.yml +11 -11
- metadata +50 -28
- data/lib/isodoc/html/htmlstyle.css +0 -998
@@ -10,19 +10,26 @@ module Metanorma
|
|
10
10
|
@norm_ref = false
|
11
11
|
|
12
12
|
def sectiontype1(node)
|
13
|
+
return "abstract" if node.attr("style") == "abstract"
|
14
|
+
|
13
15
|
node&.attr("heading")&.downcase ||
|
14
|
-
node.title
|
16
|
+
node.title
|
17
|
+
.gsub(%r{<index>.*?</index>}m, "")
|
18
|
+
.gsub(%r{<fn[^>]*>.*?</fn>}m, "")
|
19
|
+
.gsub(/<[^>]+>/, "")
|
15
20
|
.strip.downcase
|
21
|
+
.sub(/\.$/, "")
|
16
22
|
end
|
17
23
|
|
18
24
|
def sectiontype(node, level = true)
|
19
25
|
ret = sectiontype1(node)
|
20
|
-
ret1 = sectiontype_streamline(ret)
|
26
|
+
ret1 = preface_main_filter(sectiontype_streamline(ret), node)
|
21
27
|
return ret1 if ret1 == "symbols and abbreviated terms"
|
22
28
|
return nil unless !level || node.level == 1
|
23
29
|
return nil if @seen_headers.include? ret
|
24
30
|
|
25
|
-
@seen_headers << ret
|
31
|
+
@seen_headers << ret unless ret1.nil?
|
32
|
+
@seen_headers_canonical << ret1 unless ret1.nil?
|
26
33
|
ret1
|
27
34
|
end
|
28
35
|
|
@@ -45,6 +52,31 @@ module Metanorma
|
|
45
52
|
end
|
46
53
|
end
|
47
54
|
|
55
|
+
PREFACE_CLAUSE_NAMES = %w(abstract foreword introduction
|
56
|
+
acknowledgements).freeze
|
57
|
+
|
58
|
+
MAIN_CLAUSE_NAMES =
|
59
|
+
["normative references", "terms and definitions", "scope",
|
60
|
+
"symbols and abbreviated terms", "clause", "bibliography"].freeze
|
61
|
+
|
62
|
+
def start_main_section(ret, node)
|
63
|
+
@preface = false if self.class::MAIN_CLAUSE_NAMES.include?(ret) &&
|
64
|
+
node.role != "preface" && node.attr("style") != "preface"
|
65
|
+
@preface = false if (self.class::PREFACE_CLAUSE_NAMES)
|
66
|
+
.intersection(@seen_headers_canonical + [ret]).empty?
|
67
|
+
end
|
68
|
+
|
69
|
+
def preface_main_filter(ret, node)
|
70
|
+
start_main_section(ret, node)
|
71
|
+
if @preface
|
72
|
+
self.class::MAIN_CLAUSE_NAMES.include?(ret) and return nil
|
73
|
+
else
|
74
|
+
self.class::PREFACE_CLAUSE_NAMES.include?(ret) and return nil
|
75
|
+
end
|
76
|
+
|
77
|
+
ret
|
78
|
+
end
|
79
|
+
|
48
80
|
def section_attributes(node)
|
49
81
|
ret = { id: Metanorma::Utils::anchor_or_uuid(node),
|
50
82
|
language: node.attributes["language"],
|
@@ -56,17 +56,23 @@ module Metanorma
|
|
56
56
|
return nonterm_term_def_subclause_parse(attrs, xml, node)
|
57
57
|
node.role == "boilerplate" and
|
58
58
|
return terms_boilerplate_parse(attrs, xml, node)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
st == "symbols and abbreviated terms" and
|
59
|
+
@definitions and return symbols_parse(attrs, xml, node)
|
60
|
+
term_contains_subclauses(node) and
|
61
|
+
return term_def_parse(attrs, xml, node, false)
|
62
|
+
case sectiontype(node, false)
|
63
|
+
when "symbols and abbreviated terms"
|
65
64
|
return symbols_parse(attrs, xml, node)
|
66
|
-
|
65
|
+
when "terms and definitions"
|
66
|
+
return clause_parse(attrs, xml, node)
|
67
|
+
end
|
67
68
|
term_def_subclause_parse1(attrs, xml, node)
|
68
69
|
end
|
69
70
|
|
71
|
+
def term_contains_subclauses(node)
|
72
|
+
sub = node.find_by(context: :section) { |s| s.level == node.level + 1 }
|
73
|
+
!sub.empty?
|
74
|
+
end
|
75
|
+
|
70
76
|
def term_def_subclause_parse1(attrs, xml, node)
|
71
77
|
xml.term **attr_code(attrs) do |xml_section|
|
72
78
|
term_designation(xml_section, node, "preferred", node.title)
|
@@ -17,43 +17,20 @@ module Metanorma
|
|
17
17
|
nil
|
18
18
|
end
|
19
19
|
|
20
|
-
NOKOHEAD = <<~HERE.freeze
|
21
|
-
<!DOCTYPE html SYSTEM
|
22
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
23
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
24
|
-
<head> <title></title> <meta charset="UTF-8" /> </head>
|
25
|
-
<body> </body> </html>
|
26
|
-
HERE
|
27
|
-
|
28
|
-
# block for processing XML document fragments as XHTML,
|
29
|
-
# to allow for HTMLentities
|
30
|
-
# Unescape special chars used in Asciidoctor substitution processing
|
31
20
|
def noko(&block)
|
32
|
-
|
33
|
-
fragment = doc.fragment("")
|
34
|
-
::Nokogiri::XML::Builder.with fragment, &block
|
35
|
-
fragment.to_xml(encoding: "US-ASCII", indent: 0,
|
36
|
-
save_with: Nokogiri::XML::Node::SaveOptions::AS_XML)
|
37
|
-
.lines.map do |l|
|
38
|
-
l.gsub(/>\n$/, ">").gsub(/\s*\n$/m, " ").gsub("–", "\u0096")
|
39
|
-
.gsub("—", "\u0097").gsub("–", "\u0096")
|
40
|
-
.gsub("—", "\u0097")
|
41
|
-
end
|
21
|
+
Metanorma::Utils::noko(&block)
|
42
22
|
end
|
43
23
|
|
44
24
|
def attr_code(attributes)
|
45
|
-
attributes
|
46
|
-
|
47
|
-
|
25
|
+
Metanorma::Utils::attr_code(attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def csv_split(text, delim = ";")
|
29
|
+
Metanorma::Utils::csv_split(text, delim)
|
48
30
|
end
|
49
31
|
|
50
|
-
# if the contents of node are blocks, output them to out;
|
51
|
-
# else, wrap them in <p>
|
52
32
|
def wrap_in_para(node, out)
|
53
|
-
|
54
|
-
else
|
55
|
-
out.p { |p| p << node.content }
|
56
|
-
end
|
33
|
+
Metanorma::Utils::wrap_in_para(node, out)
|
57
34
|
end
|
58
35
|
|
59
36
|
SUBCLAUSE_XPATH = "//clause[not(parent::sections)]"\
|
@@ -67,22 +44,11 @@ module Metanorma
|
|
67
44
|
end
|
68
45
|
|
69
46
|
def dl_to_attrs(elem, dlist, name)
|
70
|
-
|
71
|
-
val = e.at("./following::dd/p") || e.at("./following::dd") or return
|
72
|
-
elem[name] = val.text
|
47
|
+
Metanorma::Utils::dl_to_attrs(elem, dlist, name)
|
73
48
|
end
|
74
49
|
|
75
50
|
def dl_to_elems(ins, elem, dlist, name)
|
76
|
-
|
77
|
-
ins = a if a
|
78
|
-
dlist.xpath("./dt[text()='#{name}']").each do |e|
|
79
|
-
v = e.at("./following::dd")
|
80
|
-
e = v.elements and e.size == 1 && e.first.name == "p" and v = e.first
|
81
|
-
v.name = name
|
82
|
-
ins.next = v
|
83
|
-
ins = ins.next
|
84
|
-
end
|
85
|
-
ins
|
51
|
+
Metanorma::Utils::dl_to_elems(ins, elem, dlist, name)
|
86
52
|
end
|
87
53
|
|
88
54
|
def term_expr(elem)
|
@@ -4,6 +4,8 @@ require_relative "./validate_table"
|
|
4
4
|
require "nokogiri"
|
5
5
|
require "jing"
|
6
6
|
require "iev"
|
7
|
+
require "pngcheck"
|
8
|
+
require "png"
|
7
9
|
|
8
10
|
module Metanorma
|
9
11
|
module Standoc
|
@@ -51,6 +53,8 @@ module Metanorma
|
|
51
53
|
concept_validate(doc, "concept", "refterm")
|
52
54
|
concept_validate(doc, "related", "preferred//name")
|
53
55
|
table_validate(doc)
|
56
|
+
requirement_validate(doc)
|
57
|
+
image_validate(doc)
|
54
58
|
@fatalerror.empty? or clean_abort(@fatalerror.join("\n"), doc.to_xml)
|
55
59
|
end
|
56
60
|
|
@@ -154,6 +158,20 @@ module Metanorma
|
|
154
158
|
end
|
155
159
|
end
|
156
160
|
|
161
|
+
def image_validate(doc)
|
162
|
+
doc.xpath("//image[@mimetype = 'image/png']").each do |i|
|
163
|
+
d = Metanorma::Utils::datauri(i["src"], @localdir)
|
164
|
+
png_validate1(i, Base64.strict_decode64(d.sub(/^.+?base64,/, "")))
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def png_validate1(img, buffer)
|
169
|
+
PngCheck.check_buffer(buffer)
|
170
|
+
rescue PngCheck::CorruptPngError => e
|
171
|
+
@log.add("Images", img.parent, "Corrupt PNG image")
|
172
|
+
@fatalerror << "Exception #{e.message}"
|
173
|
+
end
|
174
|
+
|
157
175
|
def validate(doc)
|
158
176
|
content_validate(doc)
|
159
177
|
schema_validate(formattedstr_strip(doc.dup),
|
data/lib/metanorma-standoc.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative "metanorma/standoc/converter"
|
|
4
4
|
require_relative "metanorma/standoc/version"
|
5
5
|
require "asciidoctor/extensions"
|
6
6
|
|
7
|
-
if defined? Metanorma
|
7
|
+
if defined? Metanorma::Registry
|
8
8
|
require_relative "metanorma/standoc"
|
9
9
|
Metanorma::Registry.instance.register(Metanorma::Standoc::Processor)
|
10
10
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
29
29
|
spec.add_dependency "iev", "~> 0.3.0"
|
30
|
-
spec.add_dependency "isodoc", "~> 2.2.
|
30
|
+
spec.add_dependency "isodoc", "~> 2.2.3"
|
31
31
|
spec.add_dependency "metanorma-plugin-datastruct", "~> 0.2.0"
|
32
32
|
spec.add_dependency "metanorma-plugin-lutaml"
|
33
33
|
spec.add_dependency "ruby-jing"
|
@@ -36,8 +36,10 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_dependency "concurrent-ruby"
|
37
37
|
spec.add_dependency "latexmath"
|
38
38
|
spec.add_dependency "mathml2asciimath"
|
39
|
-
spec.add_dependency "
|
40
|
-
spec.add_dependency "
|
39
|
+
spec.add_dependency "mn-requirements", "~> 0.1.3"
|
40
|
+
spec.add_dependency "png"
|
41
|
+
spec.add_dependency "pngcheck"
|
42
|
+
spec.add_dependency "relaton-cli", "~> 1.13.0"
|
41
43
|
spec.add_dependency "relaton-iev", "~> 1.1.0"
|
42
44
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
43
45
|
|
@@ -45,7 +47,6 @@ Gem::Specification.new do |spec|
|
|
45
47
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
46
48
|
spec.add_development_dependency "guard", "~> 2.14"
|
47
49
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
48
|
-
spec.add_development_dependency "metanorma-iso", "~>2.1.2"
|
49
50
|
spec.add_development_dependency "rake", "~> 13.0"
|
50
51
|
spec.add_development_dependency "rspec", "~> 3.6"
|
51
52
|
spec.add_development_dependency "rubocop", "~> 1.5.2"
|
Binary file
|
Binary file
|
data/spec/metanorma/base_spec.rb
CHANGED
@@ -222,7 +222,7 @@ RSpec.describe Metanorma::Standoc do
|
|
222
222
|
:iteration: 3
|
223
223
|
:language: en
|
224
224
|
:title: Main Title -- Title
|
225
|
-
:library-ics:
|
225
|
+
:library-ics: 01.040.11,11.060.01
|
226
226
|
:fullname: Fred Flintstone
|
227
227
|
:role: author
|
228
228
|
:affiliation: Slate Rock and Gravel Company
|
@@ -509,14 +509,13 @@ RSpec.describe Metanorma::Standoc do
|
|
509
509
|
<technical-committee number="1" type="A">TC</technical-committee>
|
510
510
|
<technical-committee number="11" type="A1">TC1</technical-committee>
|
511
511
|
</editorialgroup>
|
512
|
-
|
513
|
-
<code>
|
514
|
-
|
515
|
-
<ics>
|
516
|
-
<code>2</code>
|
512
|
+
<ics>
|
513
|
+
<code>01.040.11</code>
|
514
|
+
<text>Health care technology (Vocabularies)</text>
|
517
515
|
</ics>
|
518
516
|
<ics>
|
519
|
-
<code>
|
517
|
+
<code>11.060.01</code>
|
518
|
+
<text>Dentistry in general</text>
|
520
519
|
</ics>
|
521
520
|
</ext>
|
522
521
|
</bibdata>
|
@@ -235,7 +235,7 @@ RSpec.describe Metanorma::Standoc do
|
|
235
235
|
person::
|
236
236
|
name:::
|
237
237
|
language:::: en
|
238
|
-
|
238
|
+
formatted_initials:::: A.
|
239
239
|
surname:::: Bierman
|
240
240
|
affiliation:::
|
241
241
|
+
|
@@ -377,8 +377,8 @@ RSpec.describe Metanorma::Standoc do
|
|
377
377
|
<role type="author"/>
|
378
378
|
<person>
|
379
379
|
<name>
|
380
|
-
<
|
381
|
-
<surname
|
380
|
+
<formatted-initials>A.</formatted-initials>
|
381
|
+
<surname>Bierman</surname>
|
382
382
|
</name>
|
383
383
|
<affiliation>
|
384
384
|
<description language="en" script="Latn">Affiliation description</description>
|
@@ -590,7 +590,7 @@ RSpec.describe Metanorma::Standoc do
|
|
590
590
|
contributor.role:: publisher
|
591
591
|
contributor::
|
592
592
|
contributor.person.name.language:: en
|
593
|
-
contributor.person.name.
|
593
|
+
contributor.person.name.formatted_initials:: A.
|
594
594
|
contributor.person.name.surname:: Bierman
|
595
595
|
contributor.person.affiliation.organization.name:: IETF
|
596
596
|
contributor.person.affiliation.organization.abbreviation:: IETF
|
@@ -706,8 +706,8 @@ RSpec.describe Metanorma::Standoc do
|
|
706
706
|
<role type="author"/>
|
707
707
|
<person>
|
708
708
|
<name>
|
709
|
-
<
|
710
|
-
<surname
|
709
|
+
<formatted-initials>A.</formatted-initials>
|
710
|
+
<surname>Bierman</surname>
|
711
711
|
</name>
|
712
712
|
<affiliation>
|
713
713
|
<description language="en" script="Latn">Affiliation description</description>
|
@@ -933,7 +933,7 @@ RSpec.describe Metanorma::Standoc do
|
|
933
933
|
<role type='author'/>
|
934
934
|
<person>
|
935
935
|
<name>
|
936
|
-
<
|
936
|
+
<formatted-initials>S.</formatted-initials>
|
937
937
|
<surname>Wozniak</surname>
|
938
938
|
</name>
|
939
939
|
</person>
|
@@ -951,7 +951,7 @@ RSpec.describe Metanorma::Standoc do
|
|
951
951
|
<role type='editor'/>
|
952
952
|
<person>
|
953
953
|
<name>
|
954
|
-
<
|
954
|
+
<formatted-initials>W. H</formatted-initials>
|
955
955
|
<surname>Gates</surname>
|
956
956
|
</name>
|
957
957
|
</person>
|
@@ -456,16 +456,16 @@ RSpec.describe Metanorma::Standoc do
|
|
456
456
|
====
|
457
457
|
INPUT
|
458
458
|
output = <<~OUTPUT
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
459
|
+
#{BLANK_HDR}
|
460
|
+
<sections>
|
461
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
462
|
+
<title>Clause</title>
|
463
|
+
<termnote id='_'>
|
464
|
+
<p id='_'>XYZ</p>
|
465
|
+
</termnote>
|
466
|
+
</clause>
|
467
|
+
</sections>
|
468
|
+
</standard-document>
|
469
469
|
OUTPUT
|
470
470
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
471
471
|
.to be_equivalent_to xmlpp(output)
|
@@ -764,16 +764,16 @@ RSpec.describe Metanorma::Standoc do
|
|
764
764
|
====
|
765
765
|
INPUT
|
766
766
|
output = <<~OUTPUT
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
767
|
+
#{BLANK_HDR}
|
768
|
+
<sections>
|
769
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
770
|
+
<title>Clause</title>
|
771
|
+
<termexample id='_'>
|
772
|
+
<p id='_'>XYZ</p>
|
773
|
+
</termexample>
|
774
|
+
</clause>
|
775
|
+
</sections>
|
776
|
+
</standard-document>
|
777
777
|
OUTPUT
|
778
778
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
779
779
|
.to be_equivalent_to xmlpp(output)
|
@@ -1616,252 +1616,6 @@ RSpec.describe Metanorma::Standoc do
|
|
1616
1616
|
.to be_equivalent_to xmlpp(output)
|
1617
1617
|
end
|
1618
1618
|
|
1619
|
-
it "processes recommendation" do
|
1620
|
-
input = <<~"INPUT"
|
1621
|
-
#{ASCIIDOC_BLANK_HDR}
|
1622
|
-
[.recommendation,identifier="/ogc/recommendation/wfs/2",subject="user;developer, implementer",inherit="/ss/584/2015/level/1; /ss/584/2015/level/2",options="unnumbered",type=verification,model=ogc,tag=X,multilingual-rendering=common]
|
1623
|
-
====
|
1624
|
-
I recommend this
|
1625
|
-
====
|
1626
|
-
INPUT
|
1627
|
-
output = <<~"OUTPUT"
|
1628
|
-
#{BLANK_HDR}
|
1629
|
-
<sections>
|
1630
|
-
<recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
|
1631
|
-
<identifier>/ogc/recommendation/wfs/2</identifier>
|
1632
|
-
<subject>user</subject>
|
1633
|
-
<subject>developer, implementer</subject>
|
1634
|
-
<inherit>/ss/584/2015/level/1</inherit>
|
1635
|
-
<inherit>/ss/584/2015/level/2</inherit>
|
1636
|
-
<description><p id="_">I recommend this</p>
|
1637
|
-
</description>
|
1638
|
-
</recommendation>
|
1639
|
-
</sections>
|
1640
|
-
</standard-document>
|
1641
|
-
OUTPUT
|
1642
|
-
|
1643
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1644
|
-
.to be_equivalent_to xmlpp(output)
|
1645
|
-
end
|
1646
|
-
|
1647
|
-
it "processes requirement" do
|
1648
|
-
input = <<~"INPUT"
|
1649
|
-
#{ASCIIDOC_BLANK_HDR}
|
1650
|
-
[[ABC]]
|
1651
|
-
[.requirement,subsequence="A",inherit="/ss/584/2015/level/1 & /ss/584/2015/level/2",number=3,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
|
1652
|
-
.Title
|
1653
|
-
====
|
1654
|
-
I recommend this
|
1655
|
-
|
1656
|
-
. http://www.example.com[]
|
1657
|
-
. <<ABC>>
|
1658
|
-
====
|
1659
|
-
INPUT
|
1660
|
-
output = <<~OUTPUT
|
1661
|
-
#{BLANK_HDR}
|
1662
|
-
<sections>
|
1663
|
-
<requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
|
1664
|
-
<title>Title</title>
|
1665
|
-
<inherit>/ss/584/2015/level/1 & /ss/584/2015/level/2</inherit>
|
1666
|
-
<description><p id="_">I recommend this</p>
|
1667
|
-
<ol id='_' type='arabic'>
|
1668
|
-
<li>
|
1669
|
-
<p id='_'>
|
1670
|
-
<link target='http://www.example.com'/>
|
1671
|
-
</p>
|
1672
|
-
</li>
|
1673
|
-
<li>
|
1674
|
-
<p id='_'>
|
1675
|
-
<xref target='ABC'/>
|
1676
|
-
</p>
|
1677
|
-
</li>
|
1678
|
-
</ol>
|
1679
|
-
</description>
|
1680
|
-
</requirement>
|
1681
|
-
</sections>
|
1682
|
-
</standard-document>
|
1683
|
-
OUTPUT
|
1684
|
-
|
1685
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1686
|
-
.to be_equivalent_to xmlpp(output)
|
1687
|
-
end
|
1688
|
-
|
1689
|
-
it "processes permission" do
|
1690
|
-
input = <<~"INPUT"
|
1691
|
-
#{ASCIIDOC_BLANK_HDR}
|
1692
|
-
|
1693
|
-
[[ABC]]
|
1694
|
-
[.permission,tag=X,multilingual-rendering=common]
|
1695
|
-
====
|
1696
|
-
I recommend this
|
1697
|
-
====
|
1698
|
-
INPUT
|
1699
|
-
output = <<~"OUTPUT"
|
1700
|
-
#{BLANK_HDR}
|
1701
|
-
<sections>
|
1702
|
-
<permission id="ABC" tag='X' multilingual-rendering='common'>
|
1703
|
-
<description><p id="_">I recommend this</p></description>
|
1704
|
-
</permission>
|
1705
|
-
</sections>
|
1706
|
-
</standard-document>
|
1707
|
-
OUTPUT
|
1708
|
-
|
1709
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1710
|
-
.to be_equivalent_to xmlpp(output)
|
1711
|
-
end
|
1712
|
-
|
1713
|
-
it "processes nested permissions" do
|
1714
|
-
input = <<~"INPUT"
|
1715
|
-
#{ASCIIDOC_BLANK_HDR}
|
1716
|
-
[.permission]
|
1717
|
-
====
|
1718
|
-
I permit this
|
1719
|
-
|
1720
|
-
=====
|
1721
|
-
Example 2
|
1722
|
-
=====
|
1723
|
-
|
1724
|
-
[.permission]
|
1725
|
-
=====
|
1726
|
-
I also permit this
|
1727
|
-
|
1728
|
-
. List
|
1729
|
-
. List
|
1730
|
-
=====
|
1731
|
-
|
1732
|
-
[requirement,type="general",identifier="/req/core/quantities-uom"]
|
1733
|
-
======
|
1734
|
-
======
|
1735
|
-
====
|
1736
|
-
INPUT
|
1737
|
-
output = <<~"OUTPUT"
|
1738
|
-
#{BLANK_HDR}
|
1739
|
-
<sections>
|
1740
|
-
<permission id="_"><description><p id="_">I permit this</p>
|
1741
|
-
<example id="_">
|
1742
|
-
<p id="_">Example 2</p>
|
1743
|
-
</example></description>
|
1744
|
-
<permission id="_">
|
1745
|
-
<description><p id="_">I also permit this</p>
|
1746
|
-
<ol id='_' type='arabic'>
|
1747
|
-
<li>
|
1748
|
-
<p id='_'>List</p>
|
1749
|
-
</li>
|
1750
|
-
<li>
|
1751
|
-
<p id='_'>List</p>
|
1752
|
-
</li>
|
1753
|
-
</ol>
|
1754
|
-
</description>
|
1755
|
-
</permission>
|
1756
|
-
<requirement id='_' type='general'>
|
1757
|
-
<identifier>/req/core/quantities-uom</identifier>
|
1758
|
-
</requirement>
|
1759
|
-
</permission>
|
1760
|
-
</sections>
|
1761
|
-
</standard-document>
|
1762
|
-
OUTPUT
|
1763
|
-
|
1764
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1765
|
-
.to be_equivalent_to xmlpp(output)
|
1766
|
-
end
|
1767
|
-
|
1768
|
-
it "processes recommendation with internal markup of structure" do
|
1769
|
-
input = <<~"INPUT"
|
1770
|
-
#{ASCIIDOC_BLANK_HDR}
|
1771
|
-
|
1772
|
-
[[ABC]]
|
1773
|
-
[.recommendation,identifier="/ogc/recommendation/wfs/2",subject="user",classification="control-class:Technical;priority:P0;family:System & Communications Protection,System and Communications Protocols",obligation="permission,recommendation",filename="reqt1.rq"]
|
1774
|
-
====
|
1775
|
-
I recommend _this_.
|
1776
|
-
|
1777
|
-
[.specification,type="tabular",keep-with-next=true,keep-lines-together=true]
|
1778
|
-
--
|
1779
|
-
This is the object of the recommendation:
|
1780
|
-
|===
|
1781
|
-
|Object |Value
|
1782
|
-
|Mission | Accomplished
|
1783
|
-
|===
|
1784
|
-
--
|
1785
|
-
|
1786
|
-
As for the measurement targets,
|
1787
|
-
|
1788
|
-
[.measurement-target]
|
1789
|
-
--
|
1790
|
-
The measurement target shall be measured as:
|
1791
|
-
[stem]
|
1792
|
-
++++
|
1793
|
-
r/1 = 0
|
1794
|
-
++++
|
1795
|
-
--
|
1796
|
-
|
1797
|
-
[.verification]
|
1798
|
-
--
|
1799
|
-
The following code will be run for verification:
|
1800
|
-
|
1801
|
-
[source,CoreRoot]
|
1802
|
-
----
|
1803
|
-
CoreRoot(success): HttpResponse
|
1804
|
-
if (success)
|
1805
|
-
recommendation(label: success-response)
|
1806
|
-
end
|
1807
|
-
----
|
1808
|
-
--
|
1809
|
-
|
1810
|
-
[.import%exclude]
|
1811
|
-
--
|
1812
|
-
[source,CoreRoot]
|
1813
|
-
----
|
1814
|
-
success-response()
|
1815
|
-
----
|
1816
|
-
--
|
1817
|
-
|
1818
|
-
[.component]
|
1819
|
-
--
|
1820
|
-
Hello
|
1821
|
-
--
|
1822
|
-
|
1823
|
-
[.component,class=condition]
|
1824
|
-
--
|
1825
|
-
If this be thus
|
1826
|
-
--
|
1827
|
-
====
|
1828
|
-
INPUT
|
1829
|
-
output = <<~"OUTPUT"
|
1830
|
-
#{BLANK_HDR}
|
1831
|
-
<sections>
|
1832
|
-
<recommendation id="ABC" obligation="permission,recommendation" filename="reqt1.rq"><identifier>/ogc/recommendation/wfs/2</identifier><subject>user</subject>
|
1833
|
-
<classification><tag>control-class</tag><value>Technical</value></classification><classification><tag>priority</tag><value>P0</value></classification><classification><tag>family</tag><value>System & Communications Protection</value></classification><classification><tag>family</tag><value>System and Communications Protocols</value></classification>
|
1834
|
-
<description><p id="_">I recommend <em>this</em>.</p>
|
1835
|
-
</description><specification exclude="false" type="tabular" keep-with-next="true" keep-lines-together="true"><p id="_">This is the object of the recommendation:</p><table id="_"> <tbody> <tr> <td valign="top" align="left">Object</td> <td valign="top" align="left">Value</td> </tr> <tr> <td valign="top" align="left">Mission</td> <td valign="top" align="left">Accomplished</td> </tr> </tbody></table></specification><description>
|
1836
|
-
<p id="_">As for the measurement targets,</p>
|
1837
|
-
</description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
|
1838
|
-
<mrow>
|
1839
|
-
<mi>r</mi>
|
1840
|
-
</mrow>
|
1841
|
-
<mrow>
|
1842
|
-
<mn>1</mn>
|
1843
|
-
</mrow>
|
1844
|
-
</mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
|
1845
|
-
<verification exclude="false"><p id="_">The following code will be run for verification:</p><sourcecode lang="CoreRoot" id="_">CoreRoot(success): HttpResponse
|
1846
|
-
if (success)
|
1847
|
-
recommendation(label: success-response)
|
1848
|
-
end</sourcecode></verification>
|
1849
|
-
<import exclude="true"> <sourcecode lang="CoreRoot" id="_">success-response()</sourcecode></import>
|
1850
|
-
<component exclude='false' class='component'>
|
1851
|
-
<p id='_'>Hello</p>
|
1852
|
-
</component>
|
1853
|
-
<component exclude='false' class='condition'>
|
1854
|
-
<p id='_'>If this be thus</p>
|
1855
|
-
</component>
|
1856
|
-
</recommendation>
|
1857
|
-
</sections>
|
1858
|
-
</standard-document>
|
1859
|
-
OUTPUT
|
1860
|
-
|
1861
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
1862
|
-
.to be_equivalent_to xmlpp(output)
|
1863
|
-
end
|
1864
|
-
|
1865
1619
|
it "processes delete change clauses" do
|
1866
1620
|
input = <<~"INPUT"
|
1867
1621
|
#{ASCIIDOC_BLANK_HDR}
|