metanorma-standoc 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a96726969ceffd8d3d05779e0f81db28972e6932a670cf93745a5006e881f392
|
4
|
+
data.tar.gz: 2d042cb06685449297536817bf622421222e0de78f285ca7c4ceab8f847127bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 440f9483f3b0cfa94769d357b40a314d26068975371bf2b54c7a0689cdd2bfdd2fb1cc4c877e097666b3d6c36545c09b7e40809d80aa095a132e810de6a02ede
|
7
|
+
data.tar.gz: c39511c530a2530eb7ec4c430bc8917041d270f2643993609a844930415150e9b701a56ab31b550e79312f7a854205ff920e7d7e6f07acb90d995920681ee789
|
@@ -169,6 +169,15 @@ module Asciidoctor
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
+
def term_children_cleanup(xmldoc)
|
173
|
+
xmldoc.xpath("//term").each do |t|
|
174
|
+
ex = t.xpath("./termexample")
|
175
|
+
t.xpath("./termnote").each { |n| t << n.remove }
|
176
|
+
t.xpath("./termexample").each { |n| t << n.remove }
|
177
|
+
t.xpath("./termsource").each { |n| t << n.remove }
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
172
181
|
def termdef_cleanup(xmldoc)
|
173
182
|
termdef_unnest_cleanup(xmldoc)
|
174
183
|
termdef_stem_cleanup(xmldoc)
|
@@ -176,6 +185,7 @@ module Asciidoctor
|
|
176
185
|
termdefinition_cleanup(xmldoc)
|
177
186
|
termdef_boilerplate_cleanup(xmldoc)
|
178
187
|
termdef_subclause_cleanup(xmldoc)
|
188
|
+
term_children_cleanup(xmldoc)
|
179
189
|
termdocsource_cleanup(xmldoc)
|
180
190
|
end
|
181
191
|
|
@@ -22,7 +22,8 @@ module Asciidoctor
|
|
22
22
|
|
23
23
|
def sectiontype(node)
|
24
24
|
ret = node&.attr("heading")&.downcase || node.title.downcase
|
25
|
-
return ret if
|
25
|
+
return ret if ["symbols and abbreviated terms", "abbreviations",
|
26
|
+
"abbreviated terms", "symbols"].include? ret
|
26
27
|
return nil unless node.level == 1
|
27
28
|
return nil if @seen_headers.include? ret
|
28
29
|
@seen_headers << ret
|
@@ -44,7 +45,10 @@ module Asciidoctor
|
|
44
45
|
@term_def = true
|
45
46
|
term_def_parse(a, xml, node, true)
|
46
47
|
@term_def = false
|
47
|
-
when "symbols and abbreviated terms"
|
48
|
+
when "symbols and abbreviated terms",
|
49
|
+
"symbols",
|
50
|
+
"abbreviated terms",
|
51
|
+
"abbreviations"
|
48
52
|
symbols_parse(a, xml, node)
|
49
53
|
when "bibliography" then bibliography_parse(a, xml, node)
|
50
54
|
else
|
@@ -110,6 +114,7 @@ module Asciidoctor
|
|
110
114
|
|
111
115
|
# subclause contains subclauses
|
112
116
|
def term_def_subclause_parse(attrs, xml, node)
|
117
|
+
return clause_parse(attrs, xml, node) if node.role == "nonterm"
|
113
118
|
sub = node.find_by(context: :section) { |s| s.level == node.level + 1 }
|
114
119
|
sub.empty? || (return term_def_parse(attrs, xml, node, false))
|
115
120
|
node.title.casecmp("symbols and abbreviated terms").zero? &&
|
@@ -695,6 +695,52 @@ r = 1 %</stem>
|
|
695
695
|
OUTPUT
|
696
696
|
end
|
697
697
|
|
698
|
+
it "rearranges term note, term example, term source" do
|
699
|
+
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
700
|
+
#{ASCIIDOC_BLANK_HDR}
|
701
|
+
|
702
|
+
== Terms and definitions
|
703
|
+
|
704
|
+
=== Term
|
705
|
+
|
706
|
+
[.source]
|
707
|
+
<<ISO2191,section=1>>
|
708
|
+
|
709
|
+
NOTE: Note
|
710
|
+
|
711
|
+
[example]
|
712
|
+
Example 1
|
713
|
+
|
714
|
+
NOTE: Note 2
|
715
|
+
|
716
|
+
[example]
|
717
|
+
Example 2
|
718
|
+
INPUT
|
719
|
+
#{BLANK_HDR}
|
720
|
+
<sections>
|
721
|
+
<terms id="_" obligation="normative">
|
722
|
+
<title>Terms and definitions</title>
|
723
|
+
<term id="_"><preferred>Term</preferred>
|
724
|
+
|
725
|
+
|
726
|
+
|
727
|
+
<termnote id="_">
|
728
|
+
<p id="_">Note</p>
|
729
|
+
</termnote><termnote id="_">
|
730
|
+
<p id="_">Note 2</p>
|
731
|
+
</termnote><termexample id="_">
|
732
|
+
<p id="_">Example 1</p>
|
733
|
+
</termexample><termexample id="_">
|
734
|
+
<p id="_">Example 2</p>
|
735
|
+
</termexample><termsource status="identical">
|
736
|
+
<origin bibitemid="ISO2191" type="inline" citeas=""><locality type="section"><referenceFrom>1</referenceFrom></locality></origin>
|
737
|
+
</termsource></term>
|
738
|
+
</terms>
|
739
|
+
</sections>
|
740
|
+
</standard-document>
|
741
|
+
OUTPUT
|
742
|
+
end
|
743
|
+
|
698
744
|
it "extends clause levels past 5" do
|
699
745
|
expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
|
700
746
|
#{ASCIIDOC_BLANK_HDR}
|
@@ -24,6 +24,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
24
24
|
|
25
25
|
== Terms, Definitions, Symbols and Abbreviated Terms
|
26
26
|
|
27
|
+
[.nonterm]
|
28
|
+
=== Introduction
|
29
|
+
|
27
30
|
=== Normal Terms
|
28
31
|
|
29
32
|
==== Term2
|
@@ -53,10 +56,13 @@ RSpec.describe Asciidoctor::Standoc do
|
|
53
56
|
<preface><foreword obligation="informative">
|
54
57
|
<title>Foreword</title>
|
55
58
|
<p id="_">Text</p>
|
56
|
-
</foreword><introduction id="_" obligation="informative"
|
59
|
+
</foreword><introduction id="_" obligation="informative">
|
60
|
+
<title>Introduction</title>
|
61
|
+
<clause id="_" inline-header="false" obligation="informative">
|
57
62
|
<title>Introduction Subsection</title>
|
58
63
|
</clause>
|
59
64
|
</introduction></preface><sections>
|
65
|
+
|
60
66
|
<clause id="_" inline-header="false" obligation="normative">
|
61
67
|
<title>Scope</title>
|
62
68
|
<p id="_">Text</p>
|
@@ -68,7 +74,10 @@ RSpec.describe Asciidoctor::Standoc do
|
|
68
74
|
<preferred>Term1</preferred>
|
69
75
|
</term>
|
70
76
|
</terms>
|
71
|
-
<clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><
|
77
|
+
<clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><clause id="_" inline-header="false" obligation="normative">
|
78
|
+
<title>Introduction</title>
|
79
|
+
</clause>
|
80
|
+
<terms id="_" obligation="normative">
|
72
81
|
<title>Normal Terms</title>
|
73
82
|
<term id="_">
|
74
83
|
<preferred>Term2</preferred>
|
@@ -83,9 +92,8 @@ RSpec.describe Asciidoctor::Standoc do
|
|
83
92
|
<title>Clause 4.2</title>
|
84
93
|
</clause></clause>
|
85
94
|
<clause id="_" inline-header="false" obligation="normative">
|
86
|
-
|
87
|
-
|
88
|
-
|
95
|
+
<title>Terms and Definitions</title>
|
96
|
+
</clause>
|
89
97
|
|
90
98
|
</sections><annex id="_" inline-header="false" obligation="normative">
|
91
99
|
<title>Annex</title>
|
@@ -99,8 +107,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
99
107
|
<references id="_" obligation="informative">
|
100
108
|
<title>Bibliography Subsection</title>
|
101
109
|
</references>
|
102
|
-
</clause>
|
103
|
-
</bibliography>
|
110
|
+
</clause></bibliography>
|
104
111
|
</standard-document>
|
105
112
|
OUTPUT
|
106
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|