metanorma-standoc 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -7
- data/.github/workflows/ubuntu.yml +6 -11
- data/.github/workflows/windows.yml +0 -8
- data/.rubocop.yml +1 -1
- data/Rakefile +2 -0
- data/lib/asciidoctor/standoc/base.rb +28 -27
- data/lib/asciidoctor/standoc/biblio.rng +1 -1
- data/lib/asciidoctor/standoc/blocks.rb +25 -95
- data/lib/asciidoctor/standoc/blocks_notes.rb +89 -0
- data/lib/asciidoctor/standoc/cleanup.rb +10 -6
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +11 -24
- data/lib/asciidoctor/standoc/cleanup_inline.rb +1 -1
- data/lib/asciidoctor/standoc/cleanup_ref.rb +47 -1
- data/lib/asciidoctor/standoc/cleanup_section.rb +72 -5
- data/lib/asciidoctor/standoc/cleanup_terms.rb +10 -0
- data/lib/asciidoctor/standoc/converter.rb +16 -2
- data/lib/asciidoctor/standoc/inline.rb +1 -1
- data/lib/asciidoctor/standoc/isodoc.rng +439 -6
- data/lib/asciidoctor/standoc/lists.rb +12 -12
- data/lib/asciidoctor/standoc/macros_yaml2text.rb +32 -15
- data/lib/asciidoctor/standoc/ref.rb +75 -34
- data/lib/asciidoctor/standoc/reqt.rb +11 -6
- data/lib/asciidoctor/standoc/reqt.rng +23 -0
- data/lib/asciidoctor/standoc/section.rb +27 -25
- data/lib/asciidoctor/standoc/table.rb +3 -2
- data/lib/asciidoctor/standoc/utils.rb +16 -0
- data/lib/asciidoctor/standoc/views/datamodel/model_representation.adoc.erb +1 -1
- data/lib/metanorma/standoc/processor.rb +5 -7
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +3 -2
- data/spec/asciidoctor-standoc/base_spec.rb +3 -2
- data/spec/asciidoctor-standoc/blocks_spec.rb +68 -32
- data/spec/asciidoctor-standoc/cleanup_spec.rb +1221 -17
- data/spec/asciidoctor-standoc/datamodel/attributes_table_preprocessor_spec.rb +35 -0
- data/spec/asciidoctor-standoc/inline_spec.rb +3 -3
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +4 -4
- data/spec/asciidoctor-standoc/lists_spec.rb +7 -5
- data/spec/asciidoctor-standoc/macros_spec.rb +4 -3
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +8 -6
- data/spec/asciidoctor-standoc/refs_spec.rb +275 -30
- data/spec/asciidoctor-standoc/section_spec.rb +42 -38
- data/spec/asciidoctor-standoc/table_spec.rb +3 -3
- data/spec/asciidoctor-standoc/validate_spec.rb +56 -0
- data/spec/assets/{html.css → html.scss} +0 -0
- data/spec/assets/i18n.yaml +17 -2
- data/spec/assets/iso123.rxl +107 -0
- data/spec/assets/{word.css → word.scss} +0 -0
- data/spec/examples/datamodel/blank_definition_profile.adoc +4 -0
- data/spec/examples/datamodel/models/models/{Signature copy.yml → SignatureBlankDefinition.yml} +2 -2
- data/spec/fixtures/macros_datamodel/blank_definition_profile.xml +51 -0
- data/spec/metanorma/processor_spec.rb +5 -6
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +83 -83
- data/spec/vcr_cassettes/isobib_get_123.yml +19 -198
- data/spec/vcr_cassettes/isobib_get_123_1.yml +361 -0
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +19 -19
- data/spec/vcr_cassettes/isobib_get_124.yml +21 -21
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +10 -10
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +42 -42
- metadata +32 -18
- data/lib/asciidoctor-yaml/i18n-en.yaml +0 -20
- data/lib/asciidoctor-yaml/i18n-fr.yaml +0 -13
- data/lib/asciidoctor-yaml/i18n-zh-Hans.yaml +0 -15
- data/lib/asciidoctor/standoc/i18n.rb +0 -39
@@ -16,8 +16,14 @@ module Asciidoctor
|
|
16
16
|
module Cleanup
|
17
17
|
def textcleanup(result)
|
18
18
|
text = result.flatten.map { |l| l.sub(/\s*$/, "") } * "\n"
|
19
|
-
|
20
|
-
|
19
|
+
!@keepasciimath and text = asciimath2mathml(text)
|
20
|
+
text = text.gsub(/\s+<fn /, "<fn ")
|
21
|
+
text.gsub(%r{<passthrough\s+formats="metanorma">([^<]*)
|
22
|
+
</passthrough>}mx) { |m| HTMLEntities.new.decode($1) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def asciimath2mathml(text)
|
26
|
+
text = text.gsub(%r{<stem type="AsciiMath">(.+?)</stem>}m) do |m|
|
21
27
|
"<amathstem>#{HTMLEntities.new.decode($1)}</amathstem>"
|
22
28
|
end
|
23
29
|
text = Html2Doc.
|
@@ -26,9 +32,7 @@ module Asciidoctor
|
|
26
32
|
x.xpath("//*[local-name() = 'math'][not(parent::stem)]").each do |y|
|
27
33
|
y.wrap("<stem type='MathML'></stem>")
|
28
34
|
end
|
29
|
-
|
30
|
-
end
|
31
|
-
text.gsub(/\s+<fn /, "<fn ")
|
35
|
+
x.to_xml
|
32
36
|
end
|
33
37
|
|
34
38
|
def cleanup(xmldoc)
|
@@ -41,7 +45,7 @@ module Asciidoctor
|
|
41
45
|
ref_cleanup(xmldoc)
|
42
46
|
note_cleanup(xmldoc)
|
43
47
|
clausebefore_cleanup(xmldoc)
|
44
|
-
|
48
|
+
bibitem_cleanup(xmldoc)
|
45
49
|
normref_cleanup(xmldoc)
|
46
50
|
biblio_cleanup(xmldoc)
|
47
51
|
reference_names(xmldoc)
|
@@ -2,25 +2,25 @@ module Asciidoctor
|
|
2
2
|
module Standoc
|
3
3
|
module Cleanup
|
4
4
|
def external_terms_boilerplate(sources)
|
5
|
-
|
6
|
-
@external_terms_boilerplate.gsub(/%/, sources || "???"),
|
5
|
+
@i18n.l10n(
|
6
|
+
@i18n.external_terms_boilerplate.gsub(/%/, sources || "???"),
|
7
7
|
@lang, @script)
|
8
8
|
end
|
9
9
|
|
10
10
|
def internal_external_terms_boilerplate(sources)
|
11
|
-
|
12
|
-
@internal_external_terms_boilerplate.gsub(/%/, sources || "??"),
|
11
|
+
@i18n.l10n(
|
12
|
+
@i18n.internal_external_terms_boilerplate.gsub(/%/, sources || "??"),
|
13
13
|
@lang, @script)
|
14
14
|
end
|
15
15
|
|
16
16
|
def term_defs_boilerplate(div, source, term, preface, isodoc)
|
17
|
-
div.next =
|
17
|
+
a = @i18n.term_def_boilerplate and div.next = a
|
18
18
|
source.each do |s|
|
19
19
|
@anchors[s["bibitemid"]] or
|
20
20
|
@log.add("Crossreferences", nil, "term source #{s['bibitemid']} not referenced")
|
21
21
|
end
|
22
22
|
if source.empty? && term.nil?
|
23
|
-
div.next = @no_terms_boilerplate
|
23
|
+
div.next = @i18n.no_terms_boilerplate
|
24
24
|
else
|
25
25
|
div.next = term_defs_boilerplate_cont(source, term, isodoc)
|
26
26
|
end
|
@@ -30,7 +30,7 @@ module Asciidoctor
|
|
30
30
|
sources = isodoc.sentence_join(src.map do |s|
|
31
31
|
%{<eref bibitemid="#{s['bibitemid']}"/>}
|
32
32
|
end)
|
33
|
-
if src.empty? then @internal_terms_boilerplate
|
33
|
+
if src.empty? then @i18n.internal_terms_boilerplate
|
34
34
|
elsif term.nil? then external_terms_boilerplate(sources)
|
35
35
|
else
|
36
36
|
internal_external_terms_boilerplate(sources)
|
@@ -42,7 +42,7 @@ module Asciidoctor
|
|
42
42
|
["reference", "bibitem"].include? e.name
|
43
43
|
end
|
44
44
|
f.at("./title").next =
|
45
|
-
"<p>#{(refs.empty? ? @norm_empty_pref : @norm_with_refs_pref)}</p>"
|
45
|
+
"<p>#{(refs.empty? ? @i18n.norm_empty_pref : @i18n.norm_with_refs_pref)}</p>"
|
46
46
|
end
|
47
47
|
|
48
48
|
TERM_CLAUSE = "//sections/terms | "\
|
@@ -54,13 +54,9 @@ module Asciidoctor
|
|
54
54
|
x = xmldoc.dup
|
55
55
|
x.root.add_namespace(nil, self.class::XML_NAMESPACE)
|
56
56
|
xml = Nokogiri::XML(x.to_xml)
|
57
|
-
|
58
|
-
@
|
59
|
-
@
|
60
|
-
conv.i18n_init(@lang, @script)
|
61
|
-
conv.metadata_init(@lang, @script, conv.labels)
|
62
|
-
conv.info(xml, nil)
|
63
|
-
conv
|
57
|
+
@isodoc ||= isodoc(@lang, @script)
|
58
|
+
@isodoc.info(xml, nil)
|
59
|
+
@isodoc
|
64
60
|
end
|
65
61
|
|
66
62
|
def boilerplate_cleanup(xmldoc)
|
@@ -83,15 +79,6 @@ module Asciidoctor
|
|
83
79
|
preface.previous = b
|
84
80
|
end
|
85
81
|
|
86
|
-
class EmptyAttr
|
87
|
-
def attr(_x)
|
88
|
-
nil
|
89
|
-
end
|
90
|
-
def attributes
|
91
|
-
{}
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
82
|
def boilerplate_file(xmldoc)
|
96
83
|
File.join(@libdir, "boilerplate.xml")
|
97
84
|
end
|
@@ -34,7 +34,7 @@ module Asciidoctor
|
|
34
34
|
# extending localities to cover ISO referencing
|
35
35
|
LOCALITY_REGEX_STR = <<~REGEXP.freeze
|
36
36
|
^((?<locality>section|clause|part|paragraph|chapter|page|
|
37
|
-
table|annex|figure|example|note|formula|list|
|
37
|
+
table|annex|figure|example|note|formula|list|time|anchor|
|
38
38
|
locality:[^ \\t\\n\\r:,;=]+)(\\s+|=)
|
39
39
|
(?<ref>[^"][^ \\t\\n,:-]*|"[^"]+")
|
40
40
|
(-(?<to>[^"][^ \\t\\n,:-]*|"[^"]"))?|
|
@@ -50,7 +50,8 @@ module Asciidoctor
|
|
50
50
|
# only numeric references are renumbered
|
51
51
|
def biblio_renumber(xmldoc)
|
52
52
|
r = xmldoc.at("//references[@normative = 'false'] | "\
|
53
|
-
"//clause[.//references[@normative = 'false']]
|
53
|
+
"//clause[.//references[@normative = 'false']] | "\
|
54
|
+
"//annex[.//references[@normative = 'false']]") or return
|
54
55
|
r.xpath(".//bibitem[not(ancestor::bibitem)]").each_with_index do |b, i|
|
55
56
|
next unless docid = b.at("./docidentifier[@type = 'metanorma']")
|
56
57
|
next unless /^\[\d+\]$/.match(docid.text)
|
@@ -122,6 +123,7 @@ module Asciidoctor
|
|
122
123
|
def ref_dl_cleanup(xmldoc)
|
123
124
|
xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
|
124
125
|
bib = dl_bib_extract(c) or next
|
126
|
+
validate_ref_dl(bib, c)
|
125
127
|
bibitemxml = RelatonBib::BibliographicItem.new(
|
126
128
|
RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
|
127
129
|
bibitem = Nokogiri::XML(bibitemxml)
|
@@ -130,6 +132,18 @@ module Asciidoctor
|
|
130
132
|
end
|
131
133
|
end
|
132
134
|
|
135
|
+
def validate_ref_dl(bib, c)
|
136
|
+
unless bib["id"]
|
137
|
+
@log.add("Anchors", c, "The following reference is missing "\
|
138
|
+
"an anchor:\n" + c.to_xml)
|
139
|
+
return
|
140
|
+
end
|
141
|
+
bib["title"] or @log.add("Bibliography", c, "Reference #{bib['id']} "\
|
142
|
+
"is missing a title")
|
143
|
+
bib["docid"] or @log.add("Bibliography", c, "Reference #{bib['id']} "\
|
144
|
+
"is missing a document identifier (docid)")
|
145
|
+
end
|
146
|
+
|
133
147
|
def extract_from_p(tag, bib, key)
|
134
148
|
return unless bib[tag]
|
135
149
|
"<#{key}>#{bib[tag].at('p').children}</#{key}>"
|
@@ -196,6 +210,38 @@ module Asciidoctor
|
|
196
210
|
def fetch_termbase(termbase, id)
|
197
211
|
""
|
198
212
|
end
|
213
|
+
|
214
|
+
def read_local_bibitem(uri)
|
215
|
+
return nil if %r{^http[s]?://}.match(uri)
|
216
|
+
file = @localdir + uri + ".rxl"
|
217
|
+
File.file?(file) or file = @localdir + uri + ".xml"
|
218
|
+
File.file?(file) or return nil
|
219
|
+
xml = Nokogiri::XML(File.read(file, encoding: "utf-8"))
|
220
|
+
ret = xml.at("//*[local-name() = 'bibdata']") or return nil
|
221
|
+
ret = Nokogiri::XML(ret.to_xml.sub(
|
222
|
+
%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
|
223
|
+
ret.name = "bibitem"
|
224
|
+
ins = ret.at("./*[local-name() = 'docidentifier']") or return nil
|
225
|
+
ins.previous = %{<uri type="citation">#{uri}</uri>}
|
226
|
+
ret&.at("./*[local-name() = 'ext']")&.remove
|
227
|
+
ret
|
228
|
+
end
|
229
|
+
|
230
|
+
# if citation uri points to local file, get bibitem from it
|
231
|
+
def fetch_local_bibitem(xmldoc)
|
232
|
+
xmldoc.xpath("//bibitem[formattedref]"\
|
233
|
+
"[uri[@type = 'citation']]").each do |b|
|
234
|
+
uri = b&.at("./uri[@type = 'citation']")&.text
|
235
|
+
bibitem = read_local_bibitem(uri) or next
|
236
|
+
bibitem["id"] = b["id"]
|
237
|
+
b.replace(bibitem)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def bibitem_cleanup(xmldoc)
|
242
|
+
ref_dl_cleanup(xmldoc)
|
243
|
+
fetch_local_bibitem(xmldoc)
|
244
|
+
end
|
199
245
|
end
|
200
246
|
end
|
201
247
|
end
|
@@ -39,6 +39,7 @@ module Asciidoctor
|
|
39
39
|
dupabstract.traverse { |n| n.remove_attribute("id") }
|
40
40
|
dupabstract.remove_attribute("language")
|
41
41
|
dupabstract.remove_attribute("script")
|
42
|
+
dupabstract&.at("./title")&.remove
|
42
43
|
bibabstract.next = dupabstract
|
43
44
|
end
|
44
45
|
end
|
@@ -105,6 +106,7 @@ module Asciidoctor
|
|
105
106
|
def sections_cleanup(x)
|
106
107
|
sections_order_cleanup(x)
|
107
108
|
sections_level_cleanup(x)
|
109
|
+
sections_names_cleanup(x)
|
108
110
|
end
|
109
111
|
|
110
112
|
def obligations_cleanup(x)
|
@@ -118,15 +120,15 @@ module Asciidoctor
|
|
118
120
|
(s = x.at("//introduction")) && s["obligation"] = "informative"
|
119
121
|
(s = x.at("//acknowledgements")) && s["obligation"] = "informative"
|
120
122
|
x.xpath("//references").each { |r| r["obligation"] = "informative" }
|
121
|
-
x.xpath("//preface//clause").each
|
123
|
+
x.xpath("//preface//clause").each do |r|
|
124
|
+
r["obligation"] = "informative"
|
125
|
+
end
|
122
126
|
end
|
123
127
|
|
124
128
|
def obligations_cleanup_norm(x)
|
125
|
-
(s = x.at("//clause[
|
126
|
-
(s = x.at("//clause[title = 'Symbols and Abbreviated Terms']")) &&
|
127
|
-
s["obligation"] = "normative"
|
129
|
+
(s = x.at("//clause[@type = 'scope']")) && s["obligation"] = "normative"
|
128
130
|
x.xpath("//terms").each { |r| r["obligation"] = "normative" }
|
129
|
-
x.xpath("//
|
131
|
+
x.xpath("//definitions").each { |r| r["obligation"] = "normative" }
|
130
132
|
end
|
131
133
|
|
132
134
|
def obligations_cleanup_inherit(x)
|
@@ -149,6 +151,71 @@ module Asciidoctor
|
|
149
151
|
ins.previous = x.remove
|
150
152
|
end
|
151
153
|
end
|
154
|
+
|
155
|
+
def get_or_make_title(node)
|
156
|
+
unless node.at("./title")
|
157
|
+
if node.children.empty?
|
158
|
+
node << "<title/>"
|
159
|
+
else
|
160
|
+
node.children.first.previous = "<title/>"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
node.at("./title")
|
164
|
+
end
|
165
|
+
|
166
|
+
def replace_title(doc, xpath, text, first = false)
|
167
|
+
return unless text
|
168
|
+
doc.xpath(xpath).each_with_index do |node, i|
|
169
|
+
next if first && !i.zero?
|
170
|
+
title = get_or_make_title(node)
|
171
|
+
fn = title.xpath("./fn")
|
172
|
+
fn.each { |n| n.remove }
|
173
|
+
title.content = text
|
174
|
+
fn.each { |n| title << n }
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def sections_names_cleanup(x)
|
179
|
+
replace_title(x, "//clause[@type = 'scope']", @i18n&.scope)
|
180
|
+
replace_title(x, "//preface//abstract", @i18n&.abstract)
|
181
|
+
replace_title(x, "//foreword", @i18n&.foreword)
|
182
|
+
replace_title(x, "//introduction", @i18n&.introduction)
|
183
|
+
replace_title(x, "//acknowledgements", @i18n&.acknowledgements)
|
184
|
+
section_names_refs_cleanup(x)
|
185
|
+
section_names_terms_cleanup(x)
|
186
|
+
end
|
187
|
+
|
188
|
+
def section_names_refs_cleanup(x)
|
189
|
+
replace_title(x, "//references[@normative = 'true']",
|
190
|
+
@i18n&.normref, true)
|
191
|
+
replace_title(x, "//references[@normative = 'false']",
|
192
|
+
@i18n&.bibliography, true)
|
193
|
+
end
|
194
|
+
|
195
|
+
NO_SYMABBR = "[.//definitions[not(@type)]]"
|
196
|
+
SYMABBR = "[.//definitions[@type = 'symbols']"\
|
197
|
+
"[@type = 'abbreviated_terms']]".freeze
|
198
|
+
SYMnoABBR = "[.//definitions[@type = 'symbols']"\
|
199
|
+
"[not(@type = 'abbreviated_terms')]]".freeze
|
200
|
+
ABBRnoSYM = "[.//definitions[not(@type = 'symbols')]"\
|
201
|
+
"[@type = 'abbreviated_terms']]".freeze
|
202
|
+
|
203
|
+
def section_names_terms_cleanup(x)
|
204
|
+
replace_title(x, "//definitions[@type = 'symbols']", @i18n&.symbols)
|
205
|
+
replace_title(x, "//definitions[@type = 'abbreviated_terms']", @i18n&.abbrev)
|
206
|
+
replace_title(x, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
|
207
|
+
replace_title(x, "//terms#{SYMnoABBR} | //clause[.//terms]#{SYMnoABBR}",
|
208
|
+
@i18n&.termsdefsymbols, true)
|
209
|
+
replace_title(x, "//terms#{ABBRnoSYM} | //clause[.//terms]#{ABBRnoSYM}",
|
210
|
+
@i18n&.termsdefabbrev, true)
|
211
|
+
replace_title(x, "//terms#{SYMABBR} | //clause[.//terms]#{SYMABBR}",
|
212
|
+
@i18n&.termsdefsymbolsabbrev, true)
|
213
|
+
replace_title(x, "//terms#{NO_SYMABBR} | //clause[.//terms]#{NO_SYMABBR}",
|
214
|
+
@i18n&.termsdefsymbolsabbrev, true)
|
215
|
+
replace_title(
|
216
|
+
x, "//terms[not(.//definitions)] | //clause[.//terms][not(.//definitions)]",
|
217
|
+
@i18n&.termsdef, true)
|
218
|
+
end
|
152
219
|
end
|
153
220
|
end
|
154
221
|
end
|
@@ -76,6 +76,15 @@ module Asciidoctor
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
def termnote_example_cleanup(xmldoc)
|
80
|
+
xmldoc.xpath("//termnote[not(ancestor::term)]").each do |x|
|
81
|
+
x.name = "note"
|
82
|
+
end
|
83
|
+
xmldoc.xpath("//termexample[not(ancestor::term)]").each do |x|
|
84
|
+
x.name = "note"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
79
88
|
def termdef_cleanup(xmldoc)
|
80
89
|
termdef_from_termbase(xmldoc)
|
81
90
|
termdef_unnest_cleanup(xmldoc)
|
@@ -83,6 +92,7 @@ module Asciidoctor
|
|
83
92
|
termdomain_cleanup(xmldoc)
|
84
93
|
termdefinition_cleanup(xmldoc)
|
85
94
|
termdomain1_cleanup(xmldoc)
|
95
|
+
termnote_example_cleanup(xmldoc)
|
86
96
|
termdef_boilerplate_cleanup(xmldoc)
|
87
97
|
termdef_subclause_cleanup(xmldoc)
|
88
98
|
term_children_cleanup(xmldoc)
|
@@ -11,7 +11,6 @@ require "asciidoctor/standoc/table"
|
|
11
11
|
require "asciidoctor/standoc/validate"
|
12
12
|
require "asciidoctor/standoc/utils"
|
13
13
|
require "asciidoctor/standoc/cleanup"
|
14
|
-
require "asciidoctor/standoc/i18n"
|
15
14
|
require "asciidoctor/standoc/reqt"
|
16
15
|
require_relative "./macros.rb"
|
17
16
|
require_relative "./log.rb"
|
@@ -21,6 +20,22 @@ module Asciidoctor
|
|
21
20
|
# A {Converter} implementation that generates Standoc output, and a document
|
22
21
|
# schema encapsulation of the document for validation
|
23
22
|
class Converter
|
23
|
+
Asciidoctor::Extensions.register do
|
24
|
+
preprocessor Asciidoctor::Standoc::Datamodel::AttributesTablePreprocessor
|
25
|
+
preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
|
26
|
+
preprocessor Asciidoctor::Standoc::Yaml2TextPreprocessor
|
27
|
+
inline_macro Asciidoctor::Standoc::AltTermInlineMacro
|
28
|
+
inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
|
29
|
+
inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
|
30
|
+
inline_macro Asciidoctor::Standoc::InheritInlineMacro
|
31
|
+
inline_macro Asciidoctor::Standoc::HTML5RubyMacro
|
32
|
+
inline_macro Asciidoctor::Standoc::ConceptInlineMacro
|
33
|
+
block Asciidoctor::Standoc::ToDoAdmonitionBlock
|
34
|
+
treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
|
35
|
+
block Asciidoctor::Standoc::PlantUMLBlockMacro
|
36
|
+
block Asciidoctor::Standoc::PseudocodeBlockMacro
|
37
|
+
end
|
38
|
+
|
24
39
|
include ::Asciidoctor::Converter
|
25
40
|
include ::Asciidoctor::Writer
|
26
41
|
|
@@ -32,7 +47,6 @@ module Asciidoctor
|
|
32
47
|
include ::Asciidoctor::Standoc::Section
|
33
48
|
include ::Asciidoctor::Standoc::Table
|
34
49
|
include ::Asciidoctor::Standoc::Utils
|
35
|
-
include ::Asciidoctor::Standoc::I18n
|
36
50
|
include ::Asciidoctor::Standoc::Cleanup
|
37
51
|
include ::Asciidoctor::Standoc::Validate
|
38
52
|
|
@@ -135,7 +135,7 @@ module Asciidoctor
|
|
135
135
|
results.nil? and
|
136
136
|
@log.add('Math', nil,
|
137
137
|
"latexmlmath failed to process equation:\n#{lxm_input}")
|
138
|
-
results
|
138
|
+
results&.sub(%r{<math ([^>]+ )?display="block"}, "<math \\1")
|
139
139
|
end
|
140
140
|
|
141
141
|
def stem_parse(text, xml, style)
|
@@ -64,6 +64,85 @@
|
|
64
64
|
<text/>
|
65
65
|
</element>
|
66
66
|
</define>
|
67
|
+
<define name="ul">
|
68
|
+
<element name="ul">
|
69
|
+
<attribute name="id">
|
70
|
+
<data type="ID"/>
|
71
|
+
</attribute>
|
72
|
+
<optional>
|
73
|
+
<attribute name="keep-with-next">
|
74
|
+
<data type="boolean"/>
|
75
|
+
</attribute>
|
76
|
+
</optional>
|
77
|
+
<optional>
|
78
|
+
<attribute name="keep-lines-together">
|
79
|
+
<data type="boolean"/>
|
80
|
+
</attribute>
|
81
|
+
</optional>
|
82
|
+
<oneOrMore>
|
83
|
+
<ref name="li"/>
|
84
|
+
</oneOrMore>
|
85
|
+
<zeroOrMore>
|
86
|
+
<ref name="note"/>
|
87
|
+
</zeroOrMore>
|
88
|
+
</element>
|
89
|
+
</define>
|
90
|
+
<define name="ol">
|
91
|
+
<element name="ol">
|
92
|
+
<attribute name="id">
|
93
|
+
<data type="ID"/>
|
94
|
+
</attribute>
|
95
|
+
<optional>
|
96
|
+
<attribute name="keep-with-next">
|
97
|
+
<data type="boolean"/>
|
98
|
+
</attribute>
|
99
|
+
</optional>
|
100
|
+
<optional>
|
101
|
+
<attribute name="keep-lines-together">
|
102
|
+
<data type="boolean"/>
|
103
|
+
</attribute>
|
104
|
+
</optional>
|
105
|
+
<attribute name="type">
|
106
|
+
<choice>
|
107
|
+
<value>roman</value>
|
108
|
+
<value>alphabet</value>
|
109
|
+
<value>arabic</value>
|
110
|
+
<value>roman_upper</value>
|
111
|
+
<value>alphabet_upper</value>
|
112
|
+
</choice>
|
113
|
+
</attribute>
|
114
|
+
<oneOrMore>
|
115
|
+
<ref name="li"/>
|
116
|
+
</oneOrMore>
|
117
|
+
<zeroOrMore>
|
118
|
+
<ref name="note"/>
|
119
|
+
</zeroOrMore>
|
120
|
+
</element>
|
121
|
+
</define>
|
122
|
+
<define name="dl">
|
123
|
+
<element name="dl">
|
124
|
+
<attribute name="id">
|
125
|
+
<data type="ID"/>
|
126
|
+
</attribute>
|
127
|
+
<optional>
|
128
|
+
<attribute name="keep-with-next">
|
129
|
+
<data type="boolean"/>
|
130
|
+
</attribute>
|
131
|
+
</optional>
|
132
|
+
<optional>
|
133
|
+
<attribute name="keep-lines-together">
|
134
|
+
<data type="boolean"/>
|
135
|
+
</attribute>
|
136
|
+
</optional>
|
137
|
+
<oneOrMore>
|
138
|
+
<ref name="dt"/>
|
139
|
+
<ref name="dd"/>
|
140
|
+
</oneOrMore>
|
141
|
+
<zeroOrMore>
|
142
|
+
<ref name="note"/>
|
143
|
+
</zeroOrMore>
|
144
|
+
</element>
|
145
|
+
</define>
|
67
146
|
<define name="example">
|
68
147
|
<element name="example">
|
69
148
|
<attribute name="id">
|
@@ -77,6 +156,19 @@
|
|
77
156
|
<optional>
|
78
157
|
<attribute name="subsequence"/>
|
79
158
|
</optional>
|
159
|
+
<optional>
|
160
|
+
<attribute name="number"/>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-with-next">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
167
|
+
<optional>
|
168
|
+
<attribute name="keep-lines-together">
|
169
|
+
<data type="boolean"/>
|
170
|
+
</attribute>
|
171
|
+
</optional>
|
80
172
|
<optional>
|
81
173
|
<ref name="tname"/>
|
82
174
|
</optional>
|
@@ -97,6 +189,296 @@
|
|
97
189
|
</zeroOrMore>
|
98
190
|
</element>
|
99
191
|
</define>
|
192
|
+
<define name="table">
|
193
|
+
<element name="table">
|
194
|
+
<attribute name="id">
|
195
|
+
<data type="ID"/>
|
196
|
+
</attribute>
|
197
|
+
<optional>
|
198
|
+
<attribute name="unnumbered">
|
199
|
+
<data type="boolean"/>
|
200
|
+
</attribute>
|
201
|
+
</optional>
|
202
|
+
<optional>
|
203
|
+
<attribute name="number"/>
|
204
|
+
</optional>
|
205
|
+
<optional>
|
206
|
+
<attribute name="subsequence"/>
|
207
|
+
</optional>
|
208
|
+
<optional>
|
209
|
+
<attribute name="alt"/>
|
210
|
+
</optional>
|
211
|
+
<optional>
|
212
|
+
<attribute name="summary"/>
|
213
|
+
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="uri">
|
216
|
+
<data type="anyURI"/>
|
217
|
+
</attribute>
|
218
|
+
</optional>
|
219
|
+
<optional>
|
220
|
+
<attribute name="keep-with-next">
|
221
|
+
<data type="boolean"/>
|
222
|
+
</attribute>
|
223
|
+
</optional>
|
224
|
+
<optional>
|
225
|
+
<attribute name="keep-lines-together">
|
226
|
+
<data type="boolean"/>
|
227
|
+
</attribute>
|
228
|
+
</optional>
|
229
|
+
<optional>
|
230
|
+
<ref name="tname"/>
|
231
|
+
</optional>
|
232
|
+
<optional>
|
233
|
+
<ref name="thead"/>
|
234
|
+
</optional>
|
235
|
+
<ref name="tbody"/>
|
236
|
+
<optional>
|
237
|
+
<ref name="tfoot"/>
|
238
|
+
</optional>
|
239
|
+
<zeroOrMore>
|
240
|
+
<ref name="table-note"/>
|
241
|
+
</zeroOrMore>
|
242
|
+
<optional>
|
243
|
+
<ref name="dl"/>
|
244
|
+
</optional>
|
245
|
+
</element>
|
246
|
+
</define>
|
247
|
+
<define name="figure">
|
248
|
+
<element name="figure">
|
249
|
+
<attribute name="id">
|
250
|
+
<data type="ID"/>
|
251
|
+
</attribute>
|
252
|
+
<optional>
|
253
|
+
<attribute name="unnumbered">
|
254
|
+
<data type="boolean"/>
|
255
|
+
</attribute>
|
256
|
+
</optional>
|
257
|
+
<optional>
|
258
|
+
<attribute name="number"/>
|
259
|
+
</optional>
|
260
|
+
<optional>
|
261
|
+
<attribute name="subsequence"/>
|
262
|
+
</optional>
|
263
|
+
<optional>
|
264
|
+
<attribute name="keep-with-next">
|
265
|
+
<data type="boolean"/>
|
266
|
+
</attribute>
|
267
|
+
</optional>
|
268
|
+
<optional>
|
269
|
+
<attribute name="keep-lines-together">
|
270
|
+
<data type="boolean"/>
|
271
|
+
</attribute>
|
272
|
+
</optional>
|
273
|
+
<optional>
|
274
|
+
<attribute name="class"/>
|
275
|
+
</optional>
|
276
|
+
<optional>
|
277
|
+
<ref name="source"/>
|
278
|
+
</optional>
|
279
|
+
<optional>
|
280
|
+
<ref name="tname"/>
|
281
|
+
</optional>
|
282
|
+
<choice>
|
283
|
+
<ref name="image"/>
|
284
|
+
<ref name="video"/>
|
285
|
+
<ref name="audio"/>
|
286
|
+
<ref name="pre"/>
|
287
|
+
<oneOrMore>
|
288
|
+
<ref name="paragraph-with-footnote"/>
|
289
|
+
</oneOrMore>
|
290
|
+
<zeroOrMore>
|
291
|
+
<ref name="figure"/>
|
292
|
+
</zeroOrMore>
|
293
|
+
</choice>
|
294
|
+
<zeroOrMore>
|
295
|
+
<ref name="fn"/>
|
296
|
+
</zeroOrMore>
|
297
|
+
<optional>
|
298
|
+
<ref name="dl"/>
|
299
|
+
</optional>
|
300
|
+
<zeroOrMore>
|
301
|
+
<ref name="note"/>
|
302
|
+
</zeroOrMore>
|
303
|
+
</element>
|
304
|
+
</define>
|
305
|
+
<define name="sourcecode">
|
306
|
+
<element name="sourcecode">
|
307
|
+
<attribute name="id">
|
308
|
+
<data type="ID"/>
|
309
|
+
</attribute>
|
310
|
+
<optional>
|
311
|
+
<attribute name="unnumbered">
|
312
|
+
<data type="boolean"/>
|
313
|
+
</attribute>
|
314
|
+
</optional>
|
315
|
+
<optional>
|
316
|
+
<attribute name="number"/>
|
317
|
+
</optional>
|
318
|
+
<optional>
|
319
|
+
<attribute name="subsequence"/>
|
320
|
+
</optional>
|
321
|
+
<optional>
|
322
|
+
<attribute name="keep-with-next">
|
323
|
+
<data type="boolean"/>
|
324
|
+
</attribute>
|
325
|
+
</optional>
|
326
|
+
<optional>
|
327
|
+
<attribute name="keep-lines-together">
|
328
|
+
<data type="boolean"/>
|
329
|
+
</attribute>
|
330
|
+
</optional>
|
331
|
+
<optional>
|
332
|
+
<attribute name="lang"/>
|
333
|
+
</optional>
|
334
|
+
<optional>
|
335
|
+
<ref name="tname"/>
|
336
|
+
</optional>
|
337
|
+
<oneOrMore>
|
338
|
+
<choice>
|
339
|
+
<text/>
|
340
|
+
<ref name="callout"/>
|
341
|
+
</choice>
|
342
|
+
</oneOrMore>
|
343
|
+
<zeroOrMore>
|
344
|
+
<ref name="annotation"/>
|
345
|
+
</zeroOrMore>
|
346
|
+
<zeroOrMore>
|
347
|
+
<ref name="note"/>
|
348
|
+
</zeroOrMore>
|
349
|
+
</element>
|
350
|
+
</define>
|
351
|
+
<define name="formula">
|
352
|
+
<element name="formula">
|
353
|
+
<attribute name="id">
|
354
|
+
<data type="ID"/>
|
355
|
+
</attribute>
|
356
|
+
<optional>
|
357
|
+
<attribute name="unnumbered">
|
358
|
+
<data type="boolean"/>
|
359
|
+
</attribute>
|
360
|
+
</optional>
|
361
|
+
<optional>
|
362
|
+
<attribute name="number"/>
|
363
|
+
</optional>
|
364
|
+
<optional>
|
365
|
+
<attribute name="subsequence"/>
|
366
|
+
</optional>
|
367
|
+
<optional>
|
368
|
+
<attribute name="keep-with-next">
|
369
|
+
<data type="boolean"/>
|
370
|
+
</attribute>
|
371
|
+
</optional>
|
372
|
+
<optional>
|
373
|
+
<attribute name="keep-lines-together">
|
374
|
+
<data type="boolean"/>
|
375
|
+
</attribute>
|
376
|
+
</optional>
|
377
|
+
<optional>
|
378
|
+
<attribute name="inequality">
|
379
|
+
<data type="boolean"/>
|
380
|
+
</attribute>
|
381
|
+
</optional>
|
382
|
+
<ref name="stem"/>
|
383
|
+
<optional>
|
384
|
+
<ref name="dl"/>
|
385
|
+
</optional>
|
386
|
+
<zeroOrMore>
|
387
|
+
<ref name="note"/>
|
388
|
+
</zeroOrMore>
|
389
|
+
</element>
|
390
|
+
</define>
|
391
|
+
<define name="ParagraphType">
|
392
|
+
<attribute name="id">
|
393
|
+
<data type="ID"/>
|
394
|
+
</attribute>
|
395
|
+
<optional>
|
396
|
+
<attribute name="align">
|
397
|
+
<ref name="Alignments"/>
|
398
|
+
</attribute>
|
399
|
+
</optional>
|
400
|
+
<optional>
|
401
|
+
<attribute name="keep-with-next">
|
402
|
+
<data type="boolean"/>
|
403
|
+
</attribute>
|
404
|
+
</optional>
|
405
|
+
<optional>
|
406
|
+
<attribute name="keep-lines-together">
|
407
|
+
<data type="boolean"/>
|
408
|
+
</attribute>
|
409
|
+
</optional>
|
410
|
+
<zeroOrMore>
|
411
|
+
<ref name="TextElement"/>
|
412
|
+
</zeroOrMore>
|
413
|
+
<zeroOrMore>
|
414
|
+
<ref name="note"/>
|
415
|
+
</zeroOrMore>
|
416
|
+
</define>
|
417
|
+
<define name="paragraph-with-footnote">
|
418
|
+
<element name="p">
|
419
|
+
<attribute name="id">
|
420
|
+
<data type="ID"/>
|
421
|
+
</attribute>
|
422
|
+
<optional>
|
423
|
+
<attribute name="align">
|
424
|
+
<ref name="Alignments"/>
|
425
|
+
</attribute>
|
426
|
+
</optional>
|
427
|
+
<optional>
|
428
|
+
<attribute name="keep-with-next">
|
429
|
+
<data type="boolean"/>
|
430
|
+
</attribute>
|
431
|
+
</optional>
|
432
|
+
<optional>
|
433
|
+
<attribute name="keep-lines-together">
|
434
|
+
<data type="boolean"/>
|
435
|
+
</attribute>
|
436
|
+
</optional>
|
437
|
+
<zeroOrMore>
|
438
|
+
<choice>
|
439
|
+
<ref name="TextElement"/>
|
440
|
+
<ref name="fn"/>
|
441
|
+
</choice>
|
442
|
+
</zeroOrMore>
|
443
|
+
<zeroOrMore>
|
444
|
+
<ref name="note"/>
|
445
|
+
</zeroOrMore>
|
446
|
+
</element>
|
447
|
+
</define>
|
448
|
+
<define name="quote">
|
449
|
+
<element name="quote">
|
450
|
+
<attribute name="id">
|
451
|
+
<data type="ID"/>
|
452
|
+
</attribute>
|
453
|
+
<optional>
|
454
|
+
<attribute name="alignment">
|
455
|
+
<ref name="Alignments"/>
|
456
|
+
</attribute>
|
457
|
+
</optional>
|
458
|
+
<optional>
|
459
|
+
<attribute name="keep-with-next">
|
460
|
+
<data type="boolean"/>
|
461
|
+
</attribute>
|
462
|
+
</optional>
|
463
|
+
<optional>
|
464
|
+
<attribute name="keep-lines-together">
|
465
|
+
<data type="boolean"/>
|
466
|
+
</attribute>
|
467
|
+
</optional>
|
468
|
+
<optional>
|
469
|
+
<ref name="quote-source"/>
|
470
|
+
</optional>
|
471
|
+
<optional>
|
472
|
+
<ref name="quote-author"/>
|
473
|
+
</optional>
|
474
|
+
<oneOrMore>
|
475
|
+
<ref name="paragraph-with-footnote"/>
|
476
|
+
</oneOrMore>
|
477
|
+
<zeroOrMore>
|
478
|
+
<ref name="note"/>
|
479
|
+
</zeroOrMore>
|
480
|
+
</element>
|
481
|
+
</define>
|
100
482
|
<define name="BibDataExtensionType">
|
101
483
|
<ref name="doctype"/>
|
102
484
|
<optional>
|
@@ -165,6 +547,30 @@
|
|
165
547
|
<attribute name="id">
|
166
548
|
<data type="ID"/>
|
167
549
|
</attribute>
|
550
|
+
<optional>
|
551
|
+
<attribute name="unnumbered">
|
552
|
+
<data type="boolean"/>
|
553
|
+
</attribute>
|
554
|
+
</optional>
|
555
|
+
<optional>
|
556
|
+
<attribute name="number"/>
|
557
|
+
</optional>
|
558
|
+
<optional>
|
559
|
+
<attribute name="subsequence"/>
|
560
|
+
</optional>
|
561
|
+
<optional>
|
562
|
+
<attribute name="keep-with-next">
|
563
|
+
<data type="boolean"/>
|
564
|
+
</attribute>
|
565
|
+
</optional>
|
566
|
+
<optional>
|
567
|
+
<attribute name="keep-lines-together">
|
568
|
+
<data type="boolean"/>
|
569
|
+
</attribute>
|
570
|
+
</optional>
|
571
|
+
<optional>
|
572
|
+
<attribute name="type"/>
|
573
|
+
</optional>
|
168
574
|
<oneOrMore>
|
169
575
|
<choice>
|
170
576
|
<ref name="paragraph"/>
|
@@ -516,6 +922,9 @@
|
|
516
922
|
<optional>
|
517
923
|
<attribute name="script"/>
|
518
924
|
</optional>
|
925
|
+
<optional>
|
926
|
+
<attribute name="type"/>
|
927
|
+
</optional>
|
519
928
|
<optional>
|
520
929
|
<attribute name="obligation">
|
521
930
|
<choice>
|
@@ -555,9 +964,6 @@
|
|
555
964
|
</define>
|
556
965
|
<define name="content-subsection">
|
557
966
|
<element name="clause">
|
558
|
-
<optional>
|
559
|
-
<attribute name="type"/>
|
560
|
-
</optional>
|
561
967
|
<ref name="Content-Section"/>
|
562
968
|
</element>
|
563
969
|
</define>
|
@@ -586,6 +992,9 @@
|
|
586
992
|
</choice>
|
587
993
|
</attribute>
|
588
994
|
</optional>
|
995
|
+
<optional>
|
996
|
+
<attribute name="type"/>
|
997
|
+
</optional>
|
589
998
|
<optional>
|
590
999
|
<ref name="section-title"/>
|
591
1000
|
</optional>
|
@@ -605,9 +1014,6 @@
|
|
605
1014
|
</define>
|
606
1015
|
<define name="clause">
|
607
1016
|
<element name="clause">
|
608
|
-
<optional>
|
609
|
-
<attribute name="type"/>
|
610
|
-
</optional>
|
611
1017
|
<ref name="Clause-Section"/>
|
612
1018
|
</element>
|
613
1019
|
</define>
|
@@ -636,6 +1042,9 @@
|
|
636
1042
|
</choice>
|
637
1043
|
</attribute>
|
638
1044
|
</optional>
|
1045
|
+
<optional>
|
1046
|
+
<attribute name="type"/>
|
1047
|
+
</optional>
|
639
1048
|
<optional>
|
640
1049
|
<ref name="section-title"/>
|
641
1050
|
</optional>
|
@@ -774,6 +1183,9 @@
|
|
774
1183
|
<optional>
|
775
1184
|
<attribute name="script"/>
|
776
1185
|
</optional>
|
1186
|
+
<optional>
|
1187
|
+
<attribute name="type"/>
|
1188
|
+
</optional>
|
777
1189
|
<optional>
|
778
1190
|
<attribute name="obligation">
|
779
1191
|
<choice>
|
@@ -910,6 +1322,27 @@
|
|
910
1322
|
<attribute name="id">
|
911
1323
|
<data type="ID"/>
|
912
1324
|
</attribute>
|
1325
|
+
<optional>
|
1326
|
+
<attribute name="unnumbered">
|
1327
|
+
<data type="boolean"/>
|
1328
|
+
</attribute>
|
1329
|
+
</optional>
|
1330
|
+
<optional>
|
1331
|
+
<attribute name="number"/>
|
1332
|
+
</optional>
|
1333
|
+
<optional>
|
1334
|
+
<attribute name="subsequence"/>
|
1335
|
+
</optional>
|
1336
|
+
<optional>
|
1337
|
+
<attribute name="keep-with-next">
|
1338
|
+
<data type="boolean"/>
|
1339
|
+
</attribute>
|
1340
|
+
</optional>
|
1341
|
+
<optional>
|
1342
|
+
<attribute name="keep-lines-together">
|
1343
|
+
<data type="boolean"/>
|
1344
|
+
</attribute>
|
1345
|
+
</optional>
|
913
1346
|
<oneOrMore>
|
914
1347
|
<choice>
|
915
1348
|
<ref name="paragraph"/>
|