metanorma-standoc 1.6.1 → 1.7.0
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/.github/workflows/rake.yml +66 -0
- data/README.adoc +1 -3
- data/lib/asciidoctor/standoc/base.rb +8 -16
- data/lib/asciidoctor/standoc/basicdoc.rng +50 -3
- data/lib/asciidoctor/standoc/cleanup.rb +52 -4
- data/lib/asciidoctor/standoc/cleanup_block.rb +41 -4
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +47 -20
- data/lib/asciidoctor/standoc/cleanup_footnotes.rb +14 -0
- data/lib/asciidoctor/standoc/cleanup_inline.rb +9 -3
- data/lib/asciidoctor/standoc/cleanup_ref.rb +17 -24
- data/lib/asciidoctor/standoc/cleanup_terms.rb +4 -6
- data/lib/asciidoctor/standoc/converter.rb +71 -1
- data/lib/asciidoctor/standoc/front.rb +6 -0
- data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
- data/lib/asciidoctor/standoc/inline.rb +6 -5
- data/lib/asciidoctor/standoc/isodoc.rng +36 -43
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +55 -59
- data/lib/asciidoctor/standoc/macros_terms.rb +82 -0
- data/lib/asciidoctor/standoc/ref.rb +19 -25
- data/lib/asciidoctor/standoc/ref_sect.rb +4 -3
- data/lib/asciidoctor/standoc/section.rb +21 -20
- data/lib/asciidoctor/standoc/table.rb +12 -0
- data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +86 -0
- data/lib/asciidoctor/standoc/utils.rb +2 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +5 -3
- data/spec/asciidoctor-standoc/base_spec.rb +14 -4
- data/spec/asciidoctor-standoc/blocks_spec.rb +14 -9
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +1519 -0
- data/spec/asciidoctor-standoc/cleanup_spec.rb +416 -1554
- data/spec/asciidoctor-standoc/converter_spec.rb +8 -0
- data/spec/asciidoctor-standoc/inline_spec.rb +2 -5
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +16 -9
- data/spec/asciidoctor-standoc/lists_spec.rb +10 -1
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +80 -0
- data/spec/asciidoctor-standoc/macros_plantuml_spec.rb +307 -0
- data/spec/asciidoctor-standoc/macros_spec.rb +408 -169
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +6 -6
- data/spec/asciidoctor-standoc/refs_spec.rb +112 -65
- data/spec/asciidoctor-standoc/section_spec.rb +17 -12
- data/spec/asciidoctor-standoc/table_spec.rb +86 -0
- data/spec/asciidoctor-standoc/validate_spec.rb +26 -0
- data/spec/fixtures/diagram_definitions.lutaml +22 -0
- data/spec/fixtures/test.exp +121 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +59 -243
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -119
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -60
- data/spec/vcr_cassettes/isobib_get_124.yml +11 -57
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +281 -157
- metadata +45 -11
- data/.github/workflows/macos.yml +0 -41
- data/.github/workflows/ubuntu.yml +0 -45
- data/.github/workflows/windows.yml +0 -43
@@ -82,7 +82,21 @@ module Asciidoctor
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
+
def footnote_block_cleanup(xmldoc)
|
86
|
+
xmldoc.xpath("//footnoteblock").each do |f|
|
87
|
+
f.name = 'fn'
|
88
|
+
if id = xmldoc.at("//*[@id = '#{f.text}']")
|
89
|
+
f.children = id.remove.children
|
90
|
+
else
|
91
|
+
@log.add("Crossreferences", f,
|
92
|
+
"Could not resolve footnoteblock:[#{f.text}]")
|
93
|
+
f.children = "[ERROR]"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
85
98
|
def footnote_cleanup(xmldoc)
|
99
|
+
footnote_block_cleanup(xmldoc)
|
86
100
|
title_footnote_move(xmldoc)
|
87
101
|
table_footnote_renumber(xmldoc)
|
88
102
|
other_footnote_renumber(xmldoc)
|
@@ -49,8 +49,12 @@ module Asciidoctor
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def extract_localities(x)
|
52
|
-
|
53
|
-
|
52
|
+
f = x&.children&.first or return
|
53
|
+
f.text? or return
|
54
|
+
head = f.remove.text
|
55
|
+
tail = x&.children&.remove
|
56
|
+
extract_localities1(x, head)
|
57
|
+
tail and x << tail
|
54
58
|
end
|
55
59
|
|
56
60
|
def extract_localities1(x, text)
|
@@ -121,7 +125,7 @@ module Asciidoctor
|
|
121
125
|
def concept_termbase_cleanup(x)
|
122
126
|
text = x&.children&.first&.remove&.text
|
123
127
|
termbase, key = x["key"].split(/:/, 2)
|
124
|
-
x.add_child(%(<termref base="#{termbase}" target="#{key}">) +
|
128
|
+
x.add_child(%(<termref base="#{termbase}" target="#{key}">) +
|
125
129
|
"#{text}</termref>")
|
126
130
|
end
|
127
131
|
|
@@ -151,6 +155,8 @@ module Asciidoctor
|
|
151
155
|
ret
|
152
156
|
end
|
153
157
|
|
158
|
+
module_function :to_ncname
|
159
|
+
|
154
160
|
def to_xreftarget(s)
|
155
161
|
return to_ncname(s) unless /^[^#]+#.+$/.match(s)
|
156
162
|
/^(?<pref>[^#]+)#(?<suff>.+)$/ =~ s
|
@@ -16,8 +16,7 @@ module Asciidoctor
|
|
16
16
|
insert = refs&.at("./bibitem")&.previous_element
|
17
17
|
refs.xpath("./bibitem").each { |b| b.remove }
|
18
18
|
bib.reverse.each do |b|
|
19
|
-
insert and insert.next = b.to_xml or
|
20
|
-
refs.children.first.add_previous_sibling b.to_xml
|
19
|
+
insert and insert.next = b.to_xml or refs.children.first.add_previous_sibling b.to_xml
|
21
20
|
end
|
22
21
|
extract_notes_from_biblio(refs)
|
23
22
|
refs.xpath("./references").each { |r| biblio_reorder1(r) }
|
@@ -49,12 +48,14 @@ module Asciidoctor
|
|
49
48
|
# consecutively, but that standards codes are preserved as is:
|
50
49
|
# only numeric references are renumbered
|
51
50
|
def biblio_renumber(xmldoc)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
i = 0
|
52
|
+
xmldoc.xpath("//bibliography//references | //clause//references | //annex//references").each do |r|
|
53
|
+
r.xpath("./bibitem").each do |b|
|
54
|
+
i += 1
|
55
|
+
next unless docid = b.at("./docidentifier[@type = 'metanorma']")
|
56
|
+
next unless /^\[\d+\]$/.match(docid.text)
|
57
|
+
docid.children = "[#{i}]"
|
58
|
+
end
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
@@ -123,8 +124,7 @@ module Asciidoctor
|
|
123
124
|
xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
|
124
125
|
bib = dl_bib_extract(c) or next
|
125
126
|
validate_ref_dl(bib, c)
|
126
|
-
bibitemxml = RelatonBib::BibliographicItem.new(
|
127
|
-
RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
|
127
|
+
bibitemxml = RelatonBib::BibliographicItem.new(RelatonBib::HashConverter::hash_to_bib(bib)).to_xml or next
|
128
128
|
bibitem = Nokogiri::XML(bibitemxml)
|
129
129
|
bibitem.root["id"] = c["id"] if c["id"] && !/^_/.match(c["id"])
|
130
130
|
c.replace(bibitem.root)
|
@@ -135,14 +135,11 @@ module Asciidoctor
|
|
135
135
|
id = bib["id"]
|
136
136
|
id ||= c["id"] unless /^_/.match(c["id"]) # do not accept implicit id
|
137
137
|
unless id
|
138
|
-
@log.add("Anchors", c, "The following reference is missing "
|
139
|
-
"an anchor:\n" + c.to_xml)
|
138
|
+
@log.add("Anchors", c, "The following reference is missing an anchor:\n" + c.to_xml)
|
140
139
|
return
|
141
140
|
end
|
142
|
-
bib["title"] or @log.add("Bibliography", c, "Reference #{id} "
|
143
|
-
|
144
|
-
bib["docid"] or @log.add("Bibliography", c, "Reference #{id} "\
|
145
|
-
"is missing a document identifier (docid)")
|
141
|
+
bib["title"] or @log.add("Bibliography", c, "Reference #{id} is missing a title")
|
142
|
+
bib["docid"] or @log.add("Bibliography", c, "Reference #{id} is missing a document identifier (docid)")
|
146
143
|
end
|
147
144
|
|
148
145
|
def extract_from_p(tag, bib, key)
|
@@ -173,8 +170,7 @@ module Asciidoctor
|
|
173
170
|
return nil if dtd.children.empty?
|
174
171
|
dtd.at("./dl") and return dl_bib_extract(dtd)
|
175
172
|
elems = dtd.remove.elements
|
176
|
-
return p_unwrap(dtd) unless elems.size == 1 &&
|
177
|
-
%w(ol ul).include?(elems[0].name)
|
173
|
+
return p_unwrap(dtd) unless elems.size == 1 && %w(ol ul).include?(elems[0].name)
|
178
174
|
ret = []
|
179
175
|
elems[0].xpath("./li").each do |li|
|
180
176
|
ret << p_unwrap(li)
|
@@ -192,8 +188,7 @@ module Asciidoctor
|
|
192
188
|
bib = {}
|
193
189
|
key = ""
|
194
190
|
dl.xpath("./dt | ./dd").each do |dtd|
|
195
|
-
dtd.name == "dt" and key = dtd.text.sub(/:+$/, "") or
|
196
|
-
add_to_hash(bib, key, dd_bib_extract(dtd))
|
191
|
+
dtd.name == "dt" and key = dtd.text.sub(/:+$/, "") or add_to_hash(bib, key, dd_bib_extract(dtd))
|
197
192
|
end
|
198
193
|
c.xpath("./clause").each do |c1|
|
199
194
|
key = c1&.at("./title")&.text&.downcase&.strip
|
@@ -221,8 +216,7 @@ module Asciidoctor
|
|
221
216
|
File.file?(file) or return nil
|
222
217
|
xml = Nokogiri::XML(File.read(file, encoding: "utf-8"))
|
223
218
|
ret = xml.at("//*[local-name() = 'bibdata']") or return nil
|
224
|
-
ret = Nokogiri::XML(ret.to_xml.sub(
|
225
|
-
%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
|
219
|
+
ret = Nokogiri::XML(ret.to_xml.sub(%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
|
226
220
|
ret.name = "bibitem"
|
227
221
|
ins = ret.at("./*[local-name() = 'docidentifier']") or return nil
|
228
222
|
ins.previous = %{<uri type="citation">#{uri}</uri>}
|
@@ -232,8 +226,7 @@ module Asciidoctor
|
|
232
226
|
|
233
227
|
# if citation uri points to local file, get bibitem from it
|
234
228
|
def fetch_local_bibitem(xmldoc)
|
235
|
-
xmldoc.xpath("//bibitem[formattedref]"
|
236
|
-
"[uri[@type = 'citation']]").each do |b|
|
229
|
+
xmldoc.xpath("//bibitem[formattedref][uri[@type = 'citation']]").each do |b|
|
237
230
|
uri = b&.at("./uri[@type = 'citation']")&.text
|
238
231
|
bibitem = read_local_bibitem(uri) or next
|
239
232
|
bibitem["id"] = b["id"]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative "term_lookup_cleanup"
|
2
|
+
|
1
3
|
module Asciidoctor
|
2
4
|
module Standoc
|
3
5
|
module Cleanup
|
@@ -45,10 +47,6 @@ module Asciidoctor
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
def termdef_boilerplate_cleanup(xmldoc)
|
49
|
-
xmldoc.xpath("//terms/p | //terms/ul").each(&:remove)
|
50
|
-
end
|
51
|
-
|
52
50
|
def termdef_subclause_cleanup(xmldoc)
|
53
51
|
xmldoc.xpath("//terms[terms]").each { |t| t.name = "clause" }
|
54
52
|
end
|
@@ -81,11 +79,12 @@ module Asciidoctor
|
|
81
79
|
x.name = "note"
|
82
80
|
end
|
83
81
|
xmldoc.xpath("//termexample[not(ancestor::term)]").each do |x|
|
84
|
-
x.name = "
|
82
|
+
x.name = "example"
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
88
86
|
def termdef_cleanup(xmldoc)
|
87
|
+
Asciidoctor::Standoc::TermLookupCleanup.new(xmldoc, @log).call
|
89
88
|
termdef_from_termbase(xmldoc)
|
90
89
|
termdef_unnest_cleanup(xmldoc)
|
91
90
|
termdef_stem_cleanup(xmldoc)
|
@@ -93,7 +92,6 @@ module Asciidoctor
|
|
93
92
|
termdefinition_cleanup(xmldoc)
|
94
93
|
termdomain1_cleanup(xmldoc)
|
95
94
|
termnote_example_cleanup(xmldoc)
|
96
|
-
termdef_boilerplate_cleanup(xmldoc)
|
97
95
|
termdef_subclause_cleanup(xmldoc)
|
98
96
|
term_children_cleanup(xmldoc)
|
99
97
|
termdocsource_cleanup(xmldoc)
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require "asciidoctor"
|
2
|
+
require "fontist"
|
3
|
+
require "fontist/manifest/install"
|
4
|
+
require "metanorma/util"
|
2
5
|
require "metanorma/standoc/version"
|
3
6
|
require "asciidoctor/standoc/base"
|
4
7
|
require "asciidoctor/standoc/front"
|
@@ -25,6 +28,8 @@ module Asciidoctor
|
|
25
28
|
preprocessor Asciidoctor::Standoc::Datamodel::DiagramPreprocessor
|
26
29
|
preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
|
27
30
|
preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
|
31
|
+
preprocessor Metanorma::Plugin::Lutaml::LutamlPreprocessor
|
32
|
+
preprocessor Metanorma::Plugin::Lutaml::LutamlUmlAttributesTablePreprocessor
|
28
33
|
inline_macro Asciidoctor::Standoc::AltTermInlineMacro
|
29
34
|
inline_macro Asciidoctor::Standoc::DeprecatedTermInlineMacro
|
30
35
|
inline_macro Asciidoctor::Standoc::DomainTermInlineMacro
|
@@ -32,9 +37,15 @@ module Asciidoctor
|
|
32
37
|
inline_macro Asciidoctor::Standoc::HTML5RubyMacro
|
33
38
|
inline_macro Asciidoctor::Standoc::ConceptInlineMacro
|
34
39
|
inline_macro Asciidoctor::Standoc::AutonumberInlineMacro
|
40
|
+
inline_macro Asciidoctor::Standoc::VariantInlineMacro
|
41
|
+
inline_macro Asciidoctor::Standoc::FootnoteBlockInlineMacro
|
42
|
+
inline_macro Asciidoctor::Standoc::TermRefInlineMacro
|
43
|
+
inline_macro Asciidoctor::Standoc::IndexXrefInlineMacro
|
44
|
+
inline_macro Asciidoctor::Standoc::IndexRangeInlineMacro
|
35
45
|
block Asciidoctor::Standoc::ToDoAdmonitionBlock
|
36
46
|
treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
|
37
47
|
block Asciidoctor::Standoc::PlantUMLBlockMacro
|
48
|
+
block Metanorma::Plugin::Lutaml::LutamlDiagramBlock
|
38
49
|
block Asciidoctor::Standoc::PseudocodeBlockMacro
|
39
50
|
end
|
40
51
|
|
@@ -44,6 +55,7 @@ module Asciidoctor
|
|
44
55
|
include ::Asciidoctor::Standoc::Base
|
45
56
|
include ::Asciidoctor::Standoc::Front
|
46
57
|
include ::Asciidoctor::Standoc::Lists
|
58
|
+
include ::Asciidoctor::Standoc::Refs
|
47
59
|
include ::Asciidoctor::Standoc::Inline
|
48
60
|
include ::Asciidoctor::Standoc::Blocks
|
49
61
|
include ::Asciidoctor::Standoc::Section
|
@@ -61,6 +73,8 @@ module Asciidoctor
|
|
61
73
|
basebackend "html"
|
62
74
|
outfilesuffix ".xml"
|
63
75
|
@libdir = File.dirname(self.class::_file || __FILE__)
|
76
|
+
|
77
|
+
install_fonts(opts)
|
64
78
|
end
|
65
79
|
|
66
80
|
class << self
|
@@ -73,7 +87,63 @@ module Asciidoctor
|
|
73
87
|
|
74
88
|
# path to isodoc assets in child gems
|
75
89
|
def html_doc_path(file)
|
76
|
-
File.join(@libdir,
|
90
|
+
File.join(@libdir, "../../isodoc/html", file)
|
91
|
+
end
|
92
|
+
|
93
|
+
def flavor_name
|
94
|
+
self.class.name.split("::")&.[](-2).downcase.to_sym
|
95
|
+
end
|
96
|
+
|
97
|
+
def fonts_manifest
|
98
|
+
flavor = flavor_name
|
99
|
+
registry = Metanorma::Registry.instance
|
100
|
+
processor = registry.find_processor(flavor)
|
101
|
+
|
102
|
+
if processor.nil?
|
103
|
+
Metanorma::Util.log("[fontist] #{flavor} processor not found. " \
|
104
|
+
"Please go to github.com/metanorma/metanorma/issues to report " \
|
105
|
+
"this issue.", :warn)
|
106
|
+
return nil
|
107
|
+
elsif !defined? processor.fonts_manifest
|
108
|
+
Metanorma::Util.log("[fontist] #{flavor} processor don't require " \
|
109
|
+
"specific fonts", :debug)
|
110
|
+
return nil
|
111
|
+
end
|
112
|
+
|
113
|
+
processor.fonts_manifest
|
114
|
+
end
|
115
|
+
|
116
|
+
def install_fonts(options={})
|
117
|
+
if options[:no_install_fonts]
|
118
|
+
Metanorma::Util.log("[fontist] Skip font installation because" \
|
119
|
+
" --no-install-fonts argument passed", :debug)
|
120
|
+
return
|
121
|
+
end
|
122
|
+
|
123
|
+
manifest = fonts_manifest
|
124
|
+
return if manifest.nil?
|
125
|
+
|
126
|
+
begin
|
127
|
+
Fontist::Manifest::Install.from_hash(
|
128
|
+
fonts_manifest,
|
129
|
+
confirmation: options[:agree_to_terms] ? "yes" : "no"
|
130
|
+
)
|
131
|
+
rescue Fontist::Errors::LicensingError
|
132
|
+
if !options[:agree_to_terms]
|
133
|
+
Metanorma::Util.log("[fontist] --agree-to-terms option missing." \
|
134
|
+
" You must accept font licenses to install fonts.", :debug)
|
135
|
+
elsif options[:continue_without_fonts]
|
136
|
+
Metanorma::Util.log("[fontist] Processing will continue without" \
|
137
|
+
" fonts installed", :debug)
|
138
|
+
else
|
139
|
+
Metanorma::Util.log("[fontist] Aborting without proper fonts" \
|
140
|
+
" installed", :fatal)
|
141
|
+
end
|
142
|
+
rescue Fontist::Errors::NonSupportedFontError
|
143
|
+
Metanorma::Util.log("[fontist] '#{font}' font is not supported. " \
|
144
|
+
"Please go to github.com/metanorma/metanorma-#{flavor_name}/issues" \
|
145
|
+
" to report this issue.", :info)
|
146
|
+
end
|
77
147
|
end
|
78
148
|
|
79
149
|
alias_method :embedded, :content
|
@@ -17,6 +17,11 @@ module Asciidoctor
|
|
17
17
|
xml.docnumber node.attr("docnumber")
|
18
18
|
end
|
19
19
|
|
20
|
+
def metadata_other_id(node, xml)
|
21
|
+
a = node.attr("isbn") and xml.docidentifier a, type: "ISBN"
|
22
|
+
a = node.attr("isbn10") and xml.docidentifier a, type: "ISBN10"
|
23
|
+
end
|
24
|
+
|
20
25
|
def metadata_version(node, xml)
|
21
26
|
xml.edition node.attr("edition") if node.attr("edition")
|
22
27
|
xml.version do |v|
|
@@ -138,6 +143,7 @@ module Asciidoctor
|
|
138
143
|
title node, xml
|
139
144
|
metadata_source(node, xml)
|
140
145
|
metadata_id(node, xml)
|
146
|
+
metadata_other_id(node, xml)
|
141
147
|
metadata_date(node, xml)
|
142
148
|
metadata_author(node, xml)
|
143
149
|
metadata_publisher(node, xml)
|
@@ -46,8 +46,9 @@ module Asciidoctor
|
|
46
46
|
|
47
47
|
# , " => ," : CSV definition does not deal with space followed by quote
|
48
48
|
# at start of field
|
49
|
-
def csv_split(s, delim = "
|
50
|
-
|
49
|
+
def csv_split(s, delim = ";")
|
50
|
+
return if s.nil?
|
51
|
+
CSV.parse_line(s&.gsub(/#{delim} "(?!")/, "#{delim}\""),
|
51
52
|
liberal_parsing: true,
|
52
53
|
col_sep: delim)&.compact&.map { |x| x.strip }
|
53
54
|
end
|
@@ -115,8 +116,11 @@ module Asciidoctor
|
|
115
116
|
node.attr("affiliation#{suffix}") and p.affiliation do |a|
|
116
117
|
a.organization do |o|
|
117
118
|
o.name node.attr("affiliation#{suffix}")
|
118
|
-
|
119
|
-
|
119
|
+
a = node.attr("affiliation_subdiv#{suffix}")
|
120
|
+
abbr = node.attr("affiliation_abbrev#{suffix}") and o.abbreviation abbr
|
121
|
+
csv_split(node.attr("affiliation_subdiv#{suffix}"))&.each do |s|
|
122
|
+
o.subdivision s
|
123
|
+
end
|
120
124
|
node.attr("address#{suffix}") and o.address do |ad|
|
121
125
|
ad.formattedAddress do |f|
|
122
126
|
f << node.attr("address#{suffix}").gsub(/ \+\n/, "<br/>")
|
@@ -211,11 +211,12 @@ module Asciidoctor
|
|
211
211
|
def inline_indexterm(node)
|
212
212
|
noko do |xml|
|
213
213
|
node.type == :visible and xml << node.text
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
214
|
+
terms = (node.attr("terms") || [node.text]).map { |x| xml_encode(x) }
|
215
|
+
xml.index do |i|
|
216
|
+
i.primary { |x| x << terms[0] }
|
217
|
+
a = terms.dig(1) and i.secondary { |x| x << a }
|
218
|
+
a = terms.dig(2) and i.tertiary { |x| x << a }
|
219
|
+
end
|
219
220
|
end.join
|
220
221
|
end
|
221
222
|
end
|
@@ -24,6 +24,14 @@
|
|
24
24
|
<start>
|
25
25
|
<ref name="standard-document"/>
|
26
26
|
</start>
|
27
|
+
<define name="doctype">
|
28
|
+
<element name="doctype">
|
29
|
+
<optional>
|
30
|
+
<attribute name="abbreviation"/>
|
31
|
+
</optional>
|
32
|
+
<ref name="DocumentType"/>
|
33
|
+
</element>
|
34
|
+
</define>
|
27
35
|
<define name="hyperlink">
|
28
36
|
<element name="link">
|
29
37
|
<attribute name="target">
|
@@ -47,6 +55,13 @@
|
|
47
55
|
<param name="pattern">\i\c*|\c+#\c+</param>
|
48
56
|
</data>
|
49
57
|
</attribute>
|
58
|
+
<optional>
|
59
|
+
<attribute name="to">
|
60
|
+
<data type="string">
|
61
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
62
|
+
</data>
|
63
|
+
</attribute>
|
64
|
+
</optional>
|
50
65
|
<optional>
|
51
66
|
<attribute name="type">
|
52
67
|
<ref name="ReferenceFormat"/>
|
@@ -141,6 +156,11 @@
|
|
141
156
|
<data type="boolean"/>
|
142
157
|
</attribute>
|
143
158
|
</optional>
|
159
|
+
<optional>
|
160
|
+
<attribute name="key">
|
161
|
+
<data type="boolean"/>
|
162
|
+
</attribute>
|
163
|
+
</optional>
|
144
164
|
<oneOrMore>
|
145
165
|
<ref name="dt"/>
|
146
166
|
<ref name="dd"/>
|
@@ -233,6 +253,9 @@
|
|
233
253
|
<data type="boolean"/>
|
234
254
|
</attribute>
|
235
255
|
</optional>
|
256
|
+
<optional>
|
257
|
+
<ref name="colgroup"/>
|
258
|
+
</optional>
|
236
259
|
<optional>
|
237
260
|
<ref name="tname"/>
|
238
261
|
</optional>
|
@@ -751,6 +774,18 @@
|
|
751
774
|
</define>
|
752
775
|
</include>
|
753
776
|
<!-- end overrides -->
|
777
|
+
<define name="colgroup">
|
778
|
+
<element name="colgroup">
|
779
|
+
<oneOrMore>
|
780
|
+
<ref name="col"/>
|
781
|
+
</oneOrMore>
|
782
|
+
</element>
|
783
|
+
</define>
|
784
|
+
<define name="col">
|
785
|
+
<element name="col">
|
786
|
+
<attribute name="width"/>
|
787
|
+
</element>
|
788
|
+
</define>
|
754
789
|
<define name="TextElement" combine="choice">
|
755
790
|
<ref name="concept"/>
|
756
791
|
</define>
|
@@ -1164,49 +1199,7 @@
|
|
1164
1199
|
</define>
|
1165
1200
|
<define name="annex">
|
1166
1201
|
<element name="annex">
|
1167
|
-
<
|
1168
|
-
<attribute name="id">
|
1169
|
-
<data type="ID"/>
|
1170
|
-
</attribute>
|
1171
|
-
</optional>
|
1172
|
-
<optional>
|
1173
|
-
<attribute name="language"/>
|
1174
|
-
</optional>
|
1175
|
-
<optional>
|
1176
|
-
<attribute name="script"/>
|
1177
|
-
</optional>
|
1178
|
-
<optional>
|
1179
|
-
<attribute name="inline-header">
|
1180
|
-
<data type="boolean"/>
|
1181
|
-
</attribute>
|
1182
|
-
</optional>
|
1183
|
-
<attribute name="obligation">
|
1184
|
-
<choice>
|
1185
|
-
<value>normative</value>
|
1186
|
-
<value>informative</value>
|
1187
|
-
</choice>
|
1188
|
-
</attribute>
|
1189
|
-
<optional>
|
1190
|
-
<ref name="section-title"/>
|
1191
|
-
</optional>
|
1192
|
-
<group>
|
1193
|
-
<group>
|
1194
|
-
<zeroOrMore>
|
1195
|
-
<ref name="BasicBlock"/>
|
1196
|
-
</zeroOrMore>
|
1197
|
-
<zeroOrMore>
|
1198
|
-
<ref name="note"/>
|
1199
|
-
</zeroOrMore>
|
1200
|
-
</group>
|
1201
|
-
<zeroOrMore>
|
1202
|
-
<choice>
|
1203
|
-
<ref name="annex-subsection"/>
|
1204
|
-
<ref name="terms"/>
|
1205
|
-
<ref name="definitions"/>
|
1206
|
-
<ref name="references"/>
|
1207
|
-
</choice>
|
1208
|
-
</zeroOrMore>
|
1209
|
-
</group>
|
1202
|
+
<ref name="Annex-Section"/>
|
1210
1203
|
</element>
|
1211
1204
|
</define>
|
1212
1205
|
<define name="terms">
|