isodoc 1.1.3.pre.alpha2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +1 -1
- data/lib/isodoc-yaml/i18n-en.yaml +4 -1
- data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
- data/lib/isodoc.rb +1 -0
- data/lib/isodoc/common.rb +0 -2
- data/lib/isodoc/convert.rb +49 -44
- data/lib/isodoc/function/blocks.rb +10 -22
- data/lib/isodoc/function/blocks_example_note.rb +14 -15
- data/lib/isodoc/function/cleanup.rb +5 -4
- data/lib/isodoc/function/inline.rb +6 -76
- data/lib/isodoc/function/references.rb +10 -9
- data/lib/isodoc/function/reqt.rb +12 -11
- data/lib/isodoc/function/section.rb +39 -54
- data/lib/isodoc/function/table.rb +1 -6
- data/lib/isodoc/function/terms.rb +13 -6
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/function/utils.rb +5 -4
- data/lib/isodoc/gem_tasks.rb +18 -2
- data/lib/isodoc/html_function/html.rb +0 -1
- data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -36
- data/lib/isodoc/metadata.rb +4 -3
- data/lib/isodoc/metadata_date.rb +1 -1
- data/lib/isodoc/presentation_function/block.rb +138 -0
- data/lib/isodoc/presentation_function/inline.rb +131 -0
- data/lib/isodoc/presentation_function/section.rb +46 -0
- data/lib/isodoc/presentation_xml_convert.rb +38 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +12 -8
- data/lib/isodoc/word_function/inline.rb +3 -1
- data/lib/isodoc/xref.rb +5 -3
- data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
- data/spec/assets/i18n.yaml +12 -1
- data/spec/isodoc/blocks_spec.rb +1101 -147
- data/spec/isodoc/cleanup_spec.rb +2 -2
- data/spec/isodoc/footnotes_spec.rb +2 -2
- data/spec/isodoc/i18n_spec.rb +679 -110
- data/spec/isodoc/inline_spec.rb +323 -142
- data/spec/isodoc/lists_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +1311 -1333
- data/spec/isodoc/ref_spec.rb +181 -3
- data/spec/isodoc/section_spec.rb +508 -680
- data/spec/isodoc/table_spec.rb +155 -4
- data/spec/isodoc/terms_spec.rb +111 -79
- data/spec/isodoc/xref_spec.rb +1569 -1186
- metadata +11 -8
@@ -5,7 +5,7 @@ module IsoDoc::Function
|
|
5
5
|
# references anyway; keeping here instead of in IsoDoc::Iso for now
|
6
6
|
def docid_l10n(x)
|
7
7
|
return x if x.nil?
|
8
|
-
x.gsub(/All Parts/i, @
|
8
|
+
x.gsub(/All Parts/i, @i18n.all_parts.downcase) if @i18n.all_parts
|
9
9
|
x
|
10
10
|
end
|
11
11
|
|
@@ -155,14 +155,14 @@ module IsoDoc::Function
|
|
155
155
|
|
156
156
|
def norm_ref_xpath
|
157
157
|
"//bibliography/references[@normative = 'true'] | "\
|
158
|
-
|
158
|
+
"//bibliography/clause[.//references[@normative = 'true']]"
|
159
159
|
end
|
160
160
|
|
161
161
|
def norm_ref(isoxml, out, num)
|
162
162
|
f = isoxml.at(ns(norm_ref_xpath)) or return num
|
163
163
|
out.div do |div|
|
164
164
|
num = num + 1
|
165
|
-
clause_name(num,
|
165
|
+
clause_name(num, f.at(ns("./title")), div, nil)
|
166
166
|
if f.name == "clause"
|
167
167
|
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
168
168
|
else
|
@@ -174,15 +174,18 @@ module IsoDoc::Function
|
|
174
174
|
|
175
175
|
def bibliography_xpath
|
176
176
|
"//bibliography/clause[.//references]"\
|
177
|
-
|
178
|
-
|
177
|
+
"[not(.//references[@normative = 'true'])] | "\
|
178
|
+
"//bibliography/references[@normative = 'false']"
|
179
179
|
end
|
180
180
|
|
181
181
|
def bibliography(isoxml, out)
|
182
182
|
f = isoxml.at(ns(bibliography_xpath)) || return
|
183
183
|
page_break(out)
|
184
184
|
out.div do |div|
|
185
|
-
div.h1 @bibliography_lbl, **{ class: "Section3" }
|
185
|
+
#div.h1 @bibliography_lbl, **{ class: "Section3" }
|
186
|
+
div.h1 **{class: "Section3"} do |h1|
|
187
|
+
f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
|
188
|
+
end
|
186
189
|
biblio_list(f, div, true)
|
187
190
|
end
|
188
191
|
end
|
@@ -190,9 +193,7 @@ module IsoDoc::Function
|
|
190
193
|
def bibliography_parse(node, out)
|
191
194
|
title = node&.at(ns("./title"))&.text || ""
|
192
195
|
out.div do |div|
|
193
|
-
|
194
|
-
clause_parse_title(node, div, node.at(ns("./title")), out) or
|
195
|
-
div.h2 title, **{ class: "Section3" }
|
196
|
+
clause_parse_title(node, div, node.at(ns("./title")), out, { class: "Section3" })
|
196
197
|
biblio_list(node, div, true)
|
197
198
|
end
|
198
199
|
end
|
data/lib/isodoc/function/reqt.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module IsoDoc::Function
|
2
2
|
module Blocks
|
3
3
|
def recommendation_labels(node)
|
4
|
-
[node.at(ns("./label")), node.at(ns("./title")),
|
5
|
-
@xrefs.anchor(node['id'], :label, false)]
|
4
|
+
[node.at(ns("./label")), node.at(ns("./title")), node.at(ns("./name"))]
|
6
5
|
end
|
7
6
|
|
8
|
-
def recommendation_name(node, out,
|
7
|
+
def recommendation_name(node, out, _type)
|
9
8
|
label, title, lbl = recommendation_labels(node)
|
10
9
|
out.p **{ class: "RecommendationTitle" } do |b|
|
11
|
-
|
10
|
+
lbl and lbl.children.each { |n| parse(n, b) }
|
11
|
+
b << l10n(":")
|
12
12
|
if label || title
|
13
13
|
b.br
|
14
14
|
label and label.children.each { |n| parse(n,b) }
|
@@ -21,11 +21,11 @@ module IsoDoc::Function
|
|
21
21
|
def recommendation_attributes1(node)
|
22
22
|
out = []
|
23
23
|
oblig = node["obligation"] and
|
24
|
-
out << l10n("#{@
|
24
|
+
out << l10n("#{@i18n.obligation}: #{oblig}")
|
25
25
|
subj = node&.at(ns("./subject"))&.text and
|
26
|
-
out << l10n("#{@
|
26
|
+
out << l10n("#{@i18n.subject}: #{subj}")
|
27
27
|
node.xpath(ns("./inherit")).each do |i|
|
28
|
-
out << recommendation_attr_parse(i, @
|
28
|
+
out << recommendation_attr_parse(i, @i18n.inherits)
|
29
29
|
end
|
30
30
|
node.xpath(ns("./classification")).each do |c|
|
31
31
|
line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
|
@@ -57,7 +57,8 @@ module IsoDoc::Function
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def reqt_metadata_node(n)
|
60
|
-
%w(label title subject classification tag value
|
60
|
+
%w(label title subject classification tag value
|
61
|
+
inherit name).include? n.name
|
61
62
|
end
|
62
63
|
|
63
64
|
def reqt_attrs(node, klass)
|
@@ -66,7 +67,7 @@ module IsoDoc::Function
|
|
66
67
|
|
67
68
|
def recommendation_parse(node, out)
|
68
69
|
out.div **reqt_attrs(node, "recommend") do |t|
|
69
|
-
recommendation_name(node, t, @
|
70
|
+
recommendation_name(node, t, @i18n.recommendation)
|
70
71
|
recommendation_attributes(node, out)
|
71
72
|
node.children.each do |n|
|
72
73
|
parse(n, t) unless reqt_metadata_node(n)
|
@@ -76,7 +77,7 @@ module IsoDoc::Function
|
|
76
77
|
|
77
78
|
def requirement_parse(node, out)
|
78
79
|
out.div **reqt_attrs(node, "require") do |t|
|
79
|
-
recommendation_name(node, t, @
|
80
|
+
recommendation_name(node, t, @i18n.requirement)
|
80
81
|
recommendation_attributes(node, out)
|
81
82
|
node.children.each do |n|
|
82
83
|
parse(n, t) unless reqt_metadata_node(n)
|
@@ -86,7 +87,7 @@ module IsoDoc::Function
|
|
86
87
|
|
87
88
|
def permission_parse(node, out)
|
88
89
|
out.div **reqt_attrs(node, "permission") do |t|
|
89
|
-
recommendation_name(node, t, @
|
90
|
+
recommendation_name(node, t, @i18n.permission)
|
90
91
|
recommendation_attributes(node, out)
|
91
92
|
node.children.each do |n|
|
92
93
|
parse(n, t) unless reqt_metadata_node(n)
|
@@ -8,36 +8,37 @@ module IsoDoc::Function
|
|
8
8
|
insert_tab(out, 1)
|
9
9
|
end
|
10
10
|
|
11
|
-
def inline_header_title(out, node,
|
11
|
+
def inline_header_title(out, node, title)
|
12
12
|
out.span **{ class: "zzMoveToFollowing" } do |s|
|
13
13
|
s.b do |b|
|
14
|
-
|
15
|
-
|
16
|
-
clausedelimspace(out)
|
17
|
-
end
|
18
|
-
c1&.children&.each { |c2| parse(c2, b) }
|
19
|
-
clausedelimspace(out) if /\S/.match(c1&.text)
|
14
|
+
title&.children&.each { |c2| parse(c2, b) }
|
15
|
+
clausedelimspace(out) if /\S/.match(title&.text)
|
20
16
|
end
|
21
17
|
end
|
22
18
|
end
|
23
19
|
|
24
20
|
# used for subclauses
|
25
|
-
def clause_parse_title(node, div,
|
21
|
+
def clause_parse_title(node, div, title, out, header_class = {})
|
22
|
+
return if title.nil?
|
26
23
|
if node["inline-header"] == "true"
|
27
|
-
inline_header_title(out, node,
|
24
|
+
inline_header_title(out, node, title)
|
28
25
|
else
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
depth = (title && title["depth"]) ? title["depth"] :
|
27
|
+
node.ancestors("clause, annex, terms, references, definitions, "\
|
28
|
+
"acknowledgements, introduction, foreword").size + 1
|
29
|
+
div.send "h#{depth}", **attr_code(header_class) do |h|
|
30
|
+
title&.children&.each { |c2| parse(c2, h) }
|
34
31
|
end
|
35
32
|
end
|
36
33
|
end
|
37
34
|
|
35
|
+
def clause_attrs(node)
|
36
|
+
{ id: node["id"] }
|
37
|
+
end
|
38
|
+
|
38
39
|
# used for subclauses
|
39
40
|
def clause_parse(node, out)
|
40
|
-
out.div **attr_code(
|
41
|
+
out.div **attr_code(clause_attrs(node)) do |div|
|
41
42
|
clause_parse_title(node, div, node.at(ns("./title")), out)
|
42
43
|
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
43
44
|
parse(c1, div)
|
@@ -45,13 +46,9 @@ module IsoDoc::Function
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
|
-
def clause_name(
|
49
|
+
def clause_name(_num, title, div, header_class)
|
49
50
|
header_class = {} if header_class.nil?
|
50
51
|
div.h1 **attr_code(header_class) do |h1|
|
51
|
-
if num && !@suppressheadingnumbers
|
52
|
-
h1 << "#{num}#{clausedelim}"
|
53
|
-
clausedelimspace(h1)
|
54
|
-
end
|
55
52
|
title.is_a?(String) ? h1 << title :
|
56
53
|
title&.children&.each { |c2| parse(c2, h1) }
|
57
54
|
end
|
@@ -60,9 +57,8 @@ module IsoDoc::Function
|
|
60
57
|
|
61
58
|
def clause(isoxml, out)
|
62
59
|
isoxml.xpath(ns(middle_clause)).each do |c|
|
63
|
-
out.div **attr_code(
|
64
|
-
clause_name(
|
65
|
-
c&.at(ns("./title")), s, nil)
|
60
|
+
out.div **attr_code(clause_attrs(c)) do |s|
|
61
|
+
clause_name(nil, c&.at(ns("./title")), s, nil)
|
66
62
|
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
67
63
|
parse(c1, s)
|
68
64
|
end
|
@@ -71,19 +67,20 @@ module IsoDoc::Function
|
|
71
67
|
end
|
72
68
|
|
73
69
|
def annex_name(annex, name, div)
|
70
|
+
return if name.nil?
|
74
71
|
div.h1 **{ class: "Annex" } do |t|
|
75
|
-
|
76
|
-
t.b do |b|
|
77
|
-
name&.children&.each { |c2| parse(c2, b) }
|
78
|
-
end
|
72
|
+
name.children.each { |c2| parse(c2, t) }
|
79
73
|
end
|
80
74
|
end
|
81
75
|
|
76
|
+
def annex_attrs(node)
|
77
|
+
{ id: node["id"], class: "Section3" }
|
78
|
+
end
|
79
|
+
|
82
80
|
def annex(isoxml, out)
|
83
81
|
isoxml.xpath(ns("//annex")).each do |c|
|
84
82
|
page_break(out)
|
85
|
-
out.div **attr_code(
|
86
|
-
annex_name(c, nil, s) unless c.at(ns("./title"))
|
83
|
+
out.div **attr_code(annex_attrs(c)) do |s|
|
87
84
|
c.elements.each do |c1|
|
88
85
|
if c1.name == "title" then annex_name(c, c1, s)
|
89
86
|
else
|
@@ -95,10 +92,10 @@ module IsoDoc::Function
|
|
95
92
|
end
|
96
93
|
|
97
94
|
def scope(isoxml, out, num)
|
98
|
-
f = isoxml.at(ns("//clause[
|
95
|
+
f = isoxml.at(ns("//clause[@type = 'scope']")) or return num
|
99
96
|
out.div **attr_code(id: f["id"]) do |div|
|
100
97
|
num = num + 1
|
101
|
-
clause_name(num,
|
98
|
+
clause_name(num, f&.at(ns("./title")), div, nil)
|
102
99
|
f.elements.each do |e|
|
103
100
|
parse(e, div) unless e.name == "title"
|
104
101
|
end
|
@@ -109,26 +106,11 @@ module IsoDoc::Function
|
|
109
106
|
TERM_CLAUSE = "//sections/terms | "\
|
110
107
|
"//sections/clause[descendant::terms]".freeze
|
111
108
|
|
112
|
-
def term_def_title(title)
|
113
|
-
case title&.text
|
114
|
-
when "Terms, definitions, symbols and abbreviated terms"
|
115
|
-
@labels["termsdefsymbolsabbrev"]
|
116
|
-
when "Terms, definitions and symbols"
|
117
|
-
@labels["termsdefsymbols"]
|
118
|
-
when "Terms, definitions and abbreviated terms"
|
119
|
-
@labels["termsdefabbrev"]
|
120
|
-
when "Terms and definitions"
|
121
|
-
@labels["termsdef"]
|
122
|
-
else
|
123
|
-
title
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
109
|
def terms_defs(isoxml, out, num)
|
128
110
|
f = isoxml.at(ns(TERM_CLAUSE)) or return num
|
129
111
|
out.div **attr_code(id: f["id"]) do |div|
|
130
112
|
num = num + 1
|
131
|
-
clause_name(num,
|
113
|
+
clause_name(num, f&.at(ns("./title")), div, nil)
|
132
114
|
f.elements.each do |e|
|
133
115
|
parse(e, div) unless %w{title source}.include? e.name
|
134
116
|
end
|
@@ -145,7 +127,7 @@ module IsoDoc::Function
|
|
145
127
|
f = isoxml.at(ns("//sections/definitions")) or return num
|
146
128
|
out.div **attr_code(id: f["id"], class: "Symbols") do |div|
|
147
129
|
num = num + 1
|
148
|
-
clause_name(num, f&.at(ns("./title")) || @
|
130
|
+
clause_name(num, f&.at(ns("./title")) || @i18n.symbols, div, nil)
|
149
131
|
f.elements.each do |e|
|
150
132
|
parse(e, div) unless e.name == "title"
|
151
133
|
end
|
@@ -156,7 +138,7 @@ module IsoDoc::Function
|
|
156
138
|
# subclause
|
157
139
|
def symbols_parse(isoxml, out)
|
158
140
|
isoxml.at(ns("./title")) or
|
159
|
-
isoxml.children.first.previous = "<title>#{@
|
141
|
+
isoxml.children.first.previous = "<title>#{@i18n.symbols}</title>"
|
160
142
|
clause_parse(isoxml, out)
|
161
143
|
end
|
162
144
|
|
@@ -165,7 +147,7 @@ module IsoDoc::Function
|
|
165
147
|
title_attr = { class: "IntroTitle" }
|
166
148
|
page_break(out)
|
167
149
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
168
|
-
clause_name(nil,
|
150
|
+
clause_name(nil, f.at(ns("./title")), div, { class: "IntroTitle" })
|
169
151
|
f.elements.each do |e|
|
170
152
|
parse(e, div) unless e.name == "title"
|
171
153
|
end
|
@@ -176,7 +158,9 @@ module IsoDoc::Function
|
|
176
158
|
f = isoxml.at(ns("//foreword")) || return
|
177
159
|
page_break(out)
|
178
160
|
out.div **attr_code(id: f["id"]) do |s|
|
179
|
-
|
161
|
+
clause_name(nil, f.at(ns("./title")) || @i18n.foreword, s,
|
162
|
+
{ class: "ForewordTitle" })
|
163
|
+
#s.h1(**{ class: "ForewordTitle" }) { |h1| h1 << @i18n.foreword }
|
180
164
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
181
165
|
end
|
182
166
|
end
|
@@ -197,15 +181,16 @@ module IsoDoc::Function
|
|
197
181
|
f = isoxml.at(ns("//preface/abstract")) || return
|
198
182
|
page_break(out)
|
199
183
|
out.div **attr_code(id: f["id"]) do |s|
|
200
|
-
|
184
|
+
clause_name(nil, f.at(ns("./title")), s, { class: "AbstractTitle" })
|
185
|
+
#s.h1(**{ class: "AbstractTitle" }) { |h1| h1 << @i18n.abstract }
|
201
186
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
202
187
|
end
|
203
188
|
end
|
204
189
|
|
205
190
|
def preface(isoxml, out)
|
206
191
|
title_attr = { class: "IntroTitle" }
|
207
|
-
isoxml.xpath(ns("//preface/clause | //preface/
|
208
|
-
"//preface/
|
192
|
+
isoxml.xpath(ns("//preface/clause | //preface/references | "\
|
193
|
+
"//preface/definitions | //preface/terms")).each do |f|
|
209
194
|
page_break(out)
|
210
195
|
out.div **{ class: "Section3", id: f["id"] } do |div|
|
211
196
|
clause_name(nil, f&.at(ns("./title")), div, title_attr)
|
@@ -2,13 +2,8 @@ module IsoDoc::Function
|
|
2
2
|
module Table
|
3
3
|
|
4
4
|
def table_title_parse(node, out)
|
5
|
-
name = node.at(ns("./name"))
|
6
|
-
lbl = @xrefs.anchor(node['id'], :label, false)
|
7
|
-
lbl = nil if labelled_ancestor(node)
|
8
|
-
return if name.nil? && lbl.nil?
|
5
|
+
name = node.at(ns("./name")) or return
|
9
6
|
out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
|
10
|
-
lbl.nil? or p << l10n("#{@table_lbl} #{lbl}")
|
11
|
-
name and !lbl.nil? and p << l10n(" — ")
|
12
7
|
name and name.children.each { |n| parse(n, p) }
|
13
8
|
end
|
14
9
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module IsoDoc::Function
|
2
2
|
module Terms
|
3
|
-
|
4
3
|
def definition_parse(node, out)
|
5
4
|
node.children.each { |n| parse(n, out) }
|
6
5
|
end
|
@@ -13,7 +12,7 @@ module IsoDoc::Function
|
|
13
12
|
|
14
13
|
def deprecated_term_parse(node, out)
|
15
14
|
out.p **{ class: "DeprecatedTerms", style:"text-align:left;" } do |p|
|
16
|
-
p << l10n("#{@
|
15
|
+
p << l10n("#{@i18n.deprecated}: ")
|
17
16
|
node.children.each { |c| parse(c, p) }
|
18
17
|
end
|
19
18
|
end
|
@@ -39,12 +38,19 @@ module IsoDoc::Function
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
41
|
+
def termnote_delim
|
42
|
+
l10n(": ")
|
43
|
+
end
|
44
|
+
|
42
45
|
def termnote_parse(node, out)
|
46
|
+
name = node&.at(ns("./name"))&.remove
|
43
47
|
out.div **note_attrs(node) do |div|
|
44
|
-
first = node.first_element_child
|
45
48
|
div.p do |p|
|
46
|
-
|
47
|
-
|
49
|
+
if name
|
50
|
+
name.children.each { |n| parse(n, p) }
|
51
|
+
p << termnote_delim
|
52
|
+
end
|
53
|
+
para_then_remainder(node.first_element_child, node, p, div)
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
@@ -58,8 +64,9 @@ module IsoDoc::Function
|
|
58
64
|
end
|
59
65
|
|
60
66
|
def termdef_parse(node, out)
|
67
|
+
name = node&.at(ns("./name"))&.remove
|
61
68
|
out.p **{ class: "TermNum", id: node["id"] } do |p|
|
62
|
-
p
|
69
|
+
name&.children&.each { |n| parse(n, p) }
|
63
70
|
end
|
64
71
|
set_termdomain("")
|
65
72
|
node.children.each { |n| parse(n, out) }
|
@@ -220,6 +220,7 @@ module IsoDoc::Function
|
|
220
220
|
when "feedback-statement" then feedback_parse(node, out)
|
221
221
|
when "passthrough" then passthrough_parse(node, out)
|
222
222
|
when "variant" then variant_parse(node, out)
|
223
|
+
when "tab" then clausedelimspace(out) # in Presentation XML only
|
223
224
|
else
|
224
225
|
error_parse(node, out)
|
225
226
|
end
|
@@ -11,7 +11,8 @@ module IsoDoc::Function
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def insert_tab(out, n)
|
14
|
-
|
14
|
+
tab = %w(Hans Hant).include?(@script) ? " " : " "
|
15
|
+
[1..n].each { out << tab }
|
15
16
|
end
|
16
17
|
|
17
18
|
# add namespaces for Word fragments
|
@@ -99,8 +100,8 @@ module IsoDoc::Function
|
|
99
100
|
return '' if array.nil? || array.empty?
|
100
101
|
if array.length == 1 then array[0]
|
101
102
|
else
|
102
|
-
|
103
|
-
|
103
|
+
@i18n.l10n("#{array[0..-2].join(', ')} "\
|
104
|
+
"#{@i18n.and} #{array.last}",
|
104
105
|
@lang, @script)
|
105
106
|
end
|
106
107
|
end
|
@@ -153,7 +154,7 @@ module IsoDoc::Function
|
|
153
154
|
.get
|
154
155
|
.merge(@labels || {})
|
155
156
|
.merge(@meta.labels || {})
|
156
|
-
.merge(
|
157
|
+
.merge(fonts_options || {})
|
157
158
|
template = liquid(docxml)
|
158
159
|
template.render(meta.map { |k, v| [k.to_s, empty2nil(v)] }.to_h)
|
159
160
|
.gsub('<', '<').gsub('>', '>').gsub('&', '&')
|
data/lib/isodoc/gem_tasks.rb
CHANGED
@@ -16,7 +16,7 @@ module IsoDoc
|
|
16
16
|
puts(current_task)
|
17
17
|
compile_scss_task(current_task)
|
18
18
|
rescue StandardError => e
|
19
|
-
|
19
|
+
notify_borken_compilation(e, current_task)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -42,6 +42,17 @@ module IsoDoc
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def notify_borken_compilation(error, current_task)
|
46
|
+
puts("Cannot compile #{current_task} because of #{error.message}")
|
47
|
+
puts('continue anyway[y|n]?')
|
48
|
+
answer = STDIN.gets.strip
|
49
|
+
if %w[y yes].include?(answer.strip.downcase)
|
50
|
+
puts("Cannot compile #{current_task} because of #{error.message}")
|
51
|
+
else
|
52
|
+
exit(0)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
45
56
|
def git_cache_compiled_files
|
46
57
|
CLEAN.each do |css_file|
|
47
58
|
sh "git add #{css_file}"
|
@@ -92,7 +103,12 @@ module IsoDoc
|
|
92
103
|
def compile_scss(filename)
|
93
104
|
require 'sassc'
|
94
105
|
|
95
|
-
[
|
106
|
+
isodoc_path = if Gem.loaded_specs['isodoc']
|
107
|
+
File.join(Gem.loaded_specs['isodoc'].full_gem_path, 'lib', 'isodoc')
|
108
|
+
else
|
109
|
+
File.join('lib', 'isodoc')
|
110
|
+
end
|
111
|
+
[isodoc_path,
|
96
112
|
File.dirname(filename)].each do |name|
|
97
113
|
SassC.load_paths << name
|
98
114
|
end
|