metanorma-standoc 1.8.6 → 1.9.2
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 +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +5 -3
- data/Gemfile.devel +0 -0
- data/lib/asciidoctor/standoc/base.rb +41 -36
- data/lib/asciidoctor/standoc/biblio.rng +4 -6
- data/lib/asciidoctor/standoc/blocks.rb +44 -14
- data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
- data/lib/asciidoctor/standoc/cleanup.rb +33 -78
- data/lib/asciidoctor/standoc/cleanup_block.rb +77 -62
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
- data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
- data/lib/asciidoctor/standoc/cleanup_maths.rb +37 -28
- data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -15
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
- data/lib/asciidoctor/standoc/cleanup_section.rb +21 -15
- data/lib/asciidoctor/standoc/converter.rb +10 -3
- data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
- data/lib/asciidoctor/standoc/front.rb +35 -18
- data/lib/asciidoctor/standoc/front_contributor.rb +5 -5
- data/lib/asciidoctor/standoc/inline.rb +1 -1
- data/lib/asciidoctor/standoc/isodoc.rng +304 -1
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +50 -23
- data/lib/asciidoctor/standoc/macros_form.rb +63 -0
- data/lib/asciidoctor/standoc/ref.rb +87 -112
- data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
- data/lib/asciidoctor/standoc/ref_sect.rb +22 -19
- data/lib/asciidoctor/standoc/section.rb +3 -1
- data/lib/asciidoctor/standoc/terms.rb +27 -16
- data/lib/asciidoctor/standoc/utils.rb +35 -9
- data/lib/asciidoctor/standoc/validate.rb +30 -28
- data/lib/metanorma-standoc.rb +0 -1
- data/lib/metanorma/standoc/version.rb +5 -5
- data/metanorma-standoc.gemspec +11 -11
- data/spec/asciidoctor/base_spec.rb +78 -8
- data/spec/asciidoctor/blocks_spec.rb +832 -727
- data/spec/asciidoctor/cleanup_sections_spec.rb +52 -15
- data/spec/asciidoctor/cleanup_spec.rb +1860 -1874
- data/spec/asciidoctor/inline_spec.rb +272 -273
- data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
- data/spec/asciidoctor/macros_spec.rb +539 -437
- data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
- data/spec/asciidoctor/refs_spec.rb +135 -7
- data/spec/asciidoctor/section_spec.rb +743 -690
- data/spec/assets/html-override.css +1 -0
- data/spec/assets/word-override.css +1 -0
- data/spec/spec_helper.rb +11 -9
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +60 -60
- data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
- data/spec/vcr_cassettes/isobib_get_123_1.yml +30 -30
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +42 -42
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +15 -15
- data/spec/vcr_cassettes/isobib_get_124.yml +15 -15
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +53 -49
- metadata +72 -68
- data/.rubocop.ribose.yml +0 -66
- data/.rubocop.tb.yml +0 -650
- data/spec/asciidoctor/macros_lutaml_spec.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3b789e06df237e881bdd055cfe9b90e191d781e71e82dd6a80c098f23b08934
|
4
|
+
data.tar.gz: 27f1499d7f7adccf29c2b9c9ac731e6ff1988a008530a4aa13e63adb4fbef490
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c72e91aac553b2e9d3151a59fde54b02ae5cb6340aeb0781dd4326d5a6bce3166e20fd2ece37d909c3e8b7f72d6d26892bd279d4256b190cf28dbe41e1bdbf3e
|
7
|
+
data.tar.gz: 8314c96a3af15b47d56c42cd040e369455616b40dafb37a3d2ee32d0ba46976293eee36f3b9ab99d3b2d94002df3f3bf0a319e98f262e0d5eb3049fb90c30d4f
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# This project follows the Ribose OSS style guide.
|
2
2
|
# https://github.com/riboseinc/oss-guides
|
3
3
|
# All project-specific additions and overrides should be specified in this file.
|
4
|
-
|
5
4
|
inherit_from:
|
6
5
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
|
+
|
7
|
+
# local repo-specific modifications
|
8
|
+
|
7
9
|
AllCops:
|
10
|
+
DisplayCopNames: false
|
11
|
+
StyleGuideCopsOnly: false
|
8
12
|
TargetRubyVersion: 2.4
|
9
|
-
Rails:
|
10
|
-
Enabled: true
|
data/Gemfile.devel
ADDED
File without changes
|
@@ -8,6 +8,7 @@ require "isodoc"
|
|
8
8
|
require "relaton"
|
9
9
|
require "fileutils"
|
10
10
|
require "metanorma-utils"
|
11
|
+
require "isodoc/xslfo_convert"
|
11
12
|
|
12
13
|
module Asciidoctor
|
13
14
|
module Standoc
|
@@ -43,6 +44,7 @@ module Asciidoctor
|
|
43
44
|
i18nyaml: node.attr("i18nyaml"),
|
44
45
|
scope: node.attr("scope"),
|
45
46
|
htmlstylesheet: node.attr("htmlstylesheet"),
|
47
|
+
htmlstylesheet_override: node.attr("htmlstylesheet-override"),
|
46
48
|
htmlcoverpage: node.attr("htmlcoverpage"),
|
47
49
|
htmlintropage: node.attr("htmlintropage"),
|
48
50
|
scripts: node.attr("scripts"),
|
@@ -51,6 +53,7 @@ module Asciidoctor
|
|
51
53
|
htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
|
52
54
|
doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
|
53
55
|
break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
|
56
|
+
sectionsplit: node.attr("sectionsplit"),
|
54
57
|
}
|
55
58
|
end
|
56
59
|
|
@@ -59,7 +62,7 @@ module Asciidoctor
|
|
59
62
|
end
|
60
63
|
|
61
64
|
def doc_extract_attributes(node)
|
62
|
-
{
|
65
|
+
attrs = {
|
63
66
|
script: node.attr("script"),
|
64
67
|
bodyfont: node.attr("body-font"),
|
65
68
|
headerfont: node.attr("header-font"),
|
@@ -67,6 +70,7 @@ module Asciidoctor
|
|
67
70
|
i18nyaml: node.attr("i18nyaml"),
|
68
71
|
scope: node.attr("scope"),
|
69
72
|
wordstylesheet: node.attr("wordstylesheet"),
|
73
|
+
wordstylesheet_override: node.attr("wordstylesheet-override"),
|
70
74
|
standardstylesheet: node.attr("standardstylesheet"),
|
71
75
|
header: node.attr("header"),
|
72
76
|
wordcoverpage: node.attr("wordcoverpage"),
|
@@ -77,6 +81,14 @@ module Asciidoctor
|
|
77
81
|
doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
|
78
82
|
break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
|
79
83
|
}
|
84
|
+
|
85
|
+
if font_manifest_file = node.attr("mn2pdf-font-manifest-file")
|
86
|
+
attrs[IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS] = {
|
87
|
+
IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => font_manifest_file,
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
attrs
|
80
92
|
end
|
81
93
|
|
82
94
|
def doc_converter(node)
|
@@ -96,10 +108,15 @@ module Asciidoctor
|
|
96
108
|
@draft = node.attributes.has_key?("draft")
|
97
109
|
@novalid = node.attr("novalid")
|
98
110
|
@smartquotes = node.attr("smartquotes") != "false"
|
99
|
-
@keepasciimath = node.attr("mn-keep-asciimath") &&
|
111
|
+
@keepasciimath = node.attr("mn-keep-asciimath") &&
|
112
|
+
node.attr("mn-keep-asciimath") != "false"
|
100
113
|
@fontheader = default_fonts(node)
|
101
114
|
@files_to_delete = []
|
102
|
-
|
115
|
+
if node.attr("docfile")
|
116
|
+
@filename = File.basename(node.attr("docfile"))&.gsub(/\.adoc$/, "")
|
117
|
+
else
|
118
|
+
@filename = ""
|
119
|
+
end
|
103
120
|
@localdir = Metanorma::Utils::localdir(node)
|
104
121
|
@output_dir = outputdir node
|
105
122
|
@no_isobib_cache = node.attr("no-isobib-cache")
|
@@ -131,10 +148,12 @@ module Asciidoctor
|
|
131
148
|
end
|
132
149
|
|
133
150
|
def outputs(node, ret)
|
134
|
-
File.open(@filename
|
135
|
-
presentation_xml_converter(node).convert(@filename
|
136
|
-
html_converter(node).convert(@filename
|
137
|
-
|
151
|
+
File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
|
152
|
+
presentation_xml_converter(node).convert("#{@filename}.xml")
|
153
|
+
html_converter(node).convert("#{@filename}.presentation.xml",
|
154
|
+
nil, false, "#{@filename}.html")
|
155
|
+
doc_converter(node).convert("#{@filename}.presentation.xml",
|
156
|
+
nil, false, "#{@filename}.doc")
|
138
157
|
end
|
139
158
|
|
140
159
|
def document(node)
|
@@ -151,12 +170,21 @@ module Asciidoctor
|
|
151
170
|
end
|
152
171
|
|
153
172
|
def clean_exit
|
154
|
-
@log.write(@output_dir
|
173
|
+
@log.write("#{@output_dir}#{@filename}.err") unless @novalid
|
174
|
+
|
155
175
|
@files_to_delete.each { |f| FileUtils.rm f }
|
156
176
|
end
|
157
177
|
|
178
|
+
def clean_abort(msg, file = nil)
|
179
|
+
file and
|
180
|
+
File.open("#{@filename}.xml.abort", "w:UTF-8") { |f| f.write(file) }
|
181
|
+
clean_exit
|
182
|
+
abort(msg)
|
183
|
+
end
|
184
|
+
|
158
185
|
def makexml1(node)
|
159
|
-
result = ["<?xml version='1.0' encoding='UTF-8'?>",
|
186
|
+
result = ["<?xml version='1.0' encoding='UTF-8'?>",
|
187
|
+
"<#{xml_root_tag} type='semantic' version='#{version}'>"]
|
160
188
|
result << noko { |ixml| front node, ixml }
|
161
189
|
result << noko { |ixml| middle node, ixml }
|
162
190
|
result << "</#{xml_root_tag}>"
|
@@ -191,36 +219,13 @@ module Asciidoctor
|
|
191
219
|
end
|
192
220
|
end
|
193
221
|
|
194
|
-
def default_script(lang)
|
195
|
-
case lang
|
196
|
-
when "ar", "fa"
|
197
|
-
"Arab"
|
198
|
-
when "ur"
|
199
|
-
"Aran"
|
200
|
-
when "ru", "bg"
|
201
|
-
"Cyrl"
|
202
|
-
when "hi"
|
203
|
-
"Deva"
|
204
|
-
when "el"
|
205
|
-
"Grek"
|
206
|
-
when "zh"
|
207
|
-
"Hans"
|
208
|
-
when "ko"
|
209
|
-
"Kore"
|
210
|
-
when "he"
|
211
|
-
"Hebr"
|
212
|
-
when "ja"
|
213
|
-
"Jpan"
|
214
|
-
else
|
215
|
-
"Latn"
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
222
|
private
|
220
223
|
|
221
224
|
def outputdir(node)
|
222
|
-
if node.attr("output_dir").nil_or_empty?
|
223
|
-
|
225
|
+
if node.attr("output_dir").nil_or_empty?
|
226
|
+
Metanorma::Utils::localdir(node)
|
227
|
+
else
|
228
|
+
File.join(node.attr("output_dir"), "")
|
224
229
|
end
|
225
230
|
end
|
226
231
|
end
|
@@ -124,7 +124,7 @@
|
|
124
124
|
<value>application/tei+xml</value>
|
125
125
|
<value>text/x-asciidoc</value>
|
126
126
|
<value>text/markdown</value>
|
127
|
-
<value>application/x-
|
127
|
+
<value>application/x-metanorma+xml</value>
|
128
128
|
<text/>
|
129
129
|
</choice>
|
130
130
|
</attribute>
|
@@ -452,6 +452,7 @@
|
|
452
452
|
<attribute name="type">
|
453
453
|
<choice>
|
454
454
|
<value>isni</value>
|
455
|
+
<value>orcid</value>
|
455
456
|
<value>uri</value>
|
456
457
|
</choice>
|
457
458
|
</attribute>
|
@@ -461,10 +462,7 @@
|
|
461
462
|
<define name="org-identifier">
|
462
463
|
<element name="identifier">
|
463
464
|
<attribute name="type">
|
464
|
-
<
|
465
|
-
<value>orcid</value>
|
466
|
-
<value>uri</value>
|
467
|
-
</choice>
|
465
|
+
<data type="string" datatypeLibrary=""/>
|
468
466
|
</attribute>
|
469
467
|
<text/>
|
470
468
|
</element>
|
@@ -1106,7 +1104,7 @@
|
|
1106
1104
|
<value>complementOf</value>
|
1107
1105
|
<value>obsoletes</value>
|
1108
1106
|
<value>obsoletedBy</value>
|
1109
|
-
<value>
|
1107
|
+
<value>cites</value>
|
1110
1108
|
<value>isCitedIn</value>
|
1111
1109
|
</choice>
|
1112
1110
|
</define>
|
@@ -30,6 +30,7 @@ module Asciidoctor
|
|
30
30
|
def open(node)
|
31
31
|
role = node.role || node.attr("style")
|
32
32
|
reqt_subpart(role) and return requirement_subpart(node)
|
33
|
+
role == "form" and return form(node)
|
33
34
|
result = []
|
34
35
|
node.blocks.each do |b|
|
35
36
|
result << send(b.context, b)
|
@@ -37,6 +38,17 @@ module Asciidoctor
|
|
37
38
|
result
|
38
39
|
end
|
39
40
|
|
41
|
+
def form(node)
|
42
|
+
noko do |xml|
|
43
|
+
xml.form **attr_code(
|
44
|
+
id: Metanorma::Utils::anchor_or_uuid,
|
45
|
+
name: node.attr("name"), action: node.attr("action")
|
46
|
+
) do |f|
|
47
|
+
f << node.content
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
40
52
|
def literal_attrs(node)
|
41
53
|
attr_code(id_attr(node).merge(keep_attrs(node)))
|
42
54
|
end
|
@@ -45,8 +57,9 @@ module Asciidoctor
|
|
45
57
|
noko do |xml|
|
46
58
|
xml.figure **literal_attrs(node) do |f|
|
47
59
|
figure_title(node, f)
|
48
|
-
f.pre node.lines.join("\n"),
|
49
|
-
|
60
|
+
f.pre node.lines.join("\n"),
|
61
|
+
**attr_code(id: Metanorma::Utils::anchor_or_uuid,
|
62
|
+
alt: node.attr("alt"))
|
50
63
|
end
|
51
64
|
end
|
52
65
|
end
|
@@ -70,19 +83,32 @@ module Asciidoctor
|
|
70
83
|
|
71
84
|
def example(node)
|
72
85
|
return term_example(node) if in_terms?
|
86
|
+
|
73
87
|
role = node.role || node.attr("style")
|
74
88
|
%w(recommendation requirement permission).include?(role) and
|
75
89
|
return requirement(node, role)
|
76
90
|
return pseudocode_example(node) if role == "pseudocode"
|
77
91
|
return svgmap_example(node) if role == "svgmap"
|
92
|
+
return form(node) if role == "form"
|
93
|
+
|
78
94
|
example_proper(node)
|
79
95
|
end
|
80
96
|
|
97
|
+
def svgmap_attrs(node)
|
98
|
+
attr_code( { id: node.id,
|
99
|
+
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
100
|
+
number: node.attr("number"),
|
101
|
+
subsequence: node.attr("subsequence") }.
|
102
|
+
merge(keep_attrs(node)))
|
103
|
+
end
|
104
|
+
|
81
105
|
def svgmap_example(node)
|
82
106
|
noko do |xml|
|
83
|
-
xml.svgmap **attr_code(
|
84
|
-
|
85
|
-
|
107
|
+
xml.svgmap **attr_code(svgmap_attrs(node).merge(
|
108
|
+
src: node.attr("src"), alt: node.attr("alt"))) do |ex|
|
109
|
+
figure_title(node, ex)
|
110
|
+
ex << node.content
|
111
|
+
end
|
86
112
|
end.join("\n")
|
87
113
|
end
|
88
114
|
|
@@ -129,12 +155,14 @@ module Asciidoctor
|
|
129
155
|
end
|
130
156
|
|
131
157
|
def para_attrs(node)
|
132
|
-
attr_code(keep_attrs(node)
|
133
|
-
|
158
|
+
attr_code(keep_attrs(node)
|
159
|
+
.merge(align: node.attr("align"),
|
160
|
+
id: Metanorma::Utils::anchor_or_uuid(node)))
|
134
161
|
end
|
135
162
|
|
136
163
|
def paragraph(node)
|
137
164
|
return termsource(node) if node.role == "source"
|
165
|
+
|
138
166
|
noko do |xml|
|
139
167
|
xml.p **para_attrs(node) do |xml_t|
|
140
168
|
xml_t << node.content
|
@@ -143,8 +171,9 @@ module Asciidoctor
|
|
143
171
|
end
|
144
172
|
|
145
173
|
def quote_attrs(node)
|
146
|
-
attr_code(keep_attrs(node)
|
147
|
-
|
174
|
+
attr_code(keep_attrs(node)
|
175
|
+
.merge(align: node.attr("align"),
|
176
|
+
id: Metanorma::Utils::anchor_or_uuid(node)))
|
148
177
|
end
|
149
178
|
|
150
179
|
def quote_attribution(node, out)
|
@@ -168,11 +197,12 @@ module Asciidoctor
|
|
168
197
|
end
|
169
198
|
|
170
199
|
def listing_attrs(node)
|
171
|
-
attr_code(keep_attrs(node).
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
200
|
+
attr_code(keep_attrs(node).
|
201
|
+
merge(lang: node.attr("language"),
|
202
|
+
id: Metanorma::Utils::anchor_or_uuid(node),
|
203
|
+
unnumbered: node.option?("unnumbered") ? "true" : nil,
|
204
|
+
number: node.attr("number"),
|
205
|
+
filename: node.attr("filename")))
|
176
206
|
end
|
177
207
|
|
178
208
|
# NOTE: html escaping is performed by Nokogiri
|
@@ -2,30 +2,41 @@ module Asciidoctor
|
|
2
2
|
module Standoc
|
3
3
|
module Blocks
|
4
4
|
def termnote_attrs(node)
|
5
|
-
attr_code(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
attr_code(
|
6
|
+
id_attr(node).merge(
|
7
|
+
unnumbered: node.attr("unnumbered"),
|
8
|
+
number: node.attr("number"),
|
9
|
+
subsequence: node.attr("subsequence"),
|
10
|
+
"keep-with-next": node.attr("keep-with-next"),
|
11
|
+
"keep-lines-together": node.attr("keep-with-next"),
|
12
|
+
"keep-separate": node.attr("keep-separate")
|
13
|
+
)
|
14
|
+
)
|
12
15
|
end
|
13
16
|
|
14
17
|
def note_attrs(node)
|
15
|
-
attr_code(
|
16
|
-
|
17
|
-
|
18
|
+
attr_code(
|
19
|
+
termnote_attrs(node).merge(
|
20
|
+
type: node.attr("type"),
|
21
|
+
beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil
|
22
|
+
)
|
23
|
+
)
|
18
24
|
end
|
19
25
|
|
20
26
|
def sidebar_attrs(node)
|
21
|
-
todo_attrs(node).merge(
|
22
|
-
|
27
|
+
todo_attrs(node).merge(
|
28
|
+
attr_code(
|
29
|
+
from: node.attr("from"),
|
30
|
+
to: node.attr("to") || node.attr("from")
|
31
|
+
)
|
32
|
+
)
|
23
33
|
end
|
24
34
|
|
25
35
|
def sidebar(node)
|
26
36
|
return unless draft?
|
37
|
+
|
27
38
|
noko do |xml|
|
28
|
-
xml.review **
|
39
|
+
xml.review **sidebar_attrs(node) do |r|
|
29
40
|
wrap_in_para(node, r)
|
30
41
|
end
|
31
42
|
end
|
@@ -33,33 +44,34 @@ module Asciidoctor
|
|
33
44
|
|
34
45
|
def todo_attrs(node)
|
35
46
|
date = node.attr("date") || Date.today.iso8601.gsub(/\+.*$/, "")
|
36
|
-
date += "T00:00:00Z" unless /T/.match date
|
47
|
+
date += "T00:00:00Z" unless /T/.match? date
|
37
48
|
attr_code(
|
38
49
|
id: ::Metanorma::Utils::anchor_or_uuid(node),
|
39
50
|
reviewer: node.attr("reviewer") || node.attr("source") || "(Unknown)",
|
40
|
-
date: date
|
51
|
+
date: date
|
52
|
+
)
|
41
53
|
end
|
42
54
|
|
43
55
|
def todo(node)
|
44
56
|
noko do |xml|
|
45
|
-
xml.review **
|
57
|
+
xml.review **todo_attrs(node) do |r|
|
46
58
|
wrap_in_para(node, r)
|
47
59
|
end
|
48
60
|
end
|
49
61
|
end
|
50
62
|
|
51
|
-
def termnote(
|
63
|
+
def termnote(node)
|
52
64
|
noko do |xml|
|
53
|
-
xml.termnote **termnote_attrs(
|
54
|
-
wrap_in_para(
|
65
|
+
xml.termnote **termnote_attrs(node) do |ex|
|
66
|
+
wrap_in_para(node, ex)
|
55
67
|
end
|
56
68
|
end.join("\n")
|
57
69
|
end
|
58
70
|
|
59
|
-
def note(
|
71
|
+
def note(node)
|
60
72
|
noko do |xml|
|
61
|
-
xml.note **note_attrs(
|
62
|
-
wrap_in_para(
|
73
|
+
xml.note **note_attrs(node) do |c|
|
74
|
+
wrap_in_para(node, c)
|
63
75
|
end
|
64
76
|
end.join("\n")
|
65
77
|
end
|
@@ -69,14 +81,19 @@ module Asciidoctor
|
|
69
81
|
a = node.attr("type") and ["danger", "safety precautions"].each do |t|
|
70
82
|
name = t if a.casecmp(t).zero?
|
71
83
|
end
|
72
|
-
attr_code(
|
73
|
-
|
84
|
+
attr_code(
|
85
|
+
keep_attrs(node).merge(
|
86
|
+
id: Metanorma::Utils::anchor_or_uuid(node), type: name,
|
87
|
+
beforeclauses: node.attr("beforeclauses") == "true" ? "true" : nil
|
88
|
+
)
|
89
|
+
)
|
74
90
|
end
|
75
91
|
|
76
92
|
def admonition(node)
|
77
93
|
return termnote(node) if in_terms?
|
78
94
|
return note(node) if node.attr("name") == "note"
|
79
95
|
return todo(node) if node.attr("name") == "todo"
|
96
|
+
|
80
97
|
noko do |xml|
|
81
98
|
xml.admonition **admonition_attrs(node) do |a|
|
82
99
|
node.title.nil? or a.name { |name| name << node.title }
|