isodoc 1.7.7 → 1.8.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/isodoc.gemspec +1 -1
- data/lib/isodoc/function/cleanup.rb +4 -0
- data/lib/isodoc/presentation_function/block.rb +0 -36
- data/lib/isodoc/presentation_function/inline.rb +2 -3
- data/lib/isodoc/presentation_function/terms.rb +179 -0
- data/lib/isodoc/presentation_xml_convert.rb +11 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +184 -176
- data/lib/isodoc/xslfo_convert.rb +9 -6
- data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
- data/lib/isodoc-yaml/i18n-de.yaml +20 -0
- data/lib/isodoc-yaml/i18n-en.yaml +20 -0
- data/lib/isodoc-yaml/i18n-es.yaml +20 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
- data/lib/metanorma/output/xslfo.rb +4 -11
- data/spec/isodoc/i18n_spec.rb +5 -5
- data/spec/isodoc/inline_spec.rb +78 -0
- data/spec/isodoc/section_spec.rb +11 -10
- data/spec/isodoc/terms_spec.rb +354 -34
- data/spec/isodoc/xref_spec.rb +4 -4
- data/spec/isodoc/xslfo_convert_spec.rb +20 -7
- metadata +6 -6
- data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -1,229 +1,237 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require_relative "./postprocess_cover"
|
3
3
|
|
4
|
-
module IsoDoc
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
4
|
+
module IsoDoc
|
5
|
+
module WordFunction
|
6
|
+
module Postprocess
|
7
|
+
# add namespaces for Word fragments
|
8
|
+
WORD_NOKOHEAD = <<~HERE.freeze
|
9
|
+
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
10
|
+
<html xmlns="http://www.w3.org/1999/xhtml"
|
11
|
+
xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"
|
12
|
+
xmlns:w="urn:schemas-microsoft-com:office:word"
|
13
|
+
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
|
14
|
+
<head> <title></title> <meta charset="UTF-8" /> </head>
|
15
|
+
<body> </body> </html>
|
16
|
+
HERE
|
17
|
+
|
18
|
+
def to_word_xhtml_fragment(xml)
|
19
|
+
doc = ::Nokogiri::XML.parse(WORD_NOKOHEAD)
|
20
|
+
::Nokogiri::XML::DocumentFragment.new(doc, xml, doc.root)
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
def table_note_cleanup(docxml)
|
24
|
+
super
|
25
|
+
# preempt html2doc putting MsoNormal there
|
26
|
+
docxml.xpath("//p[not(self::*[@class])][ancestor::*[@class = 'Note']]")
|
27
|
+
.each do |p|
|
28
|
+
p["class"] = "Note"
|
29
|
+
end
|
28
30
|
end
|
29
|
-
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
def postprocess(result, filename, dir)
|
33
|
+
filename = filename.sub(/\.doc$/, "")
|
34
|
+
header = generate_header(filename, dir)
|
35
|
+
result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
|
36
|
+
toWord(result, filename, dir, header)
|
37
|
+
@files_to_delete.each { |f| FileUtils.rm_f f }
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
40
|
+
def toWord(result, filename, dir, header)
|
41
|
+
result = from_xhtml(word_cleanup(to_xhtml(result)))
|
42
|
+
@wordstylesheet = wordstylesheet_update
|
43
|
+
Html2Doc.process(
|
44
|
+
result,
|
45
|
+
filename: filename,
|
46
|
+
imagedir: @localdir,
|
47
|
+
stylesheet: @wordstylesheet&.path,
|
48
|
+
header_file: header&.path, dir: dir,
|
49
|
+
asciimathdelims: [@openmathdelim, @closemathdelim],
|
50
|
+
liststyles: { ul: @ulstyle, ol: @olstyle }
|
51
|
+
)
|
52
|
+
header&.unlink
|
53
|
+
@wordstylesheet.unlink if @wordstylesheet.is_a?(Tempfile)
|
54
|
+
end
|
53
55
|
|
54
|
-
|
55
|
-
|
56
|
+
def wordstylesheet_update
|
57
|
+
return if @wordstylesheet.nil?
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
f = File.open(@wordstylesheet.path, "a")
|
60
|
+
@landscapestyle.empty? or f.write(@landscapestyle)
|
61
|
+
if @wordstylesheet_override && @wordstylesheet
|
62
|
+
f.write(@wordstylesheet_override.read)
|
63
|
+
@wordstylesheet_override.close
|
64
|
+
elsif @wordstylesheet_override && !@wordstylesheet
|
65
|
+
@wordstylesheet = @wordstylesheet_override
|
66
|
+
end
|
67
|
+
f.close
|
68
|
+
@wordstylesheet
|
64
69
|
end
|
65
|
-
f.close
|
66
|
-
@wordstylesheet
|
67
|
-
end
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
def word_admonition_images(docxml)
|
72
|
+
docxml.xpath("//div[@class = 'Admonition']//img").each do |i|
|
73
|
+
i["width"], i["height"] =
|
74
|
+
Html2Doc.image_resize(i, image_localfile(i), @maxheight, 300)
|
75
|
+
end
|
73
76
|
end
|
74
|
-
end
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
78
|
+
def word_cleanup(docxml)
|
79
|
+
word_annex_cleanup(docxml)
|
80
|
+
word_preface(docxml)
|
81
|
+
word_nested_tables(docxml)
|
82
|
+
word_colgroup(docxml)
|
83
|
+
word_table_align(docxml)
|
84
|
+
word_table_separator(docxml)
|
85
|
+
word_admonition_images(docxml)
|
86
|
+
word_list_continuations(docxml)
|
87
|
+
word_example_cleanup(docxml)
|
88
|
+
word_pseudocode_cleanup(docxml)
|
89
|
+
word_image_caption(docxml)
|
90
|
+
word_section_breaks(docxml)
|
91
|
+
authority_cleanup(docxml)
|
92
|
+
word_footnote_format(docxml)
|
93
|
+
docxml
|
94
|
+
end
|
93
95
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
107
|
-
(r..(r + rs - 1)).each do |y2|
|
108
|
-
(x..(x + cs - 1)).each do |x2|
|
109
|
-
cells2d[y2][x2] = 1
|
96
|
+
def word_colgroup(docxml)
|
97
|
+
cells2d = {}
|
98
|
+
docxml.xpath("//table[colgroup]").each do |t|
|
99
|
+
w = colgroup_widths(t)
|
100
|
+
t.xpath(".//tr").each_with_index { |_tr, r| cells2d[r] = {} }
|
101
|
+
t.xpath(".//tr").each_with_index do |tr, r|
|
102
|
+
tr.xpath("./td | ./th").each_with_index do |td, _i|
|
103
|
+
x = 0
|
104
|
+
rs = td&.attr("rowspan")&.to_i || 1
|
105
|
+
cs = td&.attr("colspan")&.to_i || 1
|
106
|
+
while cells2d[r][x]
|
107
|
+
x += 1
|
110
108
|
end
|
109
|
+
(r..(r + rs - 1)).each do |y2|
|
110
|
+
(x..(x + cs - 1)).each do |x2|
|
111
|
+
cells2d[y2][x2] = 1
|
112
|
+
end
|
113
|
+
end
|
114
|
+
width = (x..(x + cs - 1)).each_with_object({ width: 0 }) do |z, m|
|
115
|
+
m[:width] += w[z]
|
116
|
+
end
|
117
|
+
td["width"] = "#{width[:width]}%"
|
118
|
+
x += cs
|
111
119
|
end
|
112
|
-
width = (x..(x + cs - 1)).each_with_object({ width: 0 }) do |z, m|
|
113
|
-
m[:width] += w[z]
|
114
|
-
end
|
115
|
-
td["width"] = "#{width[:width]}%"
|
116
|
-
x += cs
|
117
120
|
end
|
118
121
|
end
|
119
122
|
end
|
120
|
-
end
|
121
123
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
124
|
+
# assume percentages
|
125
|
+
def colgroup_widths(table)
|
126
|
+
table.xpath("./colgroup/col").each_with_object([]) do |c, m|
|
127
|
+
m << c["width"].sub(/%$/, "").to_f
|
128
|
+
end
|
126
129
|
end
|
127
|
-
end
|
128
130
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
131
|
+
def word_nested_tables(docxml)
|
132
|
+
docxml.xpath("//table").each do |t|
|
133
|
+
t.xpath(".//table").reverse.each do |tt|
|
134
|
+
t.next = tt.remove
|
135
|
+
end
|
133
136
|
end
|
134
137
|
end
|
135
|
-
end
|
136
138
|
|
137
|
-
|
138
|
-
|
139
|
+
def style_update(node, css)
|
140
|
+
return unless node
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
+
node["style"] =
|
143
|
+
node["style"] ? node["style"].sub(/;?$/, ";#{css}") : css
|
144
|
+
end
|
142
145
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
146
|
+
def word_image_caption(docxml)
|
147
|
+
docxml.xpath("//p[@class = 'FigureTitle' or @class = 'SourceTitle']")
|
148
|
+
.each do |t|
|
149
|
+
if t&.previous_element&.name == "img"
|
150
|
+
img = t.previous_element
|
151
|
+
t.previous_element.swap("<p class=\'figure\'>#{img.to_xml}</p>")
|
152
|
+
end
|
153
|
+
style_update(t&.previous_element, "page-break-after:avoid;")
|
149
154
|
end
|
150
|
-
style_update(t&.previous_element, "page-break-after:avoid;")
|
151
155
|
end
|
152
|
-
end
|
153
156
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
157
|
+
def word_list_continuations(docxml)
|
158
|
+
list_add(docxml.xpath("//ul[not(ancestor::ul) and not(ancestor::ol)]"),
|
159
|
+
1)
|
160
|
+
list_add(docxml.xpath("//ol[not(ancestor::ul) and not(ancestor::ol)]"),
|
161
|
+
1)
|
162
|
+
end
|
158
163
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
+
def list_add(xpath, lvl)
|
165
|
+
xpath.each do |list|
|
166
|
+
(list.xpath(".//li") - list.xpath(".//ol//li | .//ul//li")).each do |l|
|
167
|
+
l.xpath("./p | ./div | ./table").each_with_index do |p, i|
|
168
|
+
next if i.zero?
|
164
169
|
|
165
|
-
|
170
|
+
p.wrap(%{<div class="ListContLevel#{lvl}"/>})
|
171
|
+
end
|
172
|
+
list_add(l.xpath(".//ul") - l.xpath(".//ul//ul | .//ol//ul"),
|
173
|
+
lvl + 1)
|
174
|
+
list_add(l.xpath(".//ol") - l.xpath(".//ul//ol | .//ol//ol"),
|
175
|
+
lvl + 1)
|
166
176
|
end
|
167
|
-
list_add(l.xpath(".//ul") - l.xpath(".//ul//ul | .//ol//ul"), lvl + 1)
|
168
|
-
list_add(l.xpath(".//ol") - l.xpath(".//ul//ol | .//ol//ol"), lvl + 1)
|
169
177
|
end
|
170
178
|
end
|
171
|
-
end
|
172
179
|
|
173
|
-
|
174
|
-
|
175
|
-
|
180
|
+
def word_table_align(docxml)
|
181
|
+
docxml.xpath("//td[@align]/p | //th[@align]/p").each do |p|
|
182
|
+
next if p["align"]
|
176
183
|
|
177
|
-
|
184
|
+
style_update(p, "text-align: #{p.parent['align']}")
|
185
|
+
end
|
178
186
|
end
|
179
|
-
end
|
180
187
|
|
181
|
-
|
182
|
-
|
183
|
-
|
188
|
+
def word_table_separator(docxml)
|
189
|
+
docxml.xpath("//p[@class = 'TableTitle']").each do |t|
|
190
|
+
next unless t.children.empty?
|
184
191
|
|
185
|
-
|
186
|
-
|
192
|
+
t["style"] = t["style"].sub(/;?$/, ";font-size:0pt;")
|
193
|
+
t.children = " "
|
194
|
+
end
|
187
195
|
end
|
188
|
-
end
|
189
196
|
|
190
|
-
|
197
|
+
def word_annex_cleanup(docxml); end
|
191
198
|
|
192
|
-
|
193
|
-
|
194
|
-
|
199
|
+
def word_example_cleanup(docxml)
|
200
|
+
docxml.xpath("//div[@class = 'example']//p[not(@class)]").each do |p|
|
201
|
+
p["class"] = "example"
|
202
|
+
end
|
195
203
|
end
|
196
|
-
end
|
197
204
|
|
198
|
-
|
199
|
-
|
200
|
-
|
205
|
+
def word_pseudocode_cleanup(docxml)
|
206
|
+
docxml.xpath("//div[@class = 'pseudocode']//p[not(@class)]").each do |p|
|
207
|
+
p["class"] = "pseudocode"
|
208
|
+
end
|
201
209
|
end
|
202
|
-
end
|
203
210
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
211
|
+
# applies for <div class="WordSectionN_M"><p><pagebreak/></p>...
|
212
|
+
def word_remove_pb_before_annex(docxml)
|
213
|
+
docxml.xpath("//div[p/br]").each do |d|
|
214
|
+
/^WordSection\d+_\d+$/.match(d["class"]) or next
|
215
|
+
d.elements[0].name == "p" && !d.elements[0].elements.empty? or next
|
216
|
+
d.elements[0].elements[0].name == "br" &&
|
217
|
+
d.elements[0].elements[0]["style"] ==
|
218
|
+
"mso-special-character:line-break;page-break-before:always" or next
|
219
|
+
d.elements[0].remove
|
220
|
+
end
|
213
221
|
end
|
214
|
-
end
|
215
222
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
223
|
+
def word_footnote_format(docxml)
|
224
|
+
# the content is in a[@epub:type = 'footnote']//sup, but in Word,
|
225
|
+
# we need to inject content around the autonumbered footnote reference
|
226
|
+
docxml.xpath("//a[@epub:type = 'footnote']").each do |x|
|
227
|
+
footnote_reference_format(x)
|
228
|
+
end
|
229
|
+
docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
|
230
|
+
"//span[@class = 'TableFootnoteRef']").each do |x|
|
231
|
+
table_footnote_reference_format(x)
|
232
|
+
end
|
233
|
+
docxml
|
225
234
|
end
|
226
|
-
docxml
|
227
235
|
end
|
228
236
|
end
|
229
237
|
end
|
data/lib/isodoc/xslfo_convert.rb
CHANGED
@@ -3,7 +3,7 @@ require "metanorma"
|
|
3
3
|
module IsoDoc
|
4
4
|
class XslfoPdfConvert < ::IsoDoc::Convert
|
5
5
|
MN2PDF_OPTIONS = :mn2pdf
|
6
|
-
MN2PDF_FONT_MANIFEST = :
|
6
|
+
MN2PDF_FONT_MANIFEST = :font_manifest
|
7
7
|
|
8
8
|
def initialize(options)
|
9
9
|
@format = :pdf
|
@@ -20,12 +20,15 @@ module IsoDoc
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def pdf_options(_docxml)
|
23
|
-
ret =
|
24
|
-
|
25
|
-
|
26
|
-
ret
|
23
|
+
ret = {}
|
24
|
+
font_manifest = @options.dig(MN2PDF_OPTIONS,
|
25
|
+
MN2PDF_FONT_MANIFEST) and
|
26
|
+
ret[MN2PDF_FONT_MANIFEST] = font_manifest
|
27
27
|
@aligncrosselements && !@aligncrosselements.empty? and
|
28
|
-
ret
|
28
|
+
ret["--param align-cross-elements="] =
|
29
|
+
@aligncrosselements.gsub(/,/, " ")
|
30
|
+
@baseassetpath and
|
31
|
+
ret["--param baseassetpath="] = @baseassetpath
|
29
32
|
ret
|
30
33
|
end
|
31
34
|
|
@@ -89,6 +89,28 @@ locality:
|
|
89
89
|
example: مثال
|
90
90
|
note: ملحوظة, ملاحظة
|
91
91
|
formula: معادلة
|
92
|
+
grammar_abbrevs:
|
93
|
+
masculine: مذكر
|
94
|
+
feminine: مؤ
|
95
|
+
neuter: محايد
|
96
|
+
common: خنثى
|
97
|
+
isPreposition: حرف جر
|
98
|
+
isParticiple: النعت
|
99
|
+
isAdjective: صفة
|
100
|
+
isAdverb: ظرف
|
101
|
+
isNoun: اسم
|
102
|
+
isVerb: الفعل
|
103
|
+
relatedterms:
|
104
|
+
deprecates: يهمل
|
105
|
+
supersedes: حل محل
|
106
|
+
# حل محل
|
107
|
+
narrower: أضيق
|
108
|
+
broader: أوسع
|
109
|
+
equivalent: مُعادل
|
110
|
+
compare: قارن
|
111
|
+
contrast: مضاد
|
112
|
+
# تباين
|
113
|
+
see: انظر
|
92
114
|
inflection:
|
93
115
|
فقرة:
|
94
116
|
sg: فقرة
|
@@ -93,6 +93,26 @@ locality: {
|
|
93
93
|
note: Hinweis,
|
94
94
|
formula: Formel
|
95
95
|
}
|
96
|
+
grammar_abbrevs:
|
97
|
+
masculine: mask
|
98
|
+
feminine: fem
|
99
|
+
neuter: neutr
|
100
|
+
common: gemein
|
101
|
+
isPreposition: Präp
|
102
|
+
isParticiple: Part
|
103
|
+
isAdjective: Adj
|
104
|
+
isAdverb: Adv
|
105
|
+
isNoun: Subs
|
106
|
+
isVerb: V
|
107
|
+
relatedterms:
|
108
|
+
deprecates: veraltet
|
109
|
+
supersedes: ersetzt
|
110
|
+
narrower: enger
|
111
|
+
broader: breiter
|
112
|
+
equivalent: entspricht
|
113
|
+
compare: vergleiche
|
114
|
+
contrast: dagegen
|
115
|
+
see: siehe
|
96
116
|
inflection:
|
97
117
|
Klausel:
|
98
118
|
sg: Klausel
|
@@ -99,6 +99,26 @@ locality: {
|
|
99
99
|
note: Note,
|
100
100
|
formula: Formula
|
101
101
|
}
|
102
|
+
grammar_abbrevs:
|
103
|
+
masculine: masc
|
104
|
+
feminine: fem
|
105
|
+
neuter: neut
|
106
|
+
common: common
|
107
|
+
isPreposition: prep
|
108
|
+
isParticiple: part
|
109
|
+
isAdjective: adj
|
110
|
+
isAdverb: adv
|
111
|
+
isNoun: n
|
112
|
+
isVerb: v
|
113
|
+
relatedterms:
|
114
|
+
deprecates: deprecates
|
115
|
+
supersedes: supersedes
|
116
|
+
narrower: narrower
|
117
|
+
broader: broader
|
118
|
+
equivalent: equivalent
|
119
|
+
compare: compare
|
120
|
+
contrast: contrast
|
121
|
+
see: see
|
102
122
|
inflection:
|
103
123
|
Clause:
|
104
124
|
sg: Clause
|
@@ -95,6 +95,26 @@ locality: {
|
|
95
95
|
note: Nota,
|
96
96
|
formula: Fórmula
|
97
97
|
}
|
98
|
+
grammar_abbrevs:
|
99
|
+
masculine: masc
|
100
|
+
feminine: fem
|
101
|
+
neuter: neut
|
102
|
+
common: epicen@
|
103
|
+
isPreposition: prep
|
104
|
+
isParticiple: part
|
105
|
+
isAdjective: adj
|
106
|
+
isAdverb: adv
|
107
|
+
isNoun: sust
|
108
|
+
isVerb: v
|
109
|
+
relatedterms:
|
110
|
+
deprecates: obsoleto
|
111
|
+
supersedes: reemplaza
|
112
|
+
narrower: incluye
|
113
|
+
broader: extiende
|
114
|
+
equivalent: equivalente
|
115
|
+
compare: relacionado
|
116
|
+
contrast: difiere
|
117
|
+
see: véase
|
98
118
|
inflection:
|
99
119
|
Cláusula:
|
100
120
|
sg: Cláusula
|
@@ -92,6 +92,26 @@ locality: {
|
|
92
92
|
note: Note,
|
93
93
|
formula: Formule
|
94
94
|
}
|
95
|
+
grammar_abbrevs:
|
96
|
+
masculine: masc
|
97
|
+
feminine: fem
|
98
|
+
neuter: neut
|
99
|
+
common: épicène
|
100
|
+
isPreposition: prép
|
101
|
+
isParticiple: part
|
102
|
+
isAdjective: adj
|
103
|
+
isAdverb: adv
|
104
|
+
isNoun: subst
|
105
|
+
isVerb: vb
|
106
|
+
relatedterms:
|
107
|
+
deprecates: déprécie
|
108
|
+
supersedes: remplace
|
109
|
+
narrower: plus étroit
|
110
|
+
broader: plus large
|
111
|
+
equivalent: équivalent
|
112
|
+
compare: comparez
|
113
|
+
contrast: contrastez
|
114
|
+
see: voir
|
95
115
|
inflection:
|
96
116
|
Clause:
|
97
117
|
sg: Article
|
@@ -97,7 +97,27 @@ locality: {
|
|
97
97
|
example: Пример,
|
98
98
|
note: Примечание,
|
99
99
|
formula: Формула
|
100
|
-
|
100
|
+
}
|
101
|
+
grammar_abbrevs:
|
102
|
+
masculine: муж
|
103
|
+
feminine: жен
|
104
|
+
neuter: ср
|
105
|
+
common: общего рода
|
106
|
+
isPreposition: предл
|
107
|
+
isParticiple: прич
|
108
|
+
isAdjective: прил
|
109
|
+
isAdverb: нар
|
110
|
+
isNoun: сущ
|
111
|
+
isVerb: глаг
|
112
|
+
relatedterms:
|
113
|
+
deprecates: устаревший
|
114
|
+
supersedes: заменяет
|
115
|
+
narrower: более узкий
|
116
|
+
broader: более широкий
|
117
|
+
equivalent: эквивалент
|
118
|
+
compare: наравне
|
119
|
+
contrast: противоположный
|
120
|
+
see: см.
|
101
121
|
inflection:
|
102
122
|
Пункт:
|
103
123
|
sg: Пункт
|
@@ -93,3 +93,24 @@ locality: {
|
|
93
93
|
example: 示例,
|
94
94
|
note: 注
|
95
95
|
}
|
96
|
+
grammar_abbrevs:
|
97
|
+
masculine: 男性性别
|
98
|
+
feminine: 阴性
|
99
|
+
neuter: 中性的
|
100
|
+
common: 通性
|
101
|
+
isPreposition: 介词
|
102
|
+
isParticiple: 分词
|
103
|
+
isAdjective: 形容词
|
104
|
+
isAdverb: 副词
|
105
|
+
isNoun: 名词
|
106
|
+
isVerb: 动词
|
107
|
+
relatedterms:
|
108
|
+
deprecates: 旧词
|
109
|
+
supersedes: 取替
|
110
|
+
narrower: 狭义
|
111
|
+
broader: 广义
|
112
|
+
equivalent: 同义
|
113
|
+
compare: 比较
|
114
|
+
contrast: 对比
|
115
|
+
see: 见
|
116
|
+
|
@@ -1,21 +1,14 @@
|
|
1
|
-
require
|
2
|
-
require_relative "./utils
|
1
|
+
require "mn2pdf"
|
2
|
+
require_relative "./utils"
|
3
3
|
|
4
4
|
module Metanorma
|
5
5
|
module Output
|
6
6
|
class XslfoPdf < Base
|
7
|
-
def convert(url_path, output_path, xsl_stylesheet, options =
|
7
|
+
def convert(url_path, output_path, xsl_stylesheet, options = {})
|
8
8
|
return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
|
9
9
|
|
10
|
-
Mn2pdf.convert(
|
11
|
-
end
|
12
|
-
|
13
|
-
def quote(x)
|
14
|
-
return x if /^'.*'$/.match(x)
|
15
|
-
return x if /^".*"$/.match(x)
|
16
|
-
%("#{x}")
|
10
|
+
Mn2pdf.convert(url_path, output_path, xsl_stylesheet, options)
|
17
11
|
end
|
18
12
|
end
|
19
13
|
end
|
20
14
|
end
|
21
|
-
|