isodoc 1.6.6 → 1.7.1
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-yaml/i18n-ar.yaml +19 -25
- data/lib/isodoc-yaml/i18n-de.yaml +1 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/convert.rb +1 -1
- data/lib/isodoc/function/blocks.rb +5 -5
- data/lib/isodoc/function/form.rb +39 -36
- data/lib/isodoc/function/inline.rb +5 -1
- data/lib/isodoc/function/references.rb +1 -1
- data/lib/isodoc/html_function/form.rb +48 -45
- data/lib/isodoc/html_function/html.rb +2 -0
- data/lib/isodoc/html_function/postprocess.rb +9 -4
- data/lib/isodoc/html_function/sectionsplit.rb +18 -4
- data/lib/isodoc/presentation_function/bibdata.rb +7 -0
- data/lib/isodoc/presentation_function/block.rb +7 -4
- data/lib/isodoc/presentation_function/inline.rb +29 -12
- data/lib/isodoc/presentation_function/section.rb +1 -3
- data/lib/isodoc/presentation_xml_convert.rb +3 -3
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref.rb +8 -7
- data/lib/isodoc/xref/xref_anchor.rb +45 -44
- data/lib/isodoc/xref/xref_counter.rb +113 -103
- data/lib/isodoc/xref/xref_gen.rb +39 -11
- data/spec/isodoc/form_spec.rb +94 -90
- data/spec/isodoc/inline_spec.rb +431 -234
- data/spec/isodoc/postproc_spec.rb +68 -25
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/xref_spec.rb +274 -652
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b64ad76ffcf7c9f1ced2c15c41a263e49e62cfa4294d31066ba2e358e613fb35
|
4
|
+
data.tar.gz: f35ca08d240ae7cdb7ba9aa0c9e071ec284d051f0d61c82542d461e101d0da38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3062ddc15478efad6f25fb39e37689fecab84750b34c2496f5693af1b52c864053f50acf3af141d876e8cb8d2d19f89ecdd19e630ab1b1da9e953e897f2ab68a
|
7
|
+
data.tar.gz: 14d688526a710b92cf2256e49df75e4abcf5a67ed7de40e6593cedf1a99e96561ba5024398ae7c767d78a4e0d74e18df344423cfbc83dd75e2afa28beeea0006
|
@@ -18,29 +18,23 @@ clause: فقرة
|
|
18
18
|
annex: ملحق
|
19
19
|
appendix: تذييل
|
20
20
|
no_terms_boilerplate: |
|
21
|
-
<p
|
21
|
+
<p>لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.</p>
|
22
22
|
internal_terms_boilerplate: |
|
23
|
-
<p
|
24
|
-
the following terms and definitions apply.</p>
|
23
|
+
<p>لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.</p>
|
25
24
|
norm_with_refs_pref:
|
26
|
-
|
27
|
-
that some or all of their content constitutes requirements of this
|
28
|
-
document. For dated references, only the edition cited applies.
|
29
|
-
For undated references, the latest edition of the referenced
|
30
|
-
document (including any amendments) applies.
|
25
|
+
تتم الإشارة إلى المستندات التالية في النص بحيث يشكل بعض أو كل محتوياتها متطلبات هذا المستند. للحصول على مراجع مؤرخة، تطبق النسخة المشار إليها فقط. بالنسبة للمراجع غير المؤرخة ، تنطبق أحدث طبعة من الوثيقة المشار إليها (بما في ذلك أي تعديلات).
|
31
26
|
norm_empty_pref:
|
32
|
-
|
27
|
+
لا توجد مراجع معيارية في هذه الوثيقة.
|
33
28
|
external_terms_boilerplate: |
|
34
|
-
<p>
|
35
|
-
the terms and definitions given in % apply.</p>
|
29
|
+
<p> لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%. </ p>
|
36
30
|
internal_external_terms_boilerplate: |
|
37
|
-
<p
|
38
|
-
|
39
|
-
term_defined_in: "[term defined in %]"
|
31
|
+
<p>لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.</p>
|
32
|
+
term_defined_in: "[المصطلح المحدد في %]"
|
40
33
|
note: ملاحظة
|
41
34
|
note_xref: ملاحظة
|
42
|
-
termnote:
|
35
|
+
termnote: ملاحظة % للقيد
|
43
36
|
list: قائمة
|
37
|
+
deflist: قائمة تعريف
|
44
38
|
figure: شكل
|
45
39
|
formula: معادلة
|
46
40
|
inequality: عدم مساواة
|
@@ -48,16 +42,16 @@ table: جدول
|
|
48
42
|
requirement: مطلب
|
49
43
|
recommendation: توصية
|
50
44
|
permission: إذن
|
51
|
-
key:
|
45
|
+
key: مفتاح
|
52
46
|
example: مثال
|
53
47
|
example_xref: مثال
|
54
48
|
where: حيث
|
55
49
|
wholeoftext: كامل النص
|
56
|
-
draft_label:
|
57
|
-
inform_annex:
|
58
|
-
norm_annex:
|
50
|
+
draft_label: مسودة
|
51
|
+
inform_annex: إخباري
|
52
|
+
norm_annex: مقياسي
|
59
53
|
modified: معدلة
|
60
|
-
deprecated:
|
54
|
+
deprecated: مهمل
|
61
55
|
source: مصدر
|
62
56
|
and: و
|
63
57
|
all_parts: كل الأجزاء
|
@@ -78,8 +72,8 @@ subject: موضوع
|
|
78
72
|
inherits: يرث
|
79
73
|
admonition:
|
80
74
|
danger: خطر
|
81
|
-
warning:
|
82
|
-
caution:
|
75
|
+
warning: تحذير
|
76
|
+
caution: حذر
|
83
77
|
important: مهم
|
84
78
|
safety precautions: احتياطات السلامة
|
85
79
|
locality:
|
@@ -108,9 +102,9 @@ inflection:
|
|
108
102
|
ملاحظة:
|
109
103
|
sg: ملاحظة
|
110
104
|
pl: ملاحظات
|
111
|
-
"
|
112
|
-
sg:
|
113
|
-
pl:
|
105
|
+
"ملاحظة % للقيد":
|
106
|
+
sg: ملاحظة % للقيد
|
107
|
+
pl: ملاحظات % للقيد
|
114
108
|
قائمة:
|
115
109
|
sg: قائمة
|
116
110
|
pl: قوائم
|
data/lib/isodoc/convert.rb
CHANGED
@@ -145,7 +145,7 @@ module IsoDoc
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def convert_init(file, input_filename, debug)
|
148
|
-
docxml = Nokogiri::XML(file)
|
148
|
+
docxml = Nokogiri::XML(file) { |config| config.huge }
|
149
149
|
filename, dir = init_file(input_filename, debug)
|
150
150
|
docxml.root.default_namespace = ""
|
151
151
|
lang = docxml&.at(ns("//bibdata/language"))&.text and @lang = lang
|
@@ -23,7 +23,7 @@ module IsoDoc::Function
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def figure_key(out)
|
26
|
-
out.p **{ style: "page-break-after:avoid;"} do |p|
|
26
|
+
out.p **{ style: "page-break-after:avoid;" } do |p|
|
27
27
|
p.b { |b| b << @i18n.key }
|
28
28
|
end
|
29
29
|
end
|
@@ -61,7 +61,7 @@ module IsoDoc::Function
|
|
61
61
|
@in_figure = false
|
62
62
|
end
|
63
63
|
|
64
|
-
def sourcecode_name_parse(
|
64
|
+
def sourcecode_name_parse(_node, div, name)
|
65
65
|
return if name.nil?
|
66
66
|
|
67
67
|
div.p **{ class: "SourceTitle", style: "text-align:center;" } do |p|
|
@@ -143,7 +143,7 @@ module IsoDoc::Function
|
|
143
143
|
|
144
144
|
def formula_parse1(node, out)
|
145
145
|
out.div **attr_code(class: "formula") do |div|
|
146
|
-
div.p do |
|
146
|
+
div.p do |_p|
|
147
147
|
parse(node.at(ns("./stem")), div)
|
148
148
|
if lbl = node&.at(ns("./name"))&.text
|
149
149
|
insert_tab(div, 1)
|
@@ -219,13 +219,13 @@ module IsoDoc::Function
|
|
219
219
|
|
220
220
|
def passthrough_parse(node, out)
|
221
221
|
return if node["format"] &&
|
222
|
-
!(node["format"].split(
|
222
|
+
!(node["format"].split(",").include? @format.to_s)
|
223
223
|
|
224
224
|
out.passthrough node.text
|
225
225
|
end
|
226
226
|
|
227
227
|
def svg_parse(node, out)
|
228
|
-
out
|
228
|
+
out.parent.add_child(node)
|
229
229
|
end
|
230
230
|
end
|
231
231
|
end
|
data/lib/isodoc/function/form.rb
CHANGED
@@ -1,48 +1,51 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
node
|
5
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module Function
|
3
|
+
module Form
|
4
|
+
def form_parse(node, out)
|
5
|
+
out.div **attr_code(class: node["class"],
|
6
|
+
id: node["id"]) do |div|
|
7
|
+
node.children.each do |n|
|
8
|
+
parse(n, div)
|
9
|
+
end
|
10
|
+
end
|
6
11
|
end
|
7
|
-
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
when "text" then text_input(out, node["maxlength"])
|
13
|
+
def input_parse(node, out)
|
14
|
+
case node["type"]
|
15
|
+
when "button" then out << "[#{node['value'] || 'BUTTON'}]"
|
16
|
+
when "checkbox" then out << "☐ "
|
17
|
+
when "date", "file", "password" then text_input(out)
|
18
|
+
when "radio" then out << "◎ "
|
19
|
+
when "submit" # nop
|
20
|
+
when "text" then text_input(out, node["maxlength"])
|
21
|
+
end
|
19
22
|
end
|
20
|
-
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
def text_input(out, length = 10)
|
25
|
+
length ||= 10
|
26
|
+
length = length.to_i
|
27
|
+
length.zero? and length = 10
|
28
|
+
out << "_" * length
|
29
|
+
out << " "
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
def select_parse(node, out)
|
33
|
+
text_input(out, node["size"] || 10)
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
def label_parse(node, out)
|
37
|
+
node.children.each do |n|
|
38
|
+
parse(n, out)
|
39
|
+
end
|
37
40
|
end
|
38
|
-
end
|
39
41
|
|
40
|
-
|
42
|
+
def option_parse(node, out); end
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
def textarea_parse(_node, out)
|
45
|
+
out.table **{ border: 1, width: "50%" } do |t|
|
46
|
+
t.tr do |tr|
|
47
|
+
tr.td do |td|
|
48
|
+
end
|
46
49
|
end
|
47
50
|
end
|
48
51
|
end
|
@@ -71,7 +71,11 @@ module IsoDoc::Function
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def termrefelem_parse(node, out)
|
74
|
-
|
74
|
+
if node.text.strip.empty?
|
75
|
+
out << "Termbase #{node['base']}, term ID #{node['target']}"
|
76
|
+
else
|
77
|
+
node.children.each { |n| parse(n, out) }
|
78
|
+
end
|
75
79
|
end
|
76
80
|
|
77
81
|
def stem_parse(node, out)
|
@@ -58,7 +58,7 @@ module IsoDoc::Function
|
|
58
58
|
"@type = 'ISBN']"))
|
59
59
|
return [id, id1, id2] if id || id1 || id2
|
60
60
|
|
61
|
-
id = Nokogiri::XML::Node.new("docidentifier",
|
61
|
+
id = Nokogiri::XML::Node.new("docidentifier", bib.document)
|
62
62
|
id << "(NO ID)"
|
63
63
|
[nil, id, nil]
|
64
64
|
end
|
@@ -1,61 +1,64 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module HtmlFunction
|
3
|
+
module Form
|
4
|
+
def form_parse(node, out)
|
5
|
+
out.form **attr_code(id: node["id"], name: node["name"],
|
6
|
+
class: node["class"],
|
7
|
+
action: node["action"]) do |div|
|
8
|
+
node.children.each do |n|
|
9
|
+
parse(n, div)
|
10
|
+
end
|
8
11
|
end
|
9
12
|
end
|
10
|
-
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
def input_parse(node, out)
|
15
|
+
out.input nil, **attr_code(
|
16
|
+
id: node["id"], name: node["name"], type: node["type"],
|
17
|
+
value: node["value"], disabled: node["disabled"],
|
18
|
+
readonly: node["readonly"], checked: node["checked"],
|
19
|
+
maxlength: node["maxlength"], minlength: node["minlength"]
|
20
|
+
)
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
def select_parse(node, out)
|
24
|
+
selected = node.at(ns("./option[@value = '#{node['value']}']"))
|
25
|
+
selected and selected["selected"] = true
|
26
|
+
out.select **attr_code(
|
27
|
+
id: node["id"], name: node["name"], size: node["size"],
|
28
|
+
disabled: node["disabled"], multiple: node["multiple"]
|
29
|
+
) do |div|
|
30
|
+
node.children.each do |n|
|
31
|
+
parse(n, div)
|
32
|
+
end
|
30
33
|
end
|
31
34
|
end
|
32
|
-
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def label_parse(node, out)
|
37
|
+
out.label **attr_code(for: node["for"]) do |div|
|
38
|
+
node.children.each do |n|
|
39
|
+
parse(n, div)
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
|
-
end
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
def option_parse(node, out)
|
45
|
+
out.option **attr_code(
|
46
|
+
disabled: node["disabled"], selected: node["selected"],
|
47
|
+
value: node["value"]
|
48
|
+
) do |o|
|
49
|
+
node.children.each do |n|
|
50
|
+
parse(n, o)
|
51
|
+
end
|
49
52
|
end
|
50
53
|
end
|
51
|
-
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
def textarea_parse(node, out)
|
56
|
+
out.textarea **attr_code(
|
57
|
+
id: node["id"], name: node["name"], rows: node["rows"],
|
58
|
+
cols: node["cols"]
|
59
|
+
) do |div|
|
60
|
+
node["value"] and div << node["value"]
|
61
|
+
end
|
59
62
|
end
|
60
63
|
end
|
61
64
|
end
|
@@ -19,7 +19,6 @@ module IsoDoc
|
|
19
19
|
|
20
20
|
def toHTML(result, filename)
|
21
21
|
result = from_xhtml(html_cleanup(to_xhtml(result)))
|
22
|
-
# result = populate_template(result, :html)
|
23
22
|
result = from_xhtml(move_images(to_xhtml(result)))
|
24
23
|
result = html5(script_cdata(inject_script(result)))
|
25
24
|
File.open(filename, "w:UTF-8") { |f| f.write(result) }
|
@@ -33,7 +32,14 @@ module IsoDoc
|
|
33
32
|
def html_cleanup(html)
|
34
33
|
html = term_header(html_footnote_filter(html_preface(htmlstyle(html))))
|
35
34
|
html = footnote_format(footnote_backlinks(html_toc(html)))
|
36
|
-
mathml(html_list_clean(html))
|
35
|
+
mathml(html_list_clean(remove_placeholder_paras(html)))
|
36
|
+
end
|
37
|
+
|
38
|
+
def remove_placeholder_paras(html)
|
39
|
+
%w(title-section prefatory-section).each do |s|
|
40
|
+
html&.at("//div[@class = '#{s}']/p[last()]")&.remove
|
41
|
+
end
|
42
|
+
html
|
37
43
|
end
|
38
44
|
|
39
45
|
def html_list_clean(html)
|
@@ -68,6 +74,7 @@ module IsoDoc
|
|
68
74
|
head = docxml.at("//*[local-name() = 'head']")
|
69
75
|
head << htmlstylesheet(@htmlstylesheet)
|
70
76
|
s = htmlstylesheet(@htmlstylesheet_override) and head << s
|
77
|
+
@bare and head << "<style>body {margin-left: 2em; margin-right: 2em;}</style>"
|
71
78
|
docxml
|
72
79
|
end
|
73
80
|
|
@@ -99,7 +106,6 @@ module IsoDoc
|
|
99
106
|
def html_cover(docxml)
|
100
107
|
doc = to_xhtml_fragment(File.read(@htmlcoverpage, encoding: "UTF-8"))
|
101
108
|
d = docxml.at('//div[@class="title-section"]')
|
102
|
-
# d.children.first.add_previous_sibling doc.to_xml(encoding: "US-ASCII")
|
103
109
|
d.children.first.add_previous_sibling(
|
104
110
|
populate_template(doc.to_xml(encoding: "US-ASCII"), :html),
|
105
111
|
)
|
@@ -108,7 +114,6 @@ module IsoDoc
|
|
108
114
|
def html_intro(docxml)
|
109
115
|
doc = to_xhtml_fragment(File.read(@htmlintropage, encoding: "UTF-8"))
|
110
116
|
d = docxml.at('//div[@class="prefatory-section"]')
|
111
|
-
# d.children.first.add_previous_sibling doc.to_xml(encoding: "US-ASCII")
|
112
117
|
d.children.first.add_previous_sibling(
|
113
118
|
populate_template(doc.to_xml(encoding: "US-ASCII"), :html),
|
114
119
|
)
|