metanorma-standoc 1.8.5 → 1.9.1
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 -1
- 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 +27 -12
- data/lib/asciidoctor/standoc/blocks_notes.rb +20 -14
- data/lib/asciidoctor/standoc/cleanup.rb +32 -78
- data/lib/asciidoctor/standoc/cleanup_block.rb +56 -59
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +32 -21
- 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 +21 -13
- 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 +3 -1
- 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 +130 -1
- data/lib/asciidoctor/standoc/lists.rb +4 -2
- data/lib/asciidoctor/standoc/macros.rb +40 -13
- 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 +12 -12
- data/lib/asciidoctor/standoc/terms.rb +10 -6
- data/lib/asciidoctor/standoc/utils.rb +32 -6
- data/lib/asciidoctor/standoc/validate.rb +12 -12
- 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 +10 -0
- data/spec/asciidoctor/cleanup_sections_spec.rb +14 -14
- data/spec/asciidoctor/cleanup_spec.rb +1860 -1874
- data/spec/asciidoctor/inline_spec.rb +272 -273
- data/spec/asciidoctor/macros_spec.rb +8 -2
- data/spec/asciidoctor/refs_spec.rb +135 -7
- data/spec/asciidoctor/section_spec.rb +670 -687
- 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 +16 -16
- data/spec/vcr_cassettes/isobib_get_123_1.yml +32 -32
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +41 -41
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +15 -15
- data/spec/vcr_cassettes/isobib_get_124.yml +17 -17
- 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 +71 -68
- data/.rubocop.ribose.yml +0 -66
- data/.rubocop.tb.yml +0 -650
- data/spec/asciidoctor/macros_lutaml_spec.rb +0 -80
@@ -14,9 +14,10 @@ module Asciidoctor
|
|
14
14
|
fold_notes_into_biblio(refs)
|
15
15
|
bib = sort_biblio(refs.xpath("./bibitem"))
|
16
16
|
insert = refs&.at("./bibitem")&.previous_element
|
17
|
-
refs.xpath("./bibitem").each
|
17
|
+
refs.xpath("./bibitem").each(&:remove)
|
18
18
|
bib.reverse.each do |b|
|
19
|
-
insert and insert.next = b.to_xml or
|
19
|
+
insert and insert.next = b.to_xml or
|
20
|
+
refs.children.first.add_previous_sibling b.to_xml
|
20
21
|
end
|
21
22
|
extract_notes_from_biblio(refs)
|
22
23
|
refs.xpath("./references").each { |r| biblio_reorder1(r) }
|
@@ -24,7 +25,7 @@ module Asciidoctor
|
|
24
25
|
|
25
26
|
def fold_notes_into_biblio(refs)
|
26
27
|
refs.xpath("./bibitem").each do |r|
|
27
|
-
while r&.next_element&.name == "note"
|
28
|
+
while r&.next_element&.name == "note"
|
28
29
|
r.next_element["appended"] = true
|
29
30
|
r << r.next_element.remove
|
30
31
|
end
|
@@ -49,12 +50,15 @@ module Asciidoctor
|
|
49
50
|
# only numeric references are renumbered
|
50
51
|
def biblio_renumber(xmldoc)
|
51
52
|
i = 0
|
52
|
-
xmldoc.xpath("//bibliography//references | //clause//references |
|
53
|
+
xmldoc.xpath("//bibliography//references | //clause//references | "\
|
54
|
+
"//annex//references").each do |r|
|
53
55
|
next if r["normative"] == "true"
|
56
|
+
|
54
57
|
r.xpath("./bibitem").each do |b|
|
55
58
|
i += 1
|
56
59
|
next unless docid = b.at("./docidentifier[@type = 'metanorma']")
|
57
|
-
next unless
|
60
|
+
next unless /^\[\d+\]$/.match?(docid.text)
|
61
|
+
|
58
62
|
docid.children = "[#{i}]"
|
59
63
|
end
|
60
64
|
end
|
@@ -72,7 +76,7 @@ module Asciidoctor
|
|
72
76
|
r = xmldoc.at(self.class::NORM_REF) || return
|
73
77
|
preface = r.xpath("./title/following-sibling::*") & # intersection
|
74
78
|
r.xpath("./bibitem[1]/preceding-sibling::*")
|
75
|
-
preface.each
|
79
|
+
preface.each(&:remove)
|
76
80
|
end
|
77
81
|
|
78
82
|
def biblio_cleanup(xmldoc)
|
@@ -92,6 +96,7 @@ module Asciidoctor
|
|
92
96
|
def format_ref(ref, type)
|
93
97
|
return @isodoc.docid_prefix(type, ref) if type != "metanorma"
|
94
98
|
return "[#{ref}]" if /^\d+$/.match(ref) && !/^\[.*\]$/.match(ref)
|
99
|
+
|
95
100
|
ref
|
96
101
|
end
|
97
102
|
|
@@ -103,7 +108,7 @@ module Asciidoctor
|
|
103
108
|
|
104
109
|
def reference_names(xmldoc)
|
105
110
|
xmldoc.xpath("//bibitem[not(ancestor::bibitem)]").each do |ref|
|
106
|
-
isopub = ref.at(ISO_PUBLISHER_XPATH)
|
111
|
+
# isopub = ref.at(ISO_PUBLISHER_XPATH)
|
107
112
|
docid = ref.at("./docidentifier[@type = 'metanorma']") ||
|
108
113
|
ref.at("./docidentifier[not(@type = 'DOI')]") or next
|
109
114
|
reference = format_ref(docid.text, docid["type"])
|
@@ -111,18 +116,20 @@ module Asciidoctor
|
|
111
116
|
end
|
112
117
|
end
|
113
118
|
|
114
|
-
def fetch_termbase(
|
119
|
+
def fetch_termbase(_termbase, _id)
|
115
120
|
""
|
116
121
|
end
|
117
122
|
|
118
123
|
def read_local_bibitem(uri)
|
119
|
-
return nil if %r{^
|
120
|
-
|
121
|
-
|
124
|
+
return nil if %r{^https?://}.match?(uri)
|
125
|
+
|
126
|
+
file = "#{@localdir}#{uri}.rxl"
|
127
|
+
File.file?(file) or file = "#{@localdir}#{uri}.xml"
|
122
128
|
File.file?(file) or return nil
|
123
129
|
xml = Nokogiri::XML(File.read(file, encoding: "utf-8"))
|
124
130
|
ret = xml.at("//*[local-name() = 'bibdata']") or return nil
|
125
|
-
ret = Nokogiri::XML(ret.to_xml
|
131
|
+
ret = Nokogiri::XML(ret.to_xml
|
132
|
+
.sub(%r{(<bibdata[^>]*?) xmlns=("[^"]+"|'[^']+')}, "\\1")).root
|
126
133
|
ret.name = "bibitem"
|
127
134
|
ins = ret.at("./*[local-name() = 'docidentifier']") or return nil
|
128
135
|
ins.previous = %{<uri type="citation">#{uri}</uri>}
|
@@ -132,7 +139,8 @@ module Asciidoctor
|
|
132
139
|
|
133
140
|
# if citation uri points to local file, get bibitem from it
|
134
141
|
def fetch_local_bibitem(xmldoc)
|
135
|
-
xmldoc.xpath("//bibitem[formattedref][uri[@type = 'citation']]")
|
142
|
+
xmldoc.xpath("//bibitem[formattedref][uri[@type = 'citation']]")
|
143
|
+
.each do |b|
|
136
144
|
uri = b&.at("./uri[@type = 'citation']")&.text
|
137
145
|
bibitem = read_local_bibitem(uri) or next
|
138
146
|
bibitem["id"] = b["id"]
|
@@ -8,7 +8,7 @@ module Asciidoctor
|
|
8
8
|
xmldoc.xpath("//clause[@bibitem = 'true']").each do |c|
|
9
9
|
bib = dl_bib_extract(c) or next
|
10
10
|
validate_ref_dl(bib, c)
|
11
|
-
bibitemxml = RelatonBib::BibliographicItem.
|
11
|
+
bibitemxml = RelatonBib::BibliographicItem.from_hash(bib).to_xml or next
|
12
12
|
bibitem = Nokogiri::XML(bibitemxml)
|
13
13
|
bibitem.root["id"] = c["id"] if c["id"] && !/^_/.match(c["id"])
|
14
14
|
c.replace(bibitem.root)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Standoc
|
3
|
+
module Cleanup
|
4
|
+
def requirement_cleanup(reqt)
|
5
|
+
requirement_descriptions(reqt)
|
6
|
+
requirement_inherit(reqt)
|
7
|
+
end
|
8
|
+
|
9
|
+
def requirement_inherit(reqt)
|
10
|
+
reqt.xpath("//requirement | //recommendation | //permission")
|
11
|
+
.each do |r|
|
12
|
+
ins = r.at("./classification") ||
|
13
|
+
r.at("./description | ./measurementtarget | ./specification | "\
|
14
|
+
"./verification | ./import | ./description | ./requirement | "\
|
15
|
+
"./recommendation | ./permission")
|
16
|
+
r.xpath("./*//inherit").each { |i| ins.previous = i }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def requirement_descriptions(reqt)
|
21
|
+
reqt.xpath("//requirement | //recommendation | //permission")
|
22
|
+
.each do |r|
|
23
|
+
r.children.each do |e|
|
24
|
+
unless e.element? && (reqt_subpart(e.name) ||
|
25
|
+
%w(requirement recommendation permission).include?(e.name))
|
26
|
+
t = Nokogiri::XML::Element.new("description", reqt)
|
27
|
+
e.before(t)
|
28
|
+
t.children = e.remove
|
29
|
+
end
|
30
|
+
end
|
31
|
+
requirement_cleanup1(r)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def requirement_cleanup1(reqt)
|
36
|
+
while d = reqt.at("./description[following-sibling::*[1]"\
|
37
|
+
"[self::description]]")
|
38
|
+
n = d.next.remove
|
39
|
+
d << n.children
|
40
|
+
end
|
41
|
+
reqt.xpath("./description[normalize-space(.)='']").each do |r|
|
42
|
+
r.replace("\n")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -43,7 +43,7 @@ module Asciidoctor
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def bibabstract_location(x)
|
46
|
-
|
46
|
+
x.at("//bibdata/script") || x.at("//bibdata/language") ||
|
47
47
|
x.at("//bibdata/contributor[not(following-sibling::contributor)]") ||
|
48
48
|
x.at("//bibdata/date[not(following-sibling::date)]") ||
|
49
49
|
x.at("//docnumber") ||
|
@@ -74,11 +74,11 @@ module Asciidoctor
|
|
74
74
|
make_bibliography(x, s)
|
75
75
|
x.xpath("//sections/annex").reverse_each { |r| s.next = r.remove }
|
76
76
|
end
|
77
|
-
|
78
77
|
def make_annexes(x)
|
79
78
|
x.xpath("//*[@annex]").each do |y|
|
80
79
|
y.delete("annex")
|
81
80
|
next if y.name == "annex" || !y.ancestors("annex").empty?
|
81
|
+
|
82
82
|
y.wrap("<annex/>")
|
83
83
|
y.parent["id"] = "_#{UUIDTools::UUID.random_create}"
|
84
84
|
y.parent["obligation"] = y["obligation"]
|
@@ -98,6 +98,7 @@ module Asciidoctor
|
|
98
98
|
def sections_level_cleanup(x)
|
99
99
|
m = maxlevel(x)
|
100
100
|
return if m < 6
|
101
|
+
|
101
102
|
m.downto(6).each do |l|
|
102
103
|
x.xpath("//clause[@level = '#{l}']").each do |c|
|
103
104
|
c.delete("level")
|
@@ -151,6 +152,7 @@ module Asciidoctor
|
|
151
152
|
|
152
153
|
def preface_clausebefore_cleanup(xmldoc)
|
153
154
|
return unless xmldoc.at("//preface")
|
155
|
+
|
154
156
|
unless ins = xmldoc.at("//preface").children.first
|
155
157
|
xmldoc.at("//preface") << " "
|
156
158
|
ins = xmldoc.at("//preface").children.first
|
@@ -163,6 +165,7 @@ module Asciidoctor
|
|
163
165
|
|
164
166
|
def sections_clausebefore_cleanup(xmldoc)
|
165
167
|
return unless xmldoc.at("//sections")
|
168
|
+
|
166
169
|
unless ins = xmldoc.at("//sections").children.first
|
167
170
|
xmldoc.at("//sections") << " "
|
168
171
|
ins = xmldoc.at("//sections").children.first
|
@@ -186,8 +189,10 @@ module Asciidoctor
|
|
186
189
|
|
187
190
|
def replace_title(doc, xpath, text, first = false)
|
188
191
|
return unless text
|
192
|
+
|
189
193
|
doc.xpath(xpath).each_with_index do |node, i|
|
190
194
|
next if first && !i.zero?
|
195
|
+
|
191
196
|
title = get_or_make_title(node)
|
192
197
|
fn = title.xpath("./fn")
|
193
198
|
fn.each { |n| n.remove }
|
@@ -196,24 +201,24 @@ module Asciidoctor
|
|
196
201
|
end
|
197
202
|
end
|
198
203
|
|
199
|
-
def sections_names_cleanup(
|
200
|
-
replace_title(
|
201
|
-
replace_title(
|
202
|
-
replace_title(
|
203
|
-
replace_title(
|
204
|
-
replace_title(
|
205
|
-
section_names_refs_cleanup(
|
206
|
-
section_names_terms_cleanup(
|
204
|
+
def sections_names_cleanup(xml)
|
205
|
+
replace_title(xml, "//clause[@type = 'scope']", @i18n&.scope)
|
206
|
+
replace_title(xml, "//preface//abstract", @i18n&.abstract)
|
207
|
+
replace_title(xml, "//foreword", @i18n&.foreword)
|
208
|
+
replace_title(xml, "//introduction", @i18n&.introduction)
|
209
|
+
replace_title(xml, "//acknowledgements", @i18n&.acknowledgements)
|
210
|
+
section_names_refs_cleanup(xml)
|
211
|
+
section_names_terms_cleanup(xml)
|
207
212
|
end
|
208
213
|
|
209
|
-
def section_names_refs_cleanup(
|
210
|
-
replace_title(
|
214
|
+
def section_names_refs_cleanup(xml)
|
215
|
+
replace_title(xml, "//references[@normative = 'true']",
|
211
216
|
@i18n&.normref, true)
|
212
|
-
replace_title(
|
217
|
+
replace_title(xml, "//references[@normative = 'false']",
|
213
218
|
@i18n&.bibliography, true)
|
214
219
|
end
|
215
220
|
|
216
|
-
NO_SYMABBR = "[.//definitions[not(@type)]]"
|
221
|
+
NO_SYMABBR = "[.//definitions[not(@type)]]".freeze
|
217
222
|
SYMABBR = "[.//definitions[@type = 'symbols']"\
|
218
223
|
"[@type = 'abbreviated_terms']]".freeze
|
219
224
|
SYMnoABBR = "[.//definitions[@type = 'symbols']"\
|
@@ -223,7 +228,8 @@ module Asciidoctor
|
|
223
228
|
|
224
229
|
def section_names_terms_cleanup(x)
|
225
230
|
replace_title(x, "//definitions[@type = 'symbols']", @i18n&.symbols)
|
226
|
-
replace_title(x, "//definitions[@type = 'abbreviated_terms']",
|
231
|
+
replace_title(x, "//definitions[@type = 'abbreviated_terms']",
|
232
|
+
@i18n&.abbrev)
|
227
233
|
replace_title(x, "//definitions[not(@type)]", @i18n&.symbolsabbrev)
|
228
234
|
replace_title(x, "//terms#{SYMnoABBR} | //clause[.//terms]#{SYMnoABBR}",
|
229
235
|
@i18n&.termsdefsymbols, true)
|
@@ -13,7 +13,7 @@ require "asciidoctor/standoc/validate"
|
|
13
13
|
require "asciidoctor/standoc/utils"
|
14
14
|
require "asciidoctor/standoc/cleanup"
|
15
15
|
require "asciidoctor/standoc/reqt"
|
16
|
-
require_relative "./macros
|
16
|
+
require_relative "./macros"
|
17
17
|
|
18
18
|
module Asciidoctor
|
19
19
|
module Standoc
|
@@ -39,6 +39,8 @@ module Asciidoctor
|
|
39
39
|
inline_macro Asciidoctor::Standoc::TermRefInlineMacro
|
40
40
|
inline_macro Asciidoctor::Standoc::IndexXrefInlineMacro
|
41
41
|
inline_macro Asciidoctor::Standoc::IndexRangeInlineMacro
|
42
|
+
inline_macro Asciidoctor::Standoc::AddMacro
|
43
|
+
inline_macro Asciidoctor::Standoc::DelMacro
|
42
44
|
block Asciidoctor::Standoc::ToDoAdmonitionBlock
|
43
45
|
treeprocessor Asciidoctor::Standoc::ToDoInlineAdmonitionBlock
|
44
46
|
block Asciidoctor::Standoc::PlantUMLBlockMacro
|
@@ -3,7 +3,7 @@ require "nokogiri"
|
|
3
3
|
require "htmlentities"
|
4
4
|
require "pathname"
|
5
5
|
require "open-uri"
|
6
|
-
require_relative "./front_contributor
|
6
|
+
require_relative "./front_contributor"
|
7
7
|
|
8
8
|
module Asciidoctor
|
9
9
|
module Standoc
|
@@ -40,6 +40,7 @@ module Asciidoctor
|
|
40
40
|
|
41
41
|
def metadata_committee(node, xml)
|
42
42
|
return unless node.attr("technical-committee")
|
43
|
+
|
43
44
|
xml.editorialgroup do |a|
|
44
45
|
committee_component("technical-committee", node, a)
|
45
46
|
end
|
@@ -47,8 +48,8 @@ module Asciidoctor
|
|
47
48
|
|
48
49
|
def metadata_ics(node, xml)
|
49
50
|
ics = node.attr("library-ics")
|
50
|
-
ics
|
51
|
-
xml.ics { |
|
51
|
+
ics&.split(/,\s*/)&.each do |i|
|
52
|
+
xml.ics { |elem| elem.code i }
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
@@ -71,15 +72,15 @@ module Asciidoctor
|
|
71
72
|
|
72
73
|
def datetypes
|
73
74
|
%w{ published accessed created implemented obsoleted
|
74
|
-
confirmed updated issued circulated unchanged received
|
75
|
-
vote-started vote-ended
|
76
|
-
}
|
75
|
+
confirmed updated issued circulated unchanged received
|
76
|
+
vote-started vote-ended }
|
77
77
|
end
|
78
78
|
|
79
79
|
def metadata_date(node, xml)
|
80
80
|
datetypes.each { |t| metadata_date1(node, xml, t) }
|
81
|
-
node.attributes.
|
81
|
+
node.attributes.each_key do |a|
|
82
82
|
next unless a == "date" || /^date_\d+$/.match(a)
|
83
|
+
|
83
84
|
type, date = node.attr(a).split(/ /, 2)
|
84
85
|
type or next
|
85
86
|
xml.date **{ type: type } do |d|
|
@@ -93,7 +94,8 @@ module Asciidoctor
|
|
93
94
|
end
|
94
95
|
|
95
96
|
def metadata_script(node, xml)
|
96
|
-
xml.script (node.attr("script") ||
|
97
|
+
xml.script (node.attr("script") ||
|
98
|
+
default_script(node.attr("language")))
|
97
99
|
end
|
98
100
|
|
99
101
|
def relaton_relations
|
@@ -114,8 +116,8 @@ module Asciidoctor
|
|
114
116
|
end
|
115
117
|
|
116
118
|
def relation_normalise(type)
|
117
|
-
type.sub(/-by$/, "By").sub(/-of$/, "Of").sub(/-from$/, "From")
|
118
|
-
sub(/-in$/, "In")
|
119
|
+
type.sub(/-by$/, "By").sub(/-of$/, "Of").sub(/-from$/, "From")
|
120
|
+
.sub(/-in$/, "In")
|
119
121
|
end
|
120
122
|
|
121
123
|
def metadata_getrelation(node, xml, type, desc = nil)
|
@@ -124,8 +126,8 @@ module Asciidoctor
|
|
124
126
|
id = d.split(/,\s*/)
|
125
127
|
xml.relation **{ type: relation_normalise(type) } do |r|
|
126
128
|
desc.nil? or r.description relation_normalise(desc)
|
127
|
-
fetch_ref(r, d, nil, {}) or r.bibitem do |b|
|
128
|
-
b.title id[1]
|
129
|
+
fetch_ref(r, d, nil, **{}) or r.bibitem do |b|
|
130
|
+
b.title id[1] || "--"
|
129
131
|
b.docidentifier id[0]
|
130
132
|
end
|
131
133
|
end
|
@@ -134,11 +136,20 @@ module Asciidoctor
|
|
134
136
|
|
135
137
|
def metadata_keywords(node, xml)
|
136
138
|
return unless node.attr("keywords")
|
137
|
-
|
139
|
+
|
140
|
+
node.attr("keywords").split(/,\s*/).each do |kw|
|
138
141
|
xml.keyword kw
|
139
142
|
end
|
140
143
|
end
|
141
144
|
|
145
|
+
def metadata_classifications(node, xml)
|
146
|
+
csv_split(node.attr("classification"), ",")&.each do |c|
|
147
|
+
vals = c.split(/:/, 2)
|
148
|
+
vals.size == 1 and vals = ["default", vals[0]]
|
149
|
+
xml.classification vals[1], type: vals[0]
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
142
153
|
def metadata(node, xml)
|
143
154
|
title node, xml
|
144
155
|
metadata_source(node, xml)
|
@@ -155,14 +166,16 @@ module Asciidoctor
|
|
155
166
|
metadata_copyright(node, xml)
|
156
167
|
metadata_relations(node, xml)
|
157
168
|
metadata_series(node, xml)
|
169
|
+
metadata_classifications(node, xml)
|
158
170
|
metadata_keywords(node, xml)
|
159
|
-
xml.ext do
|
171
|
+
xml.ext do
|
160
172
|
metadata_ext(node, xml)
|
161
173
|
end
|
162
174
|
end
|
163
175
|
|
164
176
|
def metadata_ext(node, ext)
|
165
177
|
metadata_doctype(node, ext)
|
178
|
+
metadata_subdoctype(node, ext)
|
166
179
|
metadata_committee(node, ext)
|
167
180
|
metadata_ics(node, ext)
|
168
181
|
end
|
@@ -171,11 +184,13 @@ module Asciidoctor
|
|
171
184
|
xml.doctype doctype(node)
|
172
185
|
end
|
173
186
|
|
174
|
-
def
|
187
|
+
def metadata_subdoctype(node, xml)
|
188
|
+
s = node.attr("docsubtype") and xml.subdoctype s
|
175
189
|
end
|
176
190
|
|
177
|
-
def
|
178
|
-
|
191
|
+
def metadata_note(node, xml); end
|
192
|
+
|
193
|
+
def metadata_series(node, xml); end
|
179
194
|
|
180
195
|
def title(node, xml)
|
181
196
|
title_english(node, xml)
|
@@ -187,7 +202,8 @@ module Asciidoctor
|
|
187
202
|
at = { language: lang, format: "text/plain" }
|
188
203
|
xml.title **attr_code(at) do |t|
|
189
204
|
t << (Metanorma::Utils::asciidoc_sub(node.attr("title") ||
|
190
|
-
|
205
|
+
node.attr("title-en")) ||
|
206
|
+
node.title)
|
191
207
|
end
|
192
208
|
end
|
193
209
|
end
|
@@ -196,6 +212,7 @@ module Asciidoctor
|
|
196
212
|
node.attributes.each do |k, v|
|
197
213
|
next unless /^title-(?<titlelang>.+)$/ =~ k
|
198
214
|
next if titlelang == "en"
|
215
|
+
|
199
216
|
xml.title v, { language: titlelang, format: "text/plain" }
|
200
217
|
end
|
201
218
|
end
|
@@ -21,7 +21,7 @@ module Asciidoctor
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def organization(org, orgname, node = nil, default_org = nil)
|
24
|
+
def organization(org, orgname, is_pub, node = nil, default_org = nil)
|
25
25
|
abbrevs = org_abbrev
|
26
26
|
n = abbrevs.invert[orgname] and orgname = n
|
27
27
|
org.name orgname
|
@@ -29,7 +29,7 @@ module Asciidoctor
|
|
29
29
|
abbr = org_abbrev[orgname]
|
30
30
|
default_org && b = node.attr("subdivision-abbr") and abbr = b
|
31
31
|
abbr and org.abbreviation abbr
|
32
|
-
|
32
|
+
is_pub && node and org_address(node, org)
|
33
33
|
end
|
34
34
|
|
35
35
|
def org_address(node, p)
|
@@ -59,7 +59,7 @@ module Asciidoctor
|
|
59
59
|
xml.contributor do |c|
|
60
60
|
c.role **{ type: "author" }
|
61
61
|
c.organization do |a|
|
62
|
-
organization(a, p, node, !node.attr("publisher"))
|
62
|
+
organization(a, p, false, node, !node.attr("publisher"))
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -144,7 +144,7 @@ module Asciidoctor
|
|
144
144
|
xml.contributor do |c|
|
145
145
|
c.role **{ type: "publisher" }
|
146
146
|
c.organization do |a|
|
147
|
-
organization(a, p, node, !node.attr("publisher"))
|
147
|
+
organization(a, p, true, node, !node.attr("publisher"))
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
@@ -157,7 +157,7 @@ module Asciidoctor
|
|
157
157
|
c.from (node.attr("copyright-year") || Date.today.year)
|
158
158
|
p.match(/[A-Za-z]/).nil? or c.owner do |owner|
|
159
159
|
owner.organization do |a|
|
160
|
-
organization(a, p, node, !pub)
|
160
|
+
organization(a, p, true, node, !pub)
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|