metanorma-standoc 2.2.0 → 2.2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/standoc/base.rb +12 -0
- data/lib/metanorma/standoc/blocks.rb +25 -15
- data/lib/metanorma/standoc/cleanup_biblio.rb +14 -8
- data/lib/metanorma/standoc/cleanup_reqt.rb +3 -136
- data/lib/metanorma/standoc/front.rb +6 -1
- data/lib/metanorma/standoc/front_contributor.rb +0 -10
- data/lib/metanorma/standoc/macros_inline.rb +1 -1
- data/lib/metanorma/standoc/reqt.rb +19 -75
- data/lib/metanorma/standoc/section.rb +35 -3
- data/lib/metanorma/standoc/utils.rb +9 -43
- data/lib/metanorma/standoc/validate.rb +1 -69
- data/lib/metanorma/standoc/validate_table.rb +91 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -2
- data/spec/metanorma/biblio_spec.rb +9 -9
- data/spec/metanorma/blocks_spec.rb +20 -266
- data/spec/metanorma/cleanup_blocks_spec.rb +0 -168
- data/spec/metanorma/macros_concept_spec.rb +1033 -0
- data/spec/metanorma/macros_spec.rb +1 -1031
- data/spec/metanorma/refs_spec.rb +0 -2
- data/spec/metanorma/reqt_spec.rb +130 -0
- data/spec/metanorma/section_spec.rb +5 -0
- data/spec/metanorma/validate_spec.rb +46 -6
- data/spec/vcr_cassettes/bsi16341.yml +80 -52
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +94 -94
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +10 -10
- data/spec/vcr_cassettes/hide_refs.yml +74 -74
- data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
- 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 +23 -23
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +9 -9
- data/spec/vcr_cassettes/isobib_get_124.yml +10 -10
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +30 -60
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
- data/spec/vcr_cassettes/std-link.yml +11 -11
- metadata +10 -7
@@ -1,5 +1,6 @@
|
|
1
1
|
require "metanorma/standoc/utils"
|
2
2
|
require_relative "./validate_section"
|
3
|
+
require_relative "./validate_table"
|
3
4
|
require "nokogiri"
|
4
5
|
require "jing"
|
5
6
|
require "iev"
|
@@ -53,75 +54,6 @@ module Metanorma
|
|
53
54
|
@fatalerror.empty? or clean_abort(@fatalerror.join("\n"), doc.to_xml)
|
54
55
|
end
|
55
56
|
|
56
|
-
def table_validate(doc)
|
57
|
-
doc.xpath("//table[colgroup]").each do |t|
|
58
|
-
maxrowcols_validate(t, t.xpath("./colgroup/col").size)
|
59
|
-
end
|
60
|
-
doc.xpath("//table[.//*[@colspan] | .//*[@rowspan]]").each do |t|
|
61
|
-
maxrowcols_validate(t, max_td_count(t))
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def max_td_count(table)
|
66
|
-
max = 0
|
67
|
-
table.xpath("./tr").each do |tr|
|
68
|
-
n = tr.xpath("./td | ./th").size
|
69
|
-
max < n and max = n
|
70
|
-
end
|
71
|
-
max
|
72
|
-
end
|
73
|
-
|
74
|
-
def maxrowcols_validate(table, maxcols)
|
75
|
-
cells2d = table.xpath("./*/tr").each_with_object([]) { |_r, m| m << {} }
|
76
|
-
table.xpath("./*/tr").each_with_index do |tr, r|
|
77
|
-
curr = 0
|
78
|
-
tr.xpath("./td | ./th").each do |td|
|
79
|
-
curr = maxcols_validate1(td, r, curr, cells2d, maxcols)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
maxrows_validate(table, cells2d)
|
83
|
-
end
|
84
|
-
|
85
|
-
# code doesn't actually do anything, since Asciidoctor refuses to generate
|
86
|
-
# table with inconsistent column count
|
87
|
-
def maxcols_validate1(tcell, row, curr, cells2d, maxcols)
|
88
|
-
rs = tcell&.attr("rowspan")&.to_i || 1
|
89
|
-
cs = tcell&.attr("colspan")&.to_i || 1
|
90
|
-
curr = table_tracker_update(cells2d, row, curr, rs, cs)
|
91
|
-
maxcols_check(curr + cs - 1, maxcols, tcell)
|
92
|
-
curr + cs
|
93
|
-
end
|
94
|
-
|
95
|
-
def table_tracker_update(cells2d, row, curr, rowspan, colspan)
|
96
|
-
cells2d[row] ||= {}
|
97
|
-
while cells2d[row][curr]
|
98
|
-
curr += 1
|
99
|
-
end
|
100
|
-
(row..(row + rowspan - 1)).each do |y2|
|
101
|
-
cells2d[y2] ||= {}
|
102
|
-
(curr..(curr + colspan - 1)).each { |x2| cells2d[y2][x2] = 1 }
|
103
|
-
end
|
104
|
-
curr
|
105
|
-
end
|
106
|
-
|
107
|
-
def maxrows_validate(table, cells2d)
|
108
|
-
if cells2d.any? { |x| x.size != cells2d.first.size }
|
109
|
-
@log.add("Table", table,
|
110
|
-
"Table rows in table are inconsistent: check rowspan")
|
111
|
-
@fatalerror << "Table rows in table are inconsistent: check rowspan"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# if maxcols or maxrows negative, do not check them
|
116
|
-
def maxcols_check(col, maxcols, tcell)
|
117
|
-
if maxcols.positive? && col > maxcols
|
118
|
-
@log.add("Table", tcell, "Table exceeds maximum number of columns "\
|
119
|
-
"defined (#{maxcols})")
|
120
|
-
@fatalerror << "Table exceeds maximum number of columns defined "\
|
121
|
-
"(#{maxcols})"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
57
|
def norm_ref_validate(doc)
|
126
58
|
found = false
|
127
59
|
doc.xpath("//references[@normative = 'true']/bibitem").each do |b|
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Metanorma
|
2
|
+
module Standoc
|
3
|
+
module Validate
|
4
|
+
def table_validate(doc)
|
5
|
+
doc.xpath("//table[colgroup]").each do |t|
|
6
|
+
maxrowcols_validate(t, t.xpath("./colgroup/col").size)
|
7
|
+
end
|
8
|
+
doc.xpath("//table[.//*[@colspan] | .//*[@rowspan]]").each do |t|
|
9
|
+
maxrowcols_validate(t, max_td_count(t), mode: "row_cols")
|
10
|
+
end
|
11
|
+
doc.xpath("//table[.//*[@rowspan]]").each do |t|
|
12
|
+
maxrowcols_validate(t, max_td_count(t), mode: "thead_row")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def max_td_count(table)
|
17
|
+
max = 0
|
18
|
+
table.xpath("./tr").each do |tr|
|
19
|
+
n = tr.xpath("./td | ./th").size
|
20
|
+
max < n and max = n
|
21
|
+
end
|
22
|
+
max
|
23
|
+
end
|
24
|
+
|
25
|
+
def maxrowcols_validate(table, maxcols, mode: "row_cols")
|
26
|
+
case mode
|
27
|
+
when "row_cols"
|
28
|
+
maxrowcols_validate0(table, maxcols, "*", mode)
|
29
|
+
when "thead_row"
|
30
|
+
%w{thead tbody tfoot}.each do |w|
|
31
|
+
maxrowcols_validate0(table, maxcols, w, mode)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def maxrowcols_validate0(table, maxcols, tablechild, mode)
|
37
|
+
cells2d = table.xpath("./#{tablechild}/tr")
|
38
|
+
.each_with_object([]) { |_r, m| m << {} }
|
39
|
+
table.xpath("./#{tablechild}/tr").each_with_index do |tr, r|
|
40
|
+
curr = 0
|
41
|
+
tr.xpath("./td | ./th").each do |td|
|
42
|
+
curr = maxcols_validate1(td, r, curr, cells2d, maxcols, mode)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
maxrows_validate(table, cells2d, tablechild, mode)
|
46
|
+
end
|
47
|
+
|
48
|
+
# code doesn't actually do anything, since Asciidoctor refuses to generate
|
49
|
+
# table with inconsistent column count
|
50
|
+
def maxcols_validate1(tcell, row, curr, cells2d, maxcols, mode)
|
51
|
+
rs = tcell&.attr("rowspan")&.to_i || 1
|
52
|
+
cs = tcell&.attr("colspan")&.to_i || 1
|
53
|
+
curr = table_tracker_update(cells2d, row, curr, rs, cs)
|
54
|
+
maxcols_check(curr + cs - 1, maxcols, tcell) if mode == "row_cols"
|
55
|
+
curr + cs
|
56
|
+
end
|
57
|
+
|
58
|
+
def table_tracker_update(cells2d, row, curr, rowspan, colspan)
|
59
|
+
cells2d[row] ||= {}
|
60
|
+
while cells2d[row][curr]
|
61
|
+
curr += 1
|
62
|
+
end
|
63
|
+
(row..(row + rowspan - 1)).each do |y2|
|
64
|
+
cells2d[y2] ||= {}
|
65
|
+
(curr..(curr + colspan - 1)).each { |x2| cells2d[y2][x2] = 1 }
|
66
|
+
end
|
67
|
+
curr
|
68
|
+
end
|
69
|
+
|
70
|
+
def maxrows_validate(table, cells2d, tablechild, mode)
|
71
|
+
err = "are inconsistent"
|
72
|
+
mode == "thead_row" and err = "cannot go outside #{tablechild}"
|
73
|
+
err = "Table rows in table #{err}: check rowspan"
|
74
|
+
if cells2d.any? { |x| x.size != cells2d.first.size }
|
75
|
+
@log.add("Table", table, err)
|
76
|
+
@fatalerror << err
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# if maxcols or maxrows negative, do not check them
|
81
|
+
def maxcols_check(col, maxcols, tcell)
|
82
|
+
if maxcols.positive? && col > maxcols
|
83
|
+
@log.add("Table", tcell, "Table exceeds maximum number of columns "\
|
84
|
+
"defined (#{maxcols})")
|
85
|
+
@fatalerror << "Table exceeds maximum number of columns defined "\
|
86
|
+
"(#{maxcols})"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -36,8 +36,8 @@ 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 "relaton-cli", "~> 1.
|
39
|
+
spec.add_dependency "mn-requirements", "~> 0.0.1"
|
40
|
+
spec.add_dependency "relaton-cli", "~> 1.13.0"
|
41
41
|
spec.add_dependency "relaton-iev", "~> 1.1.0"
|
42
42
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
43
43
|
|
@@ -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>
|
@@ -896,7 +896,7 @@ RSpec.describe Metanorma::Standoc do
|
|
896
896
|
[bibliography]
|
897
897
|
=== Normative References
|
898
898
|
|
899
|
-
* [[[A, B]]],
|
899
|
+
* [[[A, B]]], span:surname[Wozniak], span:initials[S.] & span:givenname[Steve] span:surname[Jobs]. span:pubyear[1996]. span:title[_Work_]. In span:surname.editor[Gates], span:initials.editor[W. H], Collected Essays. span:docid.ISO[ISO 1234]. span:pubplace[Geneva]: span:publisher[International Standardization Organization]. span:uri.citation[http://www.example.com]. span:type[inbook]
|
900
900
|
INPUT
|
901
901
|
output = <<~OUTPUT
|
902
902
|
#{BLANK_HDR}
|
@@ -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}
|