metanorma-jis 0.5.2 → 0.5.4
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/lib/isodoc/jis/base_convert.rb +2 -1
- data/lib/isodoc/jis/html/style-human.css +7 -0
- data/lib/isodoc/jis/html/style-iso.css +7 -0
- data/lib/isodoc/jis/html_convert.rb +0 -14
- data/lib/isodoc/jis/jis.international-standard.xsl +312 -77
- data/lib/isodoc/jis/presentation_list.rb +72 -0
- data/lib/isodoc/jis/presentation_xml_convert.rb +1 -53
- data/lib/isodoc/jis/table.rb +0 -12
- data/lib/isodoc/jis/word_convert.rb +0 -20
- data/lib/isodoc/jis/xref.rb +24 -71
- data/lib/metanorma/jis/basicdoc.rng +48 -35
- data/lib/metanorma/jis/biblio-standoc.rng +37 -7
- data/lib/metanorma/jis/biblio.rng +30 -18
- data/lib/metanorma/jis/isodoc.rng +126 -80
- data/lib/metanorma/jis/isostandard.rng +6 -149
- data/lib/metanorma/jis/jis.rng +0 -37
- data/lib/metanorma/jis/relaton-jis.rng +8 -16
- data/lib/metanorma/jis/reqt.rng +7 -6
- data/lib/metanorma/jis/validate.rb +2 -4
- data/lib/metanorma/jis/version.rb +1 -1
- metadata +3 -2
@@ -0,0 +1,72 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module Jis
|
3
|
+
class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
|
4
|
+
def ol_depth(node)
|
5
|
+
depth == 1 and return :alphabet
|
6
|
+
:arabic
|
7
|
+
end
|
8
|
+
|
9
|
+
def ol_depth(node)
|
10
|
+
depth = node.ancestors("ol").size + 1
|
11
|
+
@counter.ol_type(node, depth) # defined in Xref::Counter
|
12
|
+
end
|
13
|
+
|
14
|
+
def ul_label_list(_elem)
|
15
|
+
%w(- ・)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ul_label_value(elem)
|
19
|
+
depth = elem.ancestors("ul").size
|
20
|
+
val = ul_label_list(elem)
|
21
|
+
val[(depth - 1) % val.size]
|
22
|
+
end
|
23
|
+
|
24
|
+
# TODO: move the table/figure key processing to Word, not Presentation XML
|
25
|
+
def dl(docxml)
|
26
|
+
super
|
27
|
+
docxml.xpath(ns("//table//dl | //figure//dl")).each do |l|
|
28
|
+
l.at(ns("./dl")) || l.at("./ancestor::xmlns:dl") and next
|
29
|
+
dl_to_para(l)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def dt_dd?(node)
|
34
|
+
%w{dt dd}.include? node.name
|
35
|
+
end
|
36
|
+
|
37
|
+
def dl_to_para(node)
|
38
|
+
ret = dl_to_para_name(node)
|
39
|
+
ret += dl_to_para_terms(node)
|
40
|
+
node.elements.reject { |n| %w(dt dd name fmt-name).include?(n.name) }
|
41
|
+
.each do |x|
|
42
|
+
ret += x.to_xml
|
43
|
+
end
|
44
|
+
dl_id_insert(node, ret)
|
45
|
+
end
|
46
|
+
|
47
|
+
def dl_id_insert(node, ret)
|
48
|
+
a = node.replace(ret)
|
49
|
+
p = a.at("./descendant-or-self::xmlns:p")
|
50
|
+
node["id"] and p << "<bookmark id='#{node['id']}'/>"
|
51
|
+
a.xpath("./descendant-or-self::*[@id = '']").each { |x| x.delete("id") }
|
52
|
+
end
|
53
|
+
|
54
|
+
def dl_to_para_name(node)
|
55
|
+
e = node.at(ns("./fmt-name")) or return ""
|
56
|
+
node.parent.parent["type"] == "participants" and return ""
|
57
|
+
"<p class='ListTitle'>#{e.children.to_xml}</p>"
|
58
|
+
end
|
59
|
+
|
60
|
+
def dl_to_para_terms(node)
|
61
|
+
ret = ""
|
62
|
+
node.elements.select { |n| dt_dd?(n) }.each_slice(2) do |dt, dd|
|
63
|
+
term = strip_para(dt)
|
64
|
+
defn = strip_para(dd)
|
65
|
+
bkmk = dd["id"] ? "<bookmark id='#{dd['id']}'/>" : ""
|
66
|
+
ret += "<p class='dl' id='#{dt['id']}'>#{term}: #{bkmk}#{defn}</p>"
|
67
|
+
end
|
68
|
+
ret
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative "init"
|
2
2
|
require "isodoc"
|
3
3
|
require_relative "presentation_section"
|
4
|
+
require_relative "presentation_list"
|
4
5
|
require_relative "../../relaton/render-jis/general"
|
5
6
|
|
6
7
|
module IsoDoc
|
@@ -35,65 +36,12 @@ module IsoDoc
|
|
35
36
|
ret
|
36
37
|
end
|
37
38
|
|
38
|
-
def ol_depth(node)
|
39
|
-
depth = node.ancestors("ol").size + 1
|
40
|
-
depth == 1 and return :alphabet
|
41
|
-
:arabic
|
42
|
-
end
|
43
|
-
|
44
39
|
def admits(elem)
|
45
40
|
elem.xpath(ns(".//semx[@element = 'admitted']")).each do |t|
|
46
41
|
t.previous = @i18n.l10n("#{@i18n.admitted}: ")
|
47
42
|
end
|
48
43
|
end
|
49
44
|
|
50
|
-
# TODO: move the table/figure key processing to Word, not Presentation XML
|
51
|
-
def dl(docxml)
|
52
|
-
super
|
53
|
-
docxml.xpath(ns("//table//dl | //figure//dl")).each do |l|
|
54
|
-
l.at(ns("./dl")) || l.at("./ancestor::xmlns:dl") and next
|
55
|
-
dl_to_para(l)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def dt_dd?(node)
|
60
|
-
%w{dt dd}.include? node.name
|
61
|
-
end
|
62
|
-
|
63
|
-
def dl_to_para(node)
|
64
|
-
ret = dl_to_para_name(node)
|
65
|
-
ret += dl_to_para_terms(node)
|
66
|
-
node.elements.reject { |n| %w(dt dd name fmt-name).include?(n.name) }
|
67
|
-
.each do |x|
|
68
|
-
ret += x.to_xml
|
69
|
-
end
|
70
|
-
dl_id_insert(node, ret)
|
71
|
-
end
|
72
|
-
|
73
|
-
def dl_id_insert(node, ret)
|
74
|
-
a = node.replace(ret)
|
75
|
-
p = a.at("./descendant-or-self::xmlns:p")
|
76
|
-
node["id"] and p << "<bookmark id='#{node['id']}'/>"
|
77
|
-
a.xpath("./descendant-or-self::*[@id = '']").each { |x| x.delete("id") }
|
78
|
-
end
|
79
|
-
|
80
|
-
def dl_to_para_name(node)
|
81
|
-
e = node.at(ns("./fmt-name")) or return ""
|
82
|
-
node.parent.parent["type"] == "participants" and return ""
|
83
|
-
"<p class='ListTitle'>#{e.children.to_xml}</p>"
|
84
|
-
end
|
85
|
-
|
86
|
-
def dl_to_para_terms(node)
|
87
|
-
ret = ""
|
88
|
-
node.elements.select { |n| dt_dd?(n) }.each_slice(2) do |dt, dd|
|
89
|
-
term = strip_para(dt)
|
90
|
-
defn = strip_para(dd)
|
91
|
-
bkmk = dd["id"] ? "<bookmark id='#{dd['id']}'/>" : ""
|
92
|
-
ret += "<p class='dl' id='#{dt['id']}'>#{term}: #{bkmk}#{defn}</p>"
|
93
|
-
end
|
94
|
-
ret
|
95
|
-
end
|
96
|
-
|
97
45
|
def strip_para(node)
|
98
46
|
node.children.to_xml.gsub(%r{</?p( [^>]*)?>}, "")
|
99
47
|
end
|
data/lib/isodoc/jis/table.rb
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Jis
|
3
3
|
class WordConvert < IsoDoc::Iso::WordConvert
|
4
|
-
# KILL
|
5
|
-
def make_table_footnote_targetx(out, fnid, fnref)
|
6
|
-
attrs = { id: fnid, class: "TableFootnoteRef" }
|
7
|
-
out.span do |s|
|
8
|
-
s << @i18n.table_footnote
|
9
|
-
out.span **attrs do |a|
|
10
|
-
a << fnref.sub(/(?!<\))$/, ")") # TODO TO Presentation XML
|
11
|
-
end
|
12
|
-
insert_tab(s, 1)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
4
|
def table_title_parse(node, out); end
|
17
5
|
|
18
6
|
def table_attrs(node)
|
@@ -109,26 +109,6 @@ module IsoDoc
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
# KILL
|
113
|
-
def footnote_parsex(node, out)
|
114
|
-
return table_footnote_parse(node, out) if @in_table || @in_figure # &&
|
115
|
-
|
116
|
-
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
117
|
-
return seen_footnote_parse(node, out, fn) if @seen_footnote.include?(fn)
|
118
|
-
|
119
|
-
@fn_bookmarks[fn] = bookmarkid
|
120
|
-
out.span style: "mso-bookmark:_Ref#{@fn_bookmarks[fn]}" do |s|
|
121
|
-
s.a class: "FootnoteRef", "epub:type": "footnote",
|
122
|
-
href: "#ftn#{fn}" do |a|
|
123
|
-
a.sup { |sup| sup << fn }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
@in_footnote = true
|
127
|
-
@footnotes << make_generic_footnote_text(node, fn)
|
128
|
-
@in_footnote = false
|
129
|
-
@seen_footnote << fn
|
130
|
-
end
|
131
|
-
|
132
112
|
def annex(node, out)
|
133
113
|
node["commentary"] == "true" and return commentary(node, out)
|
134
114
|
amd?(node.document.root) and
|
data/lib/isodoc/jis/xref.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module IsoDoc
|
2
|
-
module
|
3
|
-
|
2
|
+
module XrefGen
|
3
|
+
module OlTypeProvider
|
4
4
|
def ol_type(list, depth)
|
5
5
|
return list["type"].to_sym if list["type"]
|
6
6
|
return :alphabet if depth == 1
|
7
|
-
|
8
7
|
@style == :japanese ? :japanese : :arabic
|
9
8
|
end
|
9
|
+
end
|
10
|
+
end
|
10
11
|
|
12
|
+
module Jis
|
13
|
+
class Counter < IsoDoc::XrefGen::Counter
|
11
14
|
def listlabel(_list, depth)
|
12
15
|
case depth
|
13
16
|
when 1 then (96 + @num).chr.to_s
|
@@ -48,13 +51,6 @@ module IsoDoc
|
|
48
51
|
@lang == "ja" ? "の" : super
|
49
52
|
end
|
50
53
|
|
51
|
-
# KILL
|
52
|
-
def subfigure_labelx(subfignum)
|
53
|
-
subfignum.zero? and return ""
|
54
|
-
sep = @lang == "ja" ? "の" : " "
|
55
|
-
"#{sep}#{(subfignum + 96).chr})"
|
56
|
-
end
|
57
|
-
|
58
54
|
def subfigure_label(subfignum)
|
59
55
|
subfignum.zero? and return
|
60
56
|
(subfignum + 96).chr
|
@@ -65,7 +61,7 @@ module IsoDoc
|
|
65
61
|
end
|
66
62
|
|
67
63
|
# taken from isodoc to override ISO
|
68
|
-
def subfigure_anchor(elem, sublabel, label, klass, container: false)
|
64
|
+
def subfigure_anchor(elem, sublabel, label, klass, container: false)
|
69
65
|
figlabel = fig_subfig_label(label, sublabel)
|
70
66
|
@anchors[elem["id"]] = anchor_struct(
|
71
67
|
figlabel, elem, @labels[klass] || klass.capitalize, klass,
|
@@ -79,26 +75,16 @@ def subfigure_anchor(elem, sublabel, label, klass, container: false)
|
|
79
75
|
end
|
80
76
|
end
|
81
77
|
|
82
|
-
# KILL
|
83
|
-
def annex_name_lblx(clause, num)
|
84
|
-
obl = "(#{@labels['inform_annex']})"
|
85
|
-
clause["obligation"] == "normative" and
|
86
|
-
obl = "(#{@labels['norm_annex']})"
|
87
|
-
title = Common::case_with_markup(@labels["annex"], "capital",
|
88
|
-
@script)
|
89
|
-
"#{title} #{num}<br/>#{obl}"
|
90
|
-
end
|
91
|
-
|
92
78
|
def annex_name_lbl(clause, num)
|
93
79
|
super.gsub(%r{</?strong>}, "")
|
94
80
|
end
|
95
81
|
|
96
|
-
def annex_name_anchors1(clause, num, level)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
end
|
82
|
+
def annex_name_anchors1(clause, num, level)
|
83
|
+
super
|
84
|
+
# undo ISO "Clause A.2" in favour of "A.2"
|
85
|
+
level == 2 and
|
86
|
+
@anchors[clause["id"]][:xref] = semx(clause, num)
|
87
|
+
end
|
102
88
|
|
103
89
|
def clause_order_main(docxml)
|
104
90
|
[
|
@@ -106,10 +92,10 @@ end
|
|
106
92
|
{ path: "//clause[@type = 'scope']" },
|
107
93
|
{ path: @klass.norm_ref_xpath },
|
108
94
|
{ path: "//sections/terms | " \
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
95
|
+
"//sections/clause[descendant::terms]" },
|
96
|
+
{ path: "//sections/definitions | " \
|
97
|
+
"//sections/clause[descendant::definitions][not(descendant::terms)]" },
|
98
|
+
{ path: @klass.middle_clause(docxml), multi: true },
|
113
99
|
]
|
114
100
|
end
|
115
101
|
|
@@ -155,12 +141,11 @@ end
|
|
155
141
|
end
|
156
142
|
|
157
143
|
def commentary_names(clause)
|
158
|
-
#require "debug" ; binding.b
|
159
144
|
preface_name_anchors(clause, 1, clause_title(clause))
|
160
145
|
clause.xpath(ns(SUBCLAUSES))
|
161
146
|
.each_with_object(clause_counter(0, {})) do |c, i|
|
162
|
-
|
163
|
-
|
147
|
+
commentary_names1(c, clause["id"], nil, i.increment(c).print, 2)
|
148
|
+
end
|
164
149
|
end
|
165
150
|
|
166
151
|
def commentary_names1(clause, root, parentnum, num, level)
|
@@ -168,9 +153,9 @@ end
|
|
168
153
|
commentary_name_anchors(clause, lbl, root, level)
|
169
154
|
clause.xpath(ns(SUBCLAUSES))
|
170
155
|
.each_with_object(clause_counter(0)) do |c, i|
|
171
|
-
|
172
|
-
|
173
|
-
|
156
|
+
commentary_names1(c, root, lbl, i.increment(c).print,
|
157
|
+
level + 1)
|
158
|
+
end
|
174
159
|
end
|
175
160
|
|
176
161
|
def commentary_name_anchors(clause, num, root, level)
|
@@ -181,44 +166,12 @@ end
|
|
181
166
|
elem: @labels["clause"] }
|
182
167
|
end
|
183
168
|
|
184
|
-
# KILL ?
|
185
|
-
def list_item_anchor_namesx(list, list_anchor, depth, prev_label,
|
186
|
-
refer_list)
|
187
|
-
c = list_counter(list["start"] ? list["start"].to_i - 1 : 0, {})
|
188
|
-
list.xpath(ns("./li")).each do |li|
|
189
|
-
bare_label, label =
|
190
|
-
list_item_value(li, c, depth,
|
191
|
-
{ list_anchor: list_anchor,
|
192
|
-
prev_label: prev_label,
|
193
|
-
refer_list: depth == 1 ? refer_list : nil })
|
194
|
-
li["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
195
|
-
@anchors[li["id"]] =
|
196
|
-
{ label: bare_label,
|
197
|
-
bare_xref: "#{bare_label})",
|
198
|
-
xref: "#{label}#{list_item_delim}", type: "listitem",
|
199
|
-
refer_list: refer_list,
|
200
|
-
container: list_anchor[:container] }
|
201
|
-
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
202
|
-
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
203
|
-
refer_list)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
# KILL
|
209
|
-
def list_anchor_names(s)
|
210
|
-
super
|
211
|
-
#require "debug"; binding.b
|
212
|
-
end
|
213
|
-
|
214
169
|
def list_item_value(entry, counter, depth, opts)
|
215
170
|
if depth > 2
|
216
|
-
|
217
|
-
|
218
|
-
s = semx(entry, label)
|
171
|
+
label = counter.increment(entry).listlabel(entry.parent, depth)
|
172
|
+
s = semx(entry, label)
|
219
173
|
base = @c.decode(opts[:prev_label].gsub(%r{<[^>]+>}, "")).split(/\)\s*/) # List a) 1.1.1
|
220
174
|
label = "#{base[-1].sub(/^の/,'')}#{clausesep}#{label}"
|
221
|
-
#[label, J=list_item_anchor_label(opts[:prev_label] + delim_wrap(clause_sep) + s, opts[:list_anchor], base[0].sub(/[\p{Zs})]+$/, ""), opts[:refer_list])]
|
222
175
|
[label, opts[:prev_label] + delim_wrap(clausesep) + s]
|
223
176
|
else
|
224
177
|
super
|
@@ -382,33 +382,7 @@ in a document (e.g. sourcecode annotations)</a:documentation>
|
|
382
382
|
<a:documentation>Block intended to capture reviewer comments about some text in the document</a:documentation>
|
383
383
|
<element name="review">
|
384
384
|
<ref name="RequiredId"/>
|
385
|
-
<
|
386
|
-
<a:documentation>The party who has offered the comment</a:documentation>
|
387
|
-
</attribute>
|
388
|
-
<optional>
|
389
|
-
<attribute name="type">
|
390
|
-
<a:documentation>The type of reviewer comment</a:documentation>
|
391
|
-
</attribute>
|
392
|
-
</optional>
|
393
|
-
<optional>
|
394
|
-
<attribute name="date">
|
395
|
-
<a:documentation>The date when the comment was made</a:documentation>
|
396
|
-
<data type="dateTime"/>
|
397
|
-
</attribute>
|
398
|
-
</optional>
|
399
|
-
<optional>
|
400
|
-
<attribute name="from">
|
401
|
-
<a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
|
402
|
-
If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
|
403
|
-
<data type="IDREF"/>
|
404
|
-
</attribute>
|
405
|
-
</optional>
|
406
|
-
<optional>
|
407
|
-
<attribute name="to">
|
408
|
-
<a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
|
409
|
-
<data type="IDREF"/>
|
410
|
-
</attribute>
|
411
|
-
</optional>
|
385
|
+
<ref name="ReviewAttributes"/>
|
412
386
|
<oneOrMore>
|
413
387
|
<ref name="paragraph">
|
414
388
|
<a:documentation>Reviewer comments content</a:documentation>
|
@@ -416,6 +390,35 @@ If not provided, the comment applies in the vicinity of the place it has been in
|
|
416
390
|
</oneOrMore>
|
417
391
|
</element>
|
418
392
|
</define>
|
393
|
+
<define name="ReviewAttributes">
|
394
|
+
<attribute name="reviewer">
|
395
|
+
<a:documentation>The party who has offered the comment</a:documentation>
|
396
|
+
</attribute>
|
397
|
+
<optional>
|
398
|
+
<attribute name="type">
|
399
|
+
<a:documentation>The type of reviewer comment</a:documentation>
|
400
|
+
</attribute>
|
401
|
+
</optional>
|
402
|
+
<optional>
|
403
|
+
<attribute name="date">
|
404
|
+
<a:documentation>The date when the comment was made</a:documentation>
|
405
|
+
<data type="dateTime"/>
|
406
|
+
</attribute>
|
407
|
+
</optional>
|
408
|
+
<optional>
|
409
|
+
<attribute name="from">
|
410
|
+
<a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
|
411
|
+
If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
|
412
|
+
<data type="IDREF"/>
|
413
|
+
</attribute>
|
414
|
+
</optional>
|
415
|
+
<optional>
|
416
|
+
<attribute name="to">
|
417
|
+
<a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
|
418
|
+
<data type="IDREF"/>
|
419
|
+
</attribute>
|
420
|
+
</optional>
|
421
|
+
</define>
|
419
422
|
<define name="NumberingAttributes">
|
420
423
|
<optional>
|
421
424
|
<attribute name="unnumbered">
|
@@ -857,6 +860,7 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
|
|
857
860
|
<define name="tr">
|
858
861
|
<a:documentation>Sequence of cells to be displayed as a row in a table</a:documentation>
|
859
862
|
<element name="tr">
|
863
|
+
<ref name="TrAttributes"/>
|
860
864
|
<oneOrMore>
|
861
865
|
<choice>
|
862
866
|
<ref name="td">
|
@@ -869,6 +873,9 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
|
|
869
873
|
</oneOrMore>
|
870
874
|
</element>
|
871
875
|
</define>
|
876
|
+
<define name="TrAttributes">
|
877
|
+
<empty/>
|
878
|
+
</define>
|
872
879
|
<define name="tr-no-id">
|
873
880
|
<a:documentation>Sequence of cells to be displayed as a row in a table: optional ID attributes recursively (for use in Relaton, metadata)</a:documentation>
|
874
881
|
<element name="tr">
|
@@ -1694,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
|
|
1694
1701
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
|
1695
1702
|
The target of a footnote is the location it is embedded in within the text</a:documentation>
|
1696
1703
|
<element name="fn">
|
1697
|
-
<
|
1698
|
-
|
1699
|
-
</attribute>
|
1700
|
-
<oneOrMore>
|
1701
|
-
<ref name="paragraph">
|
1702
|
-
<a:documentation>The content of the footnote</a:documentation>
|
1703
|
-
</ref>
|
1704
|
-
</oneOrMore>
|
1704
|
+
<ref name="FnAttributes"/>
|
1705
|
+
<ref name="FnBody"/>
|
1705
1706
|
</element>
|
1706
1707
|
</define>
|
1708
|
+
<define name="FnBody">
|
1709
|
+
<oneOrMore>
|
1710
|
+
<ref name="paragraph">
|
1711
|
+
<a:documentation>The content of the footnote</a:documentation>
|
1712
|
+
</ref>
|
1713
|
+
</oneOrMore>
|
1714
|
+
</define>
|
1715
|
+
<define name="FnAttributes">
|
1716
|
+
<attribute name="reference">
|
1717
|
+
<a:documentation>The number of the footnote, used to identify it visually</a:documentation>
|
1718
|
+
</attribute>
|
1719
|
+
</define>
|
1707
1720
|
<define name="callout">
|
1708
1721
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
|
1709
1722
|
<element name="callout">
|
@@ -1,13 +1,14 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
|
3
|
-
<!--
|
4
|
-
Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
|
5
|
-
of relaton
|
6
|
-
|
7
|
-
Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
|
8
|
-
(SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
|
9
|
-
-->
|
10
3
|
<include href="biblio.rng">
|
4
|
+
<!-- ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix -->
|
5
|
+
<!--
|
6
|
+
Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
|
7
|
+
of relaton
|
8
|
+
|
9
|
+
Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
|
10
|
+
(SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
|
11
|
+
-->
|
11
12
|
<define name="BibData">
|
12
13
|
<a:documentation>The bibliographic description of a standardisation document</a:documentation>
|
13
14
|
<ref name="StandardBibliographicItem"/>
|
@@ -91,6 +92,9 @@ a standards definition organization</a:documentation>
|
|
91
92
|
<a:documentation>Representation of the identifier for the standardisation document, giving its individual semantic components</a:documentation>
|
92
93
|
</ref>
|
93
94
|
</zeroOrMore>
|
95
|
+
<ref name="DocumentImages">
|
96
|
+
<a:documentation>Coverpage and other images to be rendered with document</a:documentation>
|
97
|
+
</ref>
|
94
98
|
</define>
|
95
99
|
<define name="doctype">
|
96
100
|
<a:documentation>Classification of the standardisation document</a:documentation>
|
@@ -268,6 +272,32 @@ and not those document components</a:documentation>
|
|
268
272
|
</optional>
|
269
273
|
</element>
|
270
274
|
</define>
|
275
|
+
<define name="DocumentImages">
|
276
|
+
<zeroOrMore>
|
277
|
+
<element name="coverpage-image">
|
278
|
+
<a:documentation>Images to be displayed on the coverpage of the document</a:documentation>
|
279
|
+
<ref name="image-no-id"/>
|
280
|
+
</element>
|
281
|
+
</zeroOrMore>
|
282
|
+
<zeroOrMore>
|
283
|
+
<element name="innercoverpage-image">
|
284
|
+
<a:documentation>Images to be displayed on the inner coverpage of the document</a:documentation>
|
285
|
+
<ref name="image-no-id"/>
|
286
|
+
</element>
|
287
|
+
</zeroOrMore>
|
288
|
+
<zeroOrMore>
|
289
|
+
<element name="tocside-image">
|
290
|
+
<a:documentation>Images to be displayed on the Table of Contents page of the document</a:documentation>
|
291
|
+
<ref name="image-no-id"/>
|
292
|
+
</element>
|
293
|
+
</zeroOrMore>
|
294
|
+
<zeroOrMore>
|
295
|
+
<element name="backpage-image">
|
296
|
+
<a:documentation>Images to be displayed on the backpage of the document</a:documentation>
|
297
|
+
<ref name="image-no-id"/>
|
298
|
+
</element>
|
299
|
+
</zeroOrMore>
|
300
|
+
</define>
|
271
301
|
<define name="StandardBibliographicItem">
|
272
302
|
<ref name="BibliographicItem"/>
|
273
303
|
<zeroOrMore>
|
@@ -1,23 +1,25 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!--
|
3
|
-
instantiations of this grammar may replace leaf strings
|
4
|
-
with more elaborated types; e.g. title (text) replaced with
|
5
|
-
title-main, title-intro, title-part; type replaced with
|
6
|
-
enum.
|
7
|
-
|
8
|
-
some renaming at leaf nodes is permissible
|
9
|
-
|
10
|
-
obligations can change both from optional to mandatory,
|
11
|
-
and from mandatory to optional; optional elements may
|
12
|
-
be omitted; freely positioned alternatives may be replaced
|
13
|
-
with strict ordering
|
14
|
-
|
15
|
-
DO NOT introduce a namespace here. We do not want a distinct namespace
|
16
|
-
for these elements, and a distinct namespace for any grammar inheriting
|
17
|
-
these elements; we just want one namespace for any child grammars
|
18
|
-
of this.
|
19
|
-
-->
|
20
2
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<!--
|
4
|
+
ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
|
5
|
+
|
6
|
+
Instantiations of this grammar may replace leaf strings
|
7
|
+
with more elaborated types; e.g. title (text) replaced with
|
8
|
+
title-main, title-intro, title-part; type replaced with
|
9
|
+
enum.
|
10
|
+
|
11
|
+
Some renaming at leaf nodes is permissible
|
12
|
+
|
13
|
+
Obligations can change both from optional to mandatory,
|
14
|
+
and from mandatory to optional; optional elements may
|
15
|
+
be omitted; freely positioned alternatives may be replaced
|
16
|
+
with strict ordering
|
17
|
+
|
18
|
+
DO NOT introduce a namespace here. We do not want a distinct namespace
|
19
|
+
for these elements, and a distinct namespace for any grammar inheriting
|
20
|
+
these elements; we just want one namespace for any child grammars
|
21
|
+
of this.
|
22
|
+
-->
|
21
23
|
<!--
|
22
24
|
https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
|
23
25
|
iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
|
@@ -1241,6 +1243,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
|
|
1241
1243
|
</define>
|
1242
1244
|
<define name="formattedref">
|
1243
1245
|
<element name="formattedref">
|
1246
|
+
<optional>
|
1247
|
+
<attribute name="format">
|
1248
|
+
<a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
|
1249
|
+
</attribute>
|
1250
|
+
</optional>
|
1244
1251
|
<oneOrMore>
|
1245
1252
|
<ref name="TextElement"/>
|
1246
1253
|
</oneOrMore>
|
@@ -1812,6 +1819,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
|
|
1812
1819
|
<a:documentation>Abstract of bibliographic item</a:documentation>
|
1813
1820
|
<element name="abstract">
|
1814
1821
|
<ref name="LocalizedStringAttributes"/>
|
1822
|
+
<optional>
|
1823
|
+
<attribute name="format">
|
1824
|
+
<a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
|
1825
|
+
</attribute>
|
1826
|
+
</optional>
|
1815
1827
|
<choice>
|
1816
1828
|
<oneOrMore>
|
1817
1829
|
<ref name="BasicBlockNoId">
|