asciidoctor-iso 0.0.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +2 -0
- data/.gitignore +1 -0
- data/.hound.yml +3 -0
- data/.rubocop.ribose.yml +65 -0
- data/.rubocop.tb.yml +640 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +162 -0
- data/Makefile +39 -0
- data/README.adoc +396 -59
- data/Rakefile +6 -0
- data/asciidoctor-iso.gemspec +11 -3
- data/lib/asciidoctor/iso/base.rb +122 -51
- data/lib/asciidoctor/iso/blocks.rb +119 -108
- data/lib/asciidoctor/iso/cleanup.rb +214 -0
- data/lib/asciidoctor/iso/cleanup_block.rb +157 -0
- data/lib/asciidoctor/iso/converter.rb +5 -3
- data/lib/asciidoctor/iso/front.rb +37 -28
- data/lib/asciidoctor/iso/html/header.html +184 -0
- data/lib/asciidoctor/iso/html/html_iso_intro.html +73 -0
- data/lib/asciidoctor/iso/html/html_iso_titlepage.html +31 -0
- data/lib/asciidoctor/iso/html/htmlstyle.css +67 -0
- data/lib/asciidoctor/iso/html/isodoc.css +679 -0
- data/lib/asciidoctor/iso/html/word_iso_intro.html +72 -0
- data/lib/asciidoctor/iso/html/word_iso_titlepage.html +58 -0
- data/lib/asciidoctor/iso/inline_anchor.rb +20 -26
- data/lib/asciidoctor/iso/isostandard.rnc +177 -0
- data/lib/asciidoctor/iso/isostandard.rng +1478 -0
- data/lib/asciidoctor/iso/isostandard_diff.rnc +295 -0
- data/lib/asciidoctor/iso/lists.rb +152 -109
- data/lib/asciidoctor/iso/section.rb +164 -0
- data/lib/asciidoctor/iso/table.rb +30 -27
- data/lib/asciidoctor/iso/utils.rb +61 -183
- data/lib/asciidoctor/iso/validate.make.sh +8 -0
- data/lib/asciidoctor/iso/validate.rb +195 -24
- data/lib/asciidoctor/iso/validate_style.rb +175 -0
- data/lib/asciidoctor/iso/version.rb +1 -1
- data/spec/examples/rice.adoc +45 -24
- data/spec/examples/rice.doc +17708 -0
- data/spec/examples/rice.html +1574 -1662
- data/spec/examples/rice.preview.html +1811 -0
- data/spec/examples/rice.sh +4 -0
- data/spec/examples/rice.xml +888 -62
- data/spec/examples/rice_images/rice_image1.png +0 -0
- data/spec/examples/rice_images/rice_image2.png +0 -0
- data/spec/examples/rice_images/rice_image3_1.png +0 -0
- data/spec/examples/rice_images/rice_image3_2.png +0 -0
- data/spec/examples/rice_images/rice_image3_3.png +0 -0
- metadata +135 -12
- data/grammar1.gif +0 -0
- data/grammar2.gif +0 -0
- data/grammar3.gif +0 -0
- data/grammar4.gif +0 -0
- data/lib/asciidoctor/iso/validate.rnc +0 -444
- data/lib/asciidoctor/iso/validate.rng +0 -1001
@@ -0,0 +1,214 @@
|
|
1
|
+
require "date"
|
2
|
+
require "nokogiri"
|
3
|
+
require "htmlentities"
|
4
|
+
require "json"
|
5
|
+
require "pathname"
|
6
|
+
require "open-uri"
|
7
|
+
require "pp"
|
8
|
+
require_relative "./cleanup_block.rb"
|
9
|
+
|
10
|
+
module Asciidoctor
|
11
|
+
module ISO
|
12
|
+
module Cleanup
|
13
|
+
def textcleanup(text)
|
14
|
+
text.gsub(/\s+<fn /, "<fn ")
|
15
|
+
end
|
16
|
+
|
17
|
+
def cleanup(xmldoc)
|
18
|
+
termdef_cleanup(xmldoc)
|
19
|
+
isotitle_cleanup(xmldoc)
|
20
|
+
table_cleanup(xmldoc)
|
21
|
+
formula_cleanup(xmldoc)
|
22
|
+
figure_cleanup(xmldoc)
|
23
|
+
ref_cleanup(xmldoc)
|
24
|
+
review_note_cleanup(xmldoc)
|
25
|
+
normref_cleanup(xmldoc)
|
26
|
+
xref_cleanup(xmldoc)
|
27
|
+
para_cleanup(xmldoc)
|
28
|
+
callout_cleanup(xmldoc)
|
29
|
+
origin_cleanup(xmldoc)
|
30
|
+
element_name_cleanup(xmldoc)
|
31
|
+
footnote_renumber(xmldoc)
|
32
|
+
xmldoc
|
33
|
+
end
|
34
|
+
|
35
|
+
def element_name_cleanup(xmldoc)
|
36
|
+
xmldoc.traverse { |n| n.name = n.name.gsub(/_/, "-") }
|
37
|
+
end
|
38
|
+
|
39
|
+
def callout_cleanup(xmldoc)
|
40
|
+
xmldoc.xpath("//sourcecode").each do |x|
|
41
|
+
callouts = x.elements.select { |e| e.name == "callout" }
|
42
|
+
annotations = x.elements.select { |e| e.name == "annotation" }
|
43
|
+
if callouts.size == annotations.size
|
44
|
+
callouts.each_with_index do |c, i|
|
45
|
+
c["target"] = UUIDTools::UUID.random_create
|
46
|
+
annotations[i]["id"] = c["id"]
|
47
|
+
end
|
48
|
+
else
|
49
|
+
warn "#{x["id"]}: mismatch of callouts and annotations"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def xref_cleanup(xmldoc)
|
55
|
+
reference_names(xmldoc)
|
56
|
+
xmldoc.xpath("//xref").each do |x|
|
57
|
+
#if InlineAnchor::is_refid? x["target"]
|
58
|
+
if is_refid? x["target"]
|
59
|
+
x.name = "eref"
|
60
|
+
x["bibitemid"] = x["target"]
|
61
|
+
x["citeas"] = @anchors[x["target"]][:xref]
|
62
|
+
x.delete("target")
|
63
|
+
else
|
64
|
+
x.delete("type")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def origin_cleanup(xmldoc)
|
70
|
+
xmldoc.xpath("//origin").each do |x|
|
71
|
+
x["citeas"] = @anchors[x["bibitemid"]][:xref]
|
72
|
+
n = x.next_element
|
73
|
+
if !n.nil? && n.name == "isosection"
|
74
|
+
n.name = "locality"
|
75
|
+
n["type"] = "section"
|
76
|
+
n.parent = x
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def termdef_warn(text, re, term, msg)
|
82
|
+
if re.match? text
|
83
|
+
warn "ISO style: #{term}: #{msg}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def termdef_style(xmldoc)
|
88
|
+
xmldoc.xpath("//term").each do |t|
|
89
|
+
para = t.at("./p") or return
|
90
|
+
term = t.at("preferred").text
|
91
|
+
termdef_warn(para.text, /^(the|a)\b/i, term,
|
92
|
+
"term definition starts with article")
|
93
|
+
termdef_warn(para.text, /\.$/i, term,
|
94
|
+
"term definition ends with period")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def termdef_stem_cleanup(xmldoc)
|
99
|
+
xmldoc.xpath("//termdef/p/stem").each do |a|
|
100
|
+
if a.parent.elements.size == 1
|
101
|
+
# para containing just a stem expression
|
102
|
+
t = Nokogiri::XML::Element.new("admitted", xmldoc)
|
103
|
+
parent = a.parent
|
104
|
+
t.children = a.remove
|
105
|
+
parent.replace(t)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def termdomain_cleanup(xmldoc)
|
111
|
+
xmldoc.xpath("//p/domain").each do |a|
|
112
|
+
prev = a.parent.previous
|
113
|
+
prev.next = a.remove
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def termdefinition_cleanup(xmldoc)
|
118
|
+
xmldoc.xpath("//term").each do |d|
|
119
|
+
first_child = d.at("./p | ./figure | ./formula") or return
|
120
|
+
t = Nokogiri::XML::Element.new("definition", xmldoc)
|
121
|
+
first_child.replace(t)
|
122
|
+
t << first_child.remove
|
123
|
+
d.xpath("./p | ./figure | ./formula").each do |n|
|
124
|
+
t << n.remove
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def termdef_unnest_cleanup(xmldoc)
|
130
|
+
# release termdef tags from surrounding paras
|
131
|
+
nodes = xmldoc.xpath("//p/admitted | //p/deprecates")
|
132
|
+
while !nodes.empty?
|
133
|
+
nodes[0].parent.replace(nodes[0].parent.children)
|
134
|
+
nodes = xmldoc.xpath("//p/admitted | //p/deprecates")
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def termdef_cleanup(xmldoc)
|
139
|
+
termdef_unnest_cleanup(xmldoc)
|
140
|
+
termdef_stem_cleanup(xmldoc)
|
141
|
+
termdomain_cleanup(xmldoc)
|
142
|
+
termdefinition_cleanup(xmldoc)
|
143
|
+
termdef_style(xmldoc)
|
144
|
+
end
|
145
|
+
|
146
|
+
def isotitle_cleanup(xmldoc)
|
147
|
+
# Remove italicised ISO titles
|
148
|
+
xmldoc.xpath("//isotitle").each do |a|
|
149
|
+
if a.elements.size == 1 && a.elements[0].name == "em"
|
150
|
+
a.children = a.elements[0].children
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def dl_table_cleanup(xmldoc)
|
156
|
+
# move Key dl after table footer
|
157
|
+
q = "//table/following-sibling::*[1]"\
|
158
|
+
"[self::p and normalize-space() = 'Key']"
|
159
|
+
xmldoc.xpath(q).each do |s|
|
160
|
+
if !s.next_element.nil? && s.next_element.name == "dl"
|
161
|
+
s.previous_element << s.next_element.remove
|
162
|
+
s.remove
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def ref_cleanup(xmldoc)
|
168
|
+
# move ref before p
|
169
|
+
xmldoc.xpath("//p/ref").each do |r|
|
170
|
+
parent = r.parent
|
171
|
+
parent.previous = r.remove
|
172
|
+
end
|
173
|
+
xmldoc
|
174
|
+
end
|
175
|
+
|
176
|
+
def review_note_cleanup(xmldoc)
|
177
|
+
xmldoc.xpath("//review").each do |n|
|
178
|
+
prev = n.previous_element
|
179
|
+
if !prev.nil? && prev.name == "p"
|
180
|
+
n.parent = prev
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def normref_cleanup(xmldoc)
|
186
|
+
q = "//references[title = 'Normative References']"
|
187
|
+
r = xmldoc.at(q)
|
188
|
+
r.elements.each do |n|
|
189
|
+
unless ["title", "bibitem"].include? n.name
|
190
|
+
n.remove
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
def format_ref(ref, isopub)
|
196
|
+
return "ISO #{ref}" if isopub
|
197
|
+
return "[#{ref}]" if /^\d+$/.match?(ref) && !/^\[.*\]$/.match?(ref)
|
198
|
+
ref
|
199
|
+
end
|
200
|
+
|
201
|
+
def reference_names(xmldoc)
|
202
|
+
xmldoc.xpath("//bibitem").each do |ref|
|
203
|
+
isopub = ref.at(("./publisher/affiliation[name = 'ISO']"))
|
204
|
+
docid = ref.at(("./docidentifier"))
|
205
|
+
date = ref.at(("./publisherdate"))
|
206
|
+
reference = format_ref(docid.text, isopub)
|
207
|
+
reference += ": #{date.text}" if date && isopub
|
208
|
+
@anchors[ref["id"]] = { xref: reference }
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
require "date"
|
2
|
+
require "nokogiri"
|
3
|
+
require "htmlentities"
|
4
|
+
require "json"
|
5
|
+
require "pathname"
|
6
|
+
require "open-uri"
|
7
|
+
require "pp"
|
8
|
+
|
9
|
+
module Asciidoctor
|
10
|
+
module ISO
|
11
|
+
module Cleanup
|
12
|
+
def para_cleanup(xmldoc)
|
13
|
+
xmldoc.xpath("//p[not(@id)]").each do |x|
|
14
|
+
x["id"] = Utils::anchor_or_uuid
|
15
|
+
end
|
16
|
+
xmldoc.xpath("//note[not(@id)][not(ancestor::bibitem)]"\
|
17
|
+
"[not(ancestor::table)]").each do |x|
|
18
|
+
x["id"] = Utils::anchor_or_uuid
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def dl_table_cleanup(xmldoc)
|
23
|
+
# move Key dl after table footer
|
24
|
+
q = "//table/following-sibling::*[1]"\
|
25
|
+
"[self::p and normalize-space() = 'Key']"
|
26
|
+
xmldoc.xpath(q).each do |s|
|
27
|
+
if !s.next_element.nil? && s.next_element.name == "dl"
|
28
|
+
s.previous_element << s.next_element.remove
|
29
|
+
s.remove
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def header_rows_cleanup(xmldoc)
|
35
|
+
q = "//table[@headerrows]"
|
36
|
+
xmldoc.xpath(q).each do |s|
|
37
|
+
thead = s.at("./thead")
|
38
|
+
[1..s["headerrows"].to_i].each do
|
39
|
+
row = s.at("./tbody/tr")
|
40
|
+
row.parent = thead
|
41
|
+
end
|
42
|
+
s.delete("headerrows")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def table_cleanup(xmldoc)
|
47
|
+
dl_table_cleanup(xmldoc)
|
48
|
+
notes_table_cleanup(xmldoc)
|
49
|
+
header_rows_cleanup(xmldoc)
|
50
|
+
end
|
51
|
+
|
52
|
+
def notes_table_cleanup(xmldoc)
|
53
|
+
# move notes into table
|
54
|
+
nomatches = false
|
55
|
+
until nomatches
|
56
|
+
q = "//table/following-sibling::*[1][self::note]"
|
57
|
+
nomatches = true
|
58
|
+
xmldoc.xpath(q).each do |n|
|
59
|
+
n.previous_element << n.remove
|
60
|
+
nomatches = false
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def formula_cleanup(x)
|
66
|
+
# include where definition list inside stem block
|
67
|
+
q = "//formula/following-sibling::*[1]"\
|
68
|
+
"[self::p and text() = 'where']"
|
69
|
+
x.xpath(q).each do |s|
|
70
|
+
if !s.next_element.nil? && s.next_element.name == "dl"
|
71
|
+
s.previous_element << s.next_element.remove
|
72
|
+
s.remove
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# include footnotes inside figure
|
78
|
+
def figure_footnote_cleanup(xmldoc)
|
79
|
+
nomatches = false
|
80
|
+
until nomatches
|
81
|
+
q = "//figure/following-sibling::*[1][self::p and *[1][self::fn]]"
|
82
|
+
nomatches = true
|
83
|
+
xmldoc.xpath(q).each do |s|
|
84
|
+
s.previous_element << s.first_element_child.remove
|
85
|
+
s.remove
|
86
|
+
nomatches = false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def figure_dl_cleanup(xmldoc)
|
92
|
+
# include key definition list inside figure
|
93
|
+
q = "//figure/following-sibling::*"\
|
94
|
+
"[self::p and normalize-space() = 'Key']"
|
95
|
+
xmldoc.xpath(q).each do |s|
|
96
|
+
if !s.next_element.nil? && s.next_element.name == "dl"
|
97
|
+
s.previous_element << s.next_element.remove
|
98
|
+
s.remove
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def subfigure_cleanup(xmldoc)
|
104
|
+
# examples containing only figures become subfigures of figures
|
105
|
+
nodes = xmldoc.xpath("//example/figure")
|
106
|
+
while !nodes.empty?
|
107
|
+
nodes[0].parent.name = "figure"
|
108
|
+
nodes = xmldoc.xpath("//example/figure")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def figure_cleanup(xmldoc)
|
113
|
+
figure_footnote_cleanup(xmldoc)
|
114
|
+
figure_dl_cleanup(xmldoc)
|
115
|
+
subfigure_cleanup(xmldoc)
|
116
|
+
end
|
117
|
+
|
118
|
+
def table_footnote_renumber(xmldoc)
|
119
|
+
xmldoc.xpath("//table | //figure").each do |t|
|
120
|
+
seen, i = {}, 0
|
121
|
+
t.xpath(".//fn").each do |fn|
|
122
|
+
if seen[fn.text] then outnum = seen[fn.text]
|
123
|
+
else
|
124
|
+
i += 1
|
125
|
+
outnum = i
|
126
|
+
seen[fn.text] = outnum
|
127
|
+
end
|
128
|
+
fn["reference"] = (outnum - 1 + 'a'.ord).chr
|
129
|
+
fn["table"] = true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def other_footnote_renumber(xmldoc)
|
135
|
+
seen, i = {}, 0
|
136
|
+
xmldoc.xpath("//fn | //bibitem/note").each do |fn|
|
137
|
+
unless fn["table"]
|
138
|
+
if seen[fn.text] then outnum = seen[fn.text]
|
139
|
+
else
|
140
|
+
i += 1
|
141
|
+
outnum = i
|
142
|
+
seen[fn.text] = outnum
|
143
|
+
end
|
144
|
+
fn["reference"] = outnum.to_s
|
145
|
+
end
|
146
|
+
fn.delete("table")
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def footnote_renumber(xmldoc)
|
151
|
+
table_footnote_renumber(xmldoc)
|
152
|
+
other_footnote_renumber(xmldoc)
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
require "asciidoctor"
|
2
|
-
|
3
2
|
require "asciidoctor/iso/version"
|
4
3
|
require "asciidoctor/iso/base"
|
5
4
|
require "asciidoctor/iso/front"
|
6
5
|
require "asciidoctor/iso/lists"
|
7
6
|
require "asciidoctor/iso/inline_anchor"
|
8
7
|
require "asciidoctor/iso/blocks"
|
8
|
+
require "asciidoctor/iso/section"
|
9
9
|
require "asciidoctor/iso/table"
|
10
10
|
require "asciidoctor/iso/validate"
|
11
11
|
require "asciidoctor/iso/utils"
|
12
|
+
require "asciidoctor/iso/cleanup"
|
12
13
|
|
13
14
|
module Asciidoctor
|
14
15
|
module ISO
|
@@ -23,8 +24,10 @@ module Asciidoctor
|
|
23
24
|
include ::Asciidoctor::ISO::Lists
|
24
25
|
include ::Asciidoctor::ISO::InlineAnchor
|
25
26
|
include ::Asciidoctor::ISO::Blocks
|
27
|
+
include ::Asciidoctor::ISO::Section
|
26
28
|
include ::Asciidoctor::ISO::Table
|
27
29
|
include ::Asciidoctor::ISO::Utils
|
30
|
+
include ::Asciidoctor::ISO::Cleanup
|
28
31
|
include ::Asciidoctor::ISO::Validate
|
29
32
|
|
30
33
|
register_for "iso"
|
@@ -39,10 +42,9 @@ module Asciidoctor
|
|
39
42
|
|
40
43
|
# alias_method :pass, :content
|
41
44
|
alias_method :embedded, :content
|
42
|
-
alias_method :verse, :
|
45
|
+
alias_method :verse, :quote
|
43
46
|
alias_method :literal, :content
|
44
47
|
alias_method :audio, :skip
|
45
|
-
alias_method :thematic_break, :skip
|
46
48
|
alias_method :video, :skip
|
47
49
|
alias_method :inline_button, :skip
|
48
50
|
alias_method :inline_kbd, :skip
|
@@ -11,13 +11,10 @@ module Asciidoctor
|
|
11
11
|
module Front
|
12
12
|
def metadata_id(node, xml)
|
13
13
|
xml.id do |i|
|
14
|
-
i.
|
15
|
-
**attr_code(
|
14
|
+
i.project_number node.attr("docnumber"),
|
15
|
+
**attr_code(part: node.attr("partnumber"))
|
16
16
|
if node.attr("tc-docnumber")
|
17
|
-
i.
|
18
|
-
end
|
19
|
-
if node.attr("ref-docnumber")
|
20
|
-
i.ref_documentnumber node.attr("ref-docnumber")
|
17
|
+
i.tc_document_number node.attr("tc-docnumber")
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -25,15 +22,13 @@ module Asciidoctor
|
|
25
22
|
def metadata_version(node, xml)
|
26
23
|
xml.version do |v|
|
27
24
|
v.edition node.attr("edition") if node.attr("edition")
|
28
|
-
v.
|
29
|
-
if node.attr("
|
30
|
-
v.copyright_year node.attr("copyright-year")
|
31
|
-
end
|
25
|
+
v.revision_date node.attr("revdate") if node.attr("revdate")
|
26
|
+
v.draft node.attr("draft") if node.attr("draft")
|
32
27
|
end
|
33
28
|
end
|
34
29
|
|
35
30
|
def metadata_author(node, xml)
|
36
|
-
xml.author do |a|
|
31
|
+
xml.creator **{ role: "author" } do |a|
|
37
32
|
a.technical_committee node.attr("technical-committee"),
|
38
33
|
**attr_code(number: node.attr("technical-committee-number"))
|
39
34
|
if node.attr("subcommittee")
|
@@ -48,29 +43,43 @@ module Asciidoctor
|
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
51
|
-
def
|
52
|
-
|
53
|
-
xml.
|
54
|
-
|
55
|
-
|
46
|
+
def metadata_copyright(node, xml)
|
47
|
+
from = node.attr("copyright-year") || Date.today.year
|
48
|
+
xml.copyright do |c|
|
49
|
+
c.from from
|
50
|
+
c.owner do |o|
|
51
|
+
o.affiliation "ISO"
|
52
|
+
end
|
56
53
|
end
|
57
|
-
|
54
|
+
end
|
55
|
+
|
56
|
+
def metadata_status(node, xml)
|
57
|
+
xml.status do |s|
|
58
|
+
s.stage ( node.attr("docstage") || "60" )
|
59
|
+
s.substage ( node.attr("docsubstage") || "60" )
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def metadata(node, xml)
|
64
|
+
metadata_status(node, xml)
|
65
|
+
metadata_author(node, xml)
|
58
66
|
xml.language node.attr("language")
|
67
|
+
xml.script "latn"
|
68
|
+
xml.type node.attr("doctype")
|
69
|
+
metadata_id(node, xml)
|
59
70
|
metadata_version(node, xml)
|
60
|
-
|
71
|
+
metadata_copyright(node, xml)
|
61
72
|
end
|
62
73
|
|
63
74
|
def title(node, xml)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
t.title_part node.attr("title-part-#{lang}")
|
73
|
-
end
|
75
|
+
["en", "fr"].each do |lang|
|
76
|
+
xml.title **{ language: lang } do |t|
|
77
|
+
if node.attr("title-intro-#{lang}")
|
78
|
+
t.title_intro { |t1| t1 << node.attr("title-intro-#{lang}") }
|
79
|
+
end
|
80
|
+
t.title_main { |t1| t1 << node.attr("title-main-#{lang}") }
|
81
|
+
if node.attr("title-part-#{lang}")
|
82
|
+
t.title_part node.attr("title-part-#{lang}")
|
74
83
|
end
|
75
84
|
end
|
76
85
|
end
|