isodoc 1.7.6.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +2 -2
- data/lib/isodoc/class_utils.rb +24 -1
- data/lib/isodoc/convert.rb +9 -0
- data/lib/isodoc/function/cleanup.rb +4 -0
- data/lib/isodoc/function/inline.rb +3 -5
- data/lib/isodoc/html_function/html.rb +1 -0
- data/lib/isodoc/html_function/postprocess.rb +4 -6
- data/lib/isodoc/metadata_date.rb +13 -11
- data/lib/isodoc/presentation_function/bibdata.rb +2 -2
- data/lib/isodoc/presentation_function/block.rb +0 -36
- data/lib/isodoc/presentation_function/inline.rb +14 -11
- data/lib/isodoc/presentation_function/terms.rb +223 -0
- data/lib/isodoc/presentation_xml_convert.rb +11 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +24 -14
- data/lib/isodoc/word_function/comments.rb +0 -4
- data/lib/isodoc/word_function/postprocess.rb +184 -176
- data/lib/isodoc/xref/xref_gen.rb +18 -22
- data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
- data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
- data/lib/isodoc/xslfo_convert.rb +11 -7
- data/lib/isodoc-yaml/i18n-ar.yaml +25 -0
- data/lib/isodoc-yaml/i18n-de.yaml +23 -0
- data/lib/isodoc-yaml/i18n-en.yaml +23 -0
- data/lib/isodoc-yaml/i18n-es.yaml +23 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +23 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +24 -1
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +24 -0
- data/lib/metanorma/output/xslfo.rb +4 -11
- data/spec/assets/i18n.yaml +3 -1
- data/spec/isodoc/blocks_spec.rb +14 -8
- data/spec/isodoc/i18n_spec.rb +23 -18
- data/spec/isodoc/inline_spec.rb +193 -9
- data/spec/isodoc/lists_spec.rb +344 -222
- data/spec/isodoc/section_spec.rb +23 -22
- data/spec/isodoc/table_spec.rb +71 -73
- data/spec/isodoc/terms_spec.rb +498 -124
- data/spec/isodoc/xref_numbering_spec.rb +347 -0
- data/spec/isodoc/xref_spec.rb +274 -353
- data/spec/isodoc/xslfo_convert_spec.rb +34 -9
- metadata +12 -11
- data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -1,160 +1,165 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module XrefGen
|
3
|
+
module Sections
|
4
|
+
def back_anchor_names(docxml)
|
5
|
+
i = Counter.new("@")
|
6
|
+
docxml.xpath(ns("//annex")).each do |c|
|
7
|
+
i.increment(c)
|
8
|
+
annex_names(c, i.print)
|
9
|
+
end
|
10
|
+
docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
|
11
|
+
preface_names(b)
|
12
|
+
end
|
13
|
+
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
14
|
+
reference_names(ref)
|
15
|
+
end
|
8
16
|
end
|
9
|
-
|
10
|
-
|
17
|
+
|
18
|
+
def initial_anchor_names(doc)
|
19
|
+
doc.xpath(ns("//preface/*")).each do |c|
|
20
|
+
c.element? and preface_names(c)
|
21
|
+
end
|
22
|
+
# potentially overridden in middle_section_asset_names()
|
23
|
+
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
24
|
+
n = Counter.new
|
25
|
+
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
26
|
+
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
27
|
+
n = section_names(doc.at(ns("//sections/terms | "\
|
28
|
+
"//sections/clause[descendant::terms]")), n, 1)
|
29
|
+
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
30
|
+
clause_names(doc, n)
|
31
|
+
middle_section_asset_names(doc)
|
32
|
+
termnote_anchor_names(doc)
|
33
|
+
termexample_anchor_names(doc)
|
11
34
|
end
|
12
|
-
|
13
|
-
|
35
|
+
|
36
|
+
def preface_clause_name(clause)
|
37
|
+
clause.at(ns("./title"))&.text || clause.name.capitalize
|
14
38
|
end
|
15
|
-
end
|
16
39
|
|
17
|
-
|
18
|
-
|
19
|
-
# potentially overridden in middle_section_asset_names()
|
20
|
-
sequential_asset_names(doc.xpath(ns("//preface/*")))
|
21
|
-
n = Counter.new
|
22
|
-
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
23
|
-
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
24
|
-
n = section_names(doc.at(ns("//sections/terms | "\
|
25
|
-
"//sections/clause[descendant::terms]")), n, 1)
|
26
|
-
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
27
|
-
clause_names(doc, n)
|
28
|
-
middle_section_asset_names(doc)
|
29
|
-
termnote_anchor_names(doc)
|
30
|
-
termexample_anchor_names(doc)
|
31
|
-
end
|
40
|
+
SUBCLAUSES =
|
41
|
+
"./clause | ./references | ./term | ./terms | ./definitions".freeze
|
32
42
|
|
33
|
-
|
34
|
-
clause
|
35
|
-
|
43
|
+
# in StanDoc, prefaces have no numbering; they are referenced only by title
|
44
|
+
def preface_names(clause)
|
45
|
+
return if clause.nil?
|
36
46
|
|
37
|
-
|
38
|
-
|
47
|
+
@anchors[clause["id"]] =
|
48
|
+
{ label: nil, level: 1, xref: preface_clause_name(clause),
|
49
|
+
type: "clause" }
|
50
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
51
|
+
preface_names1(c, c.at(ns("./title"))&.text,
|
52
|
+
"#{preface_clause_name(clause)}, #{i + 1}", 2)
|
53
|
+
end
|
54
|
+
end
|
39
55
|
|
40
|
-
|
41
|
-
|
42
|
-
|
56
|
+
def preface_names1(clause, title, parent_title, level)
|
57
|
+
label = title || parent_title
|
58
|
+
@anchors[clause["id"]] =
|
59
|
+
{ label: nil, level: level, xref: label, type: "clause" }
|
60
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
61
|
+
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
|
62
|
+
level + 1)
|
63
|
+
end
|
64
|
+
end
|
43
65
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
66
|
+
def middle_section_asset_names(doc)
|
67
|
+
middle_sections = "//clause[@type = 'scope'] | "\
|
68
|
+
"#{@klass.norm_ref_xpath} | "\
|
69
|
+
"//sections/terms | //preface/* | "\
|
70
|
+
"//sections/definitions | //clause[parent::sections]"
|
71
|
+
sequential_asset_names(doc.xpath(ns(middle_sections)))
|
50
72
|
end
|
51
|
-
end
|
52
73
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
58
|
-
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i + 1}",
|
59
|
-
level + 1)
|
74
|
+
def clause_names(docxml, num)
|
75
|
+
docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, _i|
|
76
|
+
section_names(c, num, 1)
|
77
|
+
end
|
60
78
|
end
|
61
|
-
end
|
62
79
|
|
63
|
-
|
64
|
-
|
65
|
-
"#{@klass.norm_ref_xpath} | "\
|
66
|
-
"//sections/terms | //preface/* | "\
|
67
|
-
"//sections/definitions | //clause[parent::sections]"
|
68
|
-
sequential_asset_names(doc.xpath(ns(middle_sections)))
|
69
|
-
end
|
80
|
+
def section_names(clause, num, lvl)
|
81
|
+
return num if clause.nil?
|
70
82
|
|
71
|
-
|
72
|
-
|
73
|
-
|
83
|
+
num.increment(clause)
|
84
|
+
@anchors[clause["id"]] =
|
85
|
+
{ label: num.print, xref: l10n("#{@labels['clause']} #{num.print}"),
|
86
|
+
level: lvl, type: "clause" }
|
87
|
+
i = Counter.new
|
88
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
89
|
+
i.increment(c)
|
90
|
+
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
91
|
+
end
|
92
|
+
num
|
74
93
|
end
|
75
|
-
end
|
76
94
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
i.increment(c)
|
87
|
-
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
95
|
+
def section_names1(clause, num, level)
|
96
|
+
@anchors[clause["id"]] =
|
97
|
+
{ label: num, level: level, xref: l10n("#{@labels['clause']} #{num}"),
|
98
|
+
type: "clause" }
|
99
|
+
i = Counter.new
|
100
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
101
|
+
i.increment(c)
|
102
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
103
|
+
end
|
88
104
|
end
|
89
|
-
num
|
90
|
-
end
|
91
105
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
i.increment(c)
|
99
|
-
section_names1(c, "#{num}.#{i.print}", level + 1)
|
106
|
+
def annex_name_lbl(clause, num)
|
107
|
+
obl = l10n("(#{@labels['inform_annex']})")
|
108
|
+
clause["obligation"] == "normative" and
|
109
|
+
obl = l10n("(#{@labels['norm_annex']})")
|
110
|
+
title = Common::case_with_markup(@labels["annex"], "capital", @script)
|
111
|
+
l10n("<strong>#{title} #{num}</strong><br/>#{obl}")
|
100
112
|
end
|
101
|
-
end
|
102
113
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
114
|
+
def single_annex_special_section(clause)
|
115
|
+
a = clause.xpath(ns("./references | ./terms | ./definitions"))
|
116
|
+
a.size == 1 or return nil
|
117
|
+
clause.xpath(ns("./clause | ./p | ./table | ./ol | ./ul | ./dl | "\
|
118
|
+
"./note | ./admonition | ./figure")).empty? or
|
119
|
+
return nil
|
120
|
+
a[0]
|
121
|
+
end
|
109
122
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
123
|
+
def annex_names(clause, num)
|
124
|
+
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
125
|
+
type: "clause", value: num.to_s, level: 1,
|
126
|
+
xref: "#{@labels['annex']} #{num}" }
|
127
|
+
if a = single_annex_special_section(clause)
|
128
|
+
annex_names1(a, num.to_s, 1)
|
129
|
+
else
|
130
|
+
i = Counter.new
|
131
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
132
|
+
i.increment(c)
|
133
|
+
annex_names1(c, "#{num}.#{i.print}", 2)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
hierarchical_asset_names(clause, num)
|
137
|
+
end
|
118
138
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
xref: "#{@labels['annex']} #{num}", level: 1 }
|
123
|
-
if a = single_annex_special_section(clause)
|
124
|
-
annex_names1(a, num.to_s, 1)
|
125
|
-
else
|
139
|
+
def annex_names1(clause, num, level)
|
140
|
+
@anchors[clause["id"]] = { xref: "#{@labels['annex']} #{num}",
|
141
|
+
label: num, level: level, type: "clause" }
|
126
142
|
i = Counter.new
|
127
143
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
128
144
|
i.increment(c)
|
129
|
-
annex_names1(c, "#{num}.#{i.print}",
|
145
|
+
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
130
146
|
end
|
131
147
|
end
|
132
|
-
hierarchical_asset_names(clause, num)
|
133
|
-
end
|
134
148
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
149
|
+
ISO_PUBLISHER_XPATH =
|
150
|
+
"./contributor[xmlns:role/@type = 'publisher']/"\
|
151
|
+
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
152
|
+
"xmlns:name = 'International Organization for Standardization' or "\
|
153
|
+
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
154
|
+
|
155
|
+
def reference_names(ref)
|
156
|
+
# isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
157
|
+
ids = @klass.bibitem_ref_code(ref)
|
158
|
+
identifiers = @klass.render_identifier(ids)
|
159
|
+
# date = ref.at(ns("./date[@type = 'published']"))
|
160
|
+
reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
|
161
|
+
@anchors[ref["id"]] = { xref: reference }
|
142
162
|
end
|
143
163
|
end
|
144
|
-
|
145
|
-
ISO_PUBLISHER_XPATH =
|
146
|
-
"./contributor[xmlns:role/@type = 'publisher']/"\
|
147
|
-
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
148
|
-
"xmlns:name = 'International Organization for Standardization' or "\
|
149
|
-
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
150
|
-
|
151
|
-
def reference_names(ref)
|
152
|
-
# isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
153
|
-
ids = @klass.bibitem_ref_code(ref)
|
154
|
-
identifiers = @klass.render_identifier(ids)
|
155
|
-
# date = ref.at(ns("./date[@type = 'published']"))
|
156
|
-
reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
|
157
|
-
@anchors[ref["id"]] = { xref: reference }
|
158
|
-
end
|
159
164
|
end
|
160
165
|
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,16 @@ module IsoDoc
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def pdf_options(_docxml)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
ret = {}
|
24
|
+
font_manifest = @options.dig(MN2PDF_OPTIONS,
|
25
|
+
MN2PDF_FONT_MANIFEST) and
|
26
|
+
ret[MN2PDF_FONT_MANIFEST] = font_manifest
|
27
|
+
@aligncrosselements && !@aligncrosselements.empty? and
|
28
|
+
ret["--param align-cross-elements="] =
|
29
|
+
@aligncrosselements.gsub(/,/, " ")
|
30
|
+
@baseassetpath and
|
31
|
+
ret["--param baseassetpath="] = @baseassetpath
|
32
|
+
ret
|
29
33
|
end
|
30
34
|
|
31
35
|
def convert(input_filename, file = nil, debug = false,
|
@@ -89,6 +89,31 @@ locality:
|
|
89
89
|
example: مثال
|
90
90
|
note: ملحوظة, ملاحظة
|
91
91
|
formula: معادلة
|
92
|
+
grammar_abbrevs:
|
93
|
+
masculine: مذكر
|
94
|
+
feminine: مؤ
|
95
|
+
neuter: محايد
|
96
|
+
common: خنثى
|
97
|
+
singular: مفرد
|
98
|
+
dual: مزدوج
|
99
|
+
plural: جمع
|
100
|
+
isPreposition: حرف جر
|
101
|
+
isParticiple: النعت
|
102
|
+
isAdjective: صفة
|
103
|
+
isAdverb: ظرف
|
104
|
+
isNoun: اسم
|
105
|
+
isVerb: الفعل
|
106
|
+
relatedterms:
|
107
|
+
deprecates: يهمل
|
108
|
+
supersedes: حل محل
|
109
|
+
# حل محل
|
110
|
+
narrower: أضيق
|
111
|
+
broader: أوسع
|
112
|
+
equivalent: مُعادل
|
113
|
+
compare: قارن
|
114
|
+
contrast: مضاد
|
115
|
+
# تباين
|
116
|
+
see: انظر
|
92
117
|
inflection:
|
93
118
|
فقرة:
|
94
119
|
sg: فقرة
|
@@ -93,6 +93,29 @@ 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
|
+
singular: Sg
|
102
|
+
dual: Dual
|
103
|
+
plural: Pl
|
104
|
+
isPreposition: Präp
|
105
|
+
isParticiple: Part
|
106
|
+
isAdjective: Adj
|
107
|
+
isAdverb: Adv
|
108
|
+
isNoun: Subs
|
109
|
+
isVerb: V
|
110
|
+
relatedterms:
|
111
|
+
deprecates: veraltet
|
112
|
+
supersedes: ersetzt
|
113
|
+
narrower: enger
|
114
|
+
broader: breiter
|
115
|
+
equivalent: entspricht
|
116
|
+
compare: vergleiche
|
117
|
+
contrast: dagegen
|
118
|
+
see: siehe
|
96
119
|
inflection:
|
97
120
|
Klausel:
|
98
121
|
sg: Klausel
|
@@ -99,6 +99,29 @@ locality: {
|
|
99
99
|
note: Note,
|
100
100
|
formula: Formula
|
101
101
|
}
|
102
|
+
grammar_abbrevs:
|
103
|
+
masculine: m
|
104
|
+
feminine: f
|
105
|
+
neuter: n
|
106
|
+
common: common
|
107
|
+
singular: sg
|
108
|
+
dual: dual
|
109
|
+
pl: pl
|
110
|
+
isPreposition: prep
|
111
|
+
isParticiple: part
|
112
|
+
isAdjective: adj
|
113
|
+
isAdverb: adv
|
114
|
+
isNoun: noun
|
115
|
+
isVerb: verb
|
116
|
+
relatedterms:
|
117
|
+
deprecates: deprecates
|
118
|
+
supersedes: supersedes
|
119
|
+
narrower: narrower
|
120
|
+
broader: broader
|
121
|
+
equivalent: equivalent
|
122
|
+
compare: compare
|
123
|
+
contrast: contrast
|
124
|
+
see: see
|
102
125
|
inflection:
|
103
126
|
Clause:
|
104
127
|
sg: Clause
|
@@ -95,6 +95,29 @@ 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
|
+
singular: sg
|
104
|
+
dual: dual
|
105
|
+
plural: pl
|
106
|
+
isPreposition: prep
|
107
|
+
isParticiple: part
|
108
|
+
isAdjective: adj
|
109
|
+
isAdverb: adv
|
110
|
+
isNoun: sust
|
111
|
+
isVerb: v
|
112
|
+
relatedterms:
|
113
|
+
deprecates: obsoleto
|
114
|
+
supersedes: reemplaza
|
115
|
+
narrower: incluye
|
116
|
+
broader: extiende
|
117
|
+
equivalent: equivalente
|
118
|
+
compare: relacionado
|
119
|
+
contrast: difiere
|
120
|
+
see: véase
|
98
121
|
inflection:
|
99
122
|
Cláusula:
|
100
123
|
sg: Cláusula
|
@@ -92,6 +92,29 @@ 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
|
+
singular: sg
|
101
|
+
dual: duel
|
102
|
+
plural: pl
|
103
|
+
isPreposition: prép
|
104
|
+
isParticiple: part
|
105
|
+
isAdjective: adj
|
106
|
+
isAdverb: adv
|
107
|
+
isNoun: subst
|
108
|
+
isVerb: vb
|
109
|
+
relatedterms:
|
110
|
+
deprecates: déprécie
|
111
|
+
supersedes: remplace
|
112
|
+
narrower: plus étroit
|
113
|
+
broader: plus large
|
114
|
+
equivalent: équivalent
|
115
|
+
compare: comparez
|
116
|
+
contrast: contrastez
|
117
|
+
see: voir
|
95
118
|
inflection:
|
96
119
|
Clause:
|
97
120
|
sg: Article
|
@@ -97,7 +97,30 @@ locality: {
|
|
97
97
|
example: Пример,
|
98
98
|
note: Примечание,
|
99
99
|
formula: Формула
|
100
|
-
|
100
|
+
}
|
101
|
+
grammar_abbrevs:
|
102
|
+
masculine: муж
|
103
|
+
feminine: жен
|
104
|
+
neuter: ср
|
105
|
+
common: общего рода
|
106
|
+
singular: ед
|
107
|
+
dual: дв
|
108
|
+
plural: мн
|
109
|
+
isPreposition: предл
|
110
|
+
isParticiple: прич
|
111
|
+
isAdjective: прил
|
112
|
+
isAdverb: нар
|
113
|
+
isNoun: сущ
|
114
|
+
isVerb: глаг
|
115
|
+
relatedterms:
|
116
|
+
deprecates: устаревший
|
117
|
+
supersedes: заменяет
|
118
|
+
narrower: более узкий
|
119
|
+
broader: более широкий
|
120
|
+
equivalent: эквивалент
|
121
|
+
compare: наравне
|
122
|
+
contrast: противоположный
|
123
|
+
see: см.
|
101
124
|
inflection:
|
102
125
|
Пункт:
|
103
126
|
sg: Пункт
|
@@ -93,3 +93,27 @@ locality: {
|
|
93
93
|
example: 示例,
|
94
94
|
note: 注
|
95
95
|
}
|
96
|
+
grammar_abbrevs:
|
97
|
+
masculine: 男性性别
|
98
|
+
feminine: 阴性
|
99
|
+
neuter: 中性的
|
100
|
+
common: 通性
|
101
|
+
singular: 单数
|
102
|
+
dual: 双
|
103
|
+
plural: 复数
|
104
|
+
isPreposition: 介词
|
105
|
+
isParticiple: 分词
|
106
|
+
isAdjective: 形容词
|
107
|
+
isAdverb: 副词
|
108
|
+
isNoun: 名词
|
109
|
+
isVerb: 动词
|
110
|
+
relatedterms:
|
111
|
+
deprecates: 旧词
|
112
|
+
supersedes: 取替
|
113
|
+
narrower: 狭义
|
114
|
+
broader: 广义
|
115
|
+
equivalent: 同义
|
116
|
+
compare: 比较
|
117
|
+
contrast: 对比
|
118
|
+
see: 见
|
119
|
+
|
@@ -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
|
-
|
data/spec/assets/i18n.yaml
CHANGED
@@ -6,12 +6,14 @@ source: SOURCE
|
|
6
6
|
modified: modified
|
7
7
|
scope: Amplekso
|
8
8
|
symbols: Simboloj kai mallongigitaj terminoj
|
9
|
-
annex:
|
9
|
+
annex: <strong>aldono</strong>
|
10
10
|
normref: Normaj citaĵoj
|
11
11
|
bibliography: Bibliografio
|
12
12
|
inform_annex: informa
|
13
13
|
all_parts: ĉiuj partoj
|
14
14
|
norm_annex: normative
|
15
|
+
figure: figur-etikedo duvorta
|
16
|
+
example: Ekzempl-etikedo Duvorta
|
15
17
|
note: NOTO
|
16
18
|
locality: {
|
17
19
|
table: Tabelo
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -809,8 +809,11 @@ RSpec.describe IsoDoc do
|
|
809
809
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
810
810
|
.convert("test", input, true)
|
811
811
|
.gsub(/</, "<")
|
812
|
-
.gsub(%r{data:application/x-msmetafile[^"']+},
|
813
|
-
|
812
|
+
.gsub(%r{data:application/x-msmetafile[^"']+},
|
813
|
+
"data:application/x-msmetafile")))
|
814
|
+
.to be_equivalent_to xmlpp(presxml
|
815
|
+
.gsub(%r{data:application/x-msmetafile[^"']+},
|
816
|
+
"data:application/x-msmetafile"))
|
814
817
|
expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
|
815
818
|
.convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
|
816
819
|
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
@@ -900,9 +903,11 @@ RSpec.describe IsoDoc do
|
|
900
903
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
901
904
|
.convert("test", input, true)
|
902
905
|
.gsub(/</, "<")
|
903
|
-
.gsub(%r{data:application/x-msmetafile[^"']+},
|
906
|
+
.gsub(%r{data:application/x-msmetafile[^"']+},
|
907
|
+
"data:application/x-msmetafile")))
|
904
908
|
.to be_equivalent_to xmlpp(presxml
|
905
|
-
.gsub(
|
909
|
+
.gsub(%r{data:application/x-msmetafile[^"']+},
|
910
|
+
"data:application/x-msmetafile"))
|
906
911
|
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
907
912
|
.convert("test", presxml, true)
|
908
913
|
.gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
|
@@ -991,9 +996,11 @@ RSpec.describe IsoDoc do
|
|
991
996
|
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
992
997
|
.convert("test", input, true)
|
993
998
|
.gsub(/</, "<")
|
994
|
-
.gsub(%r{data:application/x-msmetafile[^"']+},
|
999
|
+
.gsub(%r{data:application/x-msmetafile[^"']+},
|
1000
|
+
"data:application/x-msmetafile")))
|
995
1001
|
.to be_equivalent_to xmlpp(presxml
|
996
|
-
.gsub(
|
1002
|
+
.gsub(%r{data:application/x-msmetafile[^"']+},
|
1003
|
+
"data:application/x-msmetafile"))
|
997
1004
|
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
|
998
1005
|
.convert("test", presxml, true)
|
999
1006
|
.gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
|
@@ -2521,8 +2528,7 @@ RSpec.describe IsoDoc do
|
|
2521
2528
|
.convert("test", input, true))
|
2522
2529
|
.sub(%r{<localized-strings>.*</localized-strings>}m, "")
|
2523
2530
|
.gsub(%r{"\.\\}, '"./')
|
2524
|
-
.gsub(%r{'\.\\}, "'./")
|
2525
|
-
)
|
2531
|
+
.gsub(%r{'\.\\}, "'./"))
|
2526
2532
|
.to be_equivalent_to xmlpp(output)
|
2527
2533
|
end
|
2528
2534
|
|