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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e13114c8da44d9c17bde29fc00a863856d92f156179d0e17cb68fe44acf15c6
4
- data.tar.gz: 48059fef1258601881461467f15ff9eddd2c3438569f4db009d4534df24705e0
3
+ metadata.gz: b64ad76ffcf7c9f1ced2c15c41a263e49e62cfa4294d31066ba2e358e613fb35
4
+ data.tar.gz: f35ca08d240ae7cdb7ba9aa0c9e071ec284d051f0d61c82542d461e101d0da38
5
5
  SHA512:
6
- metadata.gz: 111193af048da068dbf1f6fe6e687d7ceb16f828d5f34a65c09cb5a4a12ea8fc9e8818a7df5f507bb8aea7f76dcb07b76463d59285aad3e6b185a6dc43208775
7
- data.tar.gz: 6563bf3f6aa6693b8cea2bfb04962399bb5821d992f68cc981137a09a81bbc0c870a558b4f3de1c3c48ce4cb0a46b6e695af4f33c00ded7f0b29c334ca91077f
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>No terms and definitions are listed in this document.</p>
21
+ <p>لم يتم سرد أي مصطلحات وتعريفات في هذا المستند.</p>
22
22
  internal_terms_boilerplate: |
23
- <p>For the purposes of this document,
24
- the following terms and definitions apply.</p>
23
+ <p>لأغراض هذا المستند، تنطبق المصطلحات والتعريفات التالية.</p>
25
24
  norm_with_refs_pref:
26
- The following documents are referred to in the text in such a way
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
- There are no normative references in this document.
27
+ لا توجد مراجع معيارية في هذه الوثيقة.
33
28
  external_terms_boilerplate: |
34
- <p>For the purposes of this document,
35
- the terms and definitions given in % apply.</p>
29
+ <p> لأغراض هذا المستند ، تنطبق المصطلحات والتعريفات الواردة في%. </ p>
36
30
  internal_external_terms_boilerplate: |
37
- <p>For the purposes of this document, the terms and definitions
38
- given in % and the following apply.</p>
39
- term_defined_in: "[term defined in %]"
31
+ <p>لأغراض هذه الوثيقة ،تنطبق المصطلحات والتعاريف الواردة في % وما يلي.</p>
32
+ term_defined_in: "[المصطلح المحدد في %]"
40
33
  note: ملاحظة
41
34
  note_xref: ملاحظة
42
- termnote: Note % to entry
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: Key
45
+ key: مفتاح
52
46
  example: مثال
53
47
  example_xref: مثال
54
48
  where: حيث
55
49
  wholeoftext: كامل النص
56
- draft_label: draft
57
- inform_annex: informative
58
- norm_annex: normative
50
+ draft_label: مسودة
51
+ inform_annex: إخباري
52
+ norm_annex: مقياسي
59
53
  modified: معدلة
60
- deprecated: 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: Warning
82
- caution: 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
- "Note % to entry":
112
- sg: Note % to entry
113
- pl: Notes % to entry
105
+ "ملاحظة % للقيد":
106
+ sg: ملاحظة % للقيد
107
+ pl: ملاحظات % للقيد
114
108
  قائمة:
115
109
  sg: قائمة
116
110
  pl: قوائم
@@ -36,6 +36,7 @@ note: HINWEIS
36
36
  note_xref: Hinweis
37
37
  termnote: Hinweis % zum Eintrag
38
38
  list: Liste
39
+ deflist: Definitionsliste
39
40
  figure: Abbildung
40
41
  formula: Formel
41
42
  inequality: Formel
@@ -42,6 +42,7 @@ note: NOTE
42
42
  note_xref: Note
43
43
  termnote: Note % to entry
44
44
  list: List
45
+ deflist: Definition List
45
46
  figure: Figure
46
47
  formula: Formula
47
48
  inequality: Formula
@@ -38,6 +38,7 @@ note: NOTA
38
38
  note_xref: Nota
39
39
  termnote: Nota % a la entrada
40
40
  list: Lista
41
+ deflist: Lista de definiciones
41
42
  figure: Figura
42
43
  formula: Fórmula
43
44
  inequality: Fórmula
@@ -38,6 +38,7 @@ figure: Figure
38
38
  formula: Formule
39
39
  inequality: Formule
40
40
  list: Liste
41
+ deflist: Liste de définitions
41
42
  table: Tableau
42
43
  requirement: Exigence
43
44
  recommendation: Recommandation
@@ -41,6 +41,7 @@ note: ПРИМЕЧАНИЕ
41
41
  note_xref: Примечание
42
42
  termnote: Примечание % к определению
43
43
  list: Список
44
+ deflist: Список определений
44
45
  figure: Рисунок
45
46
  formula: Формула
46
47
  inequality: Формула
@@ -40,6 +40,7 @@ figure: 图
40
40
  formula: 公式
41
41
  inequality: 公式
42
42
  list: 列项
43
+ deflist: 定义列表
43
44
  table: 表
44
45
  requirement: 要求
45
46
  recommendation: 建议
@@ -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(node, div, name)
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 |p|
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(/,/).include? @format.to_s)
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 << node.to_xml
228
+ out.parent.add_child(node)
229
229
  end
230
230
  end
231
231
  end
@@ -1,48 +1,51 @@
1
- module IsoDoc::Function
2
- module Form
3
- def form_parse(node, out)
4
- node.children.each do |n|
5
- parse(n, out)
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
- def input_parse(node, out)
10
- case node["type"]
11
- when "button" then out << "[#{node['value'] || 'BUTTON'}]"
12
- when "checkbox" then out << "&#x2610; "
13
- when "date" then text_input(out)
14
- when "file" then text_input(out)
15
- when "password" then text_input(out)
16
- when "radio" then out << "&#x25CE; "
17
- when "submit" # nop
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 << "&#x2610; "
17
+ when "date", "file", "password" then text_input(out)
18
+ when "radio" then out << "&#x25CE; "
19
+ when "submit" # nop
20
+ when "text" then text_input(out, node["maxlength"])
21
+ end
19
22
  end
20
- end
21
23
 
22
- def text_input(out, length = 10)
23
- length ||= 10
24
- length = length.to_i
25
- length.zero? and length = 10
26
- out << "_" * length
27
- out << " "
28
- end
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
- def select_parse(node, out)
31
- text_input(out, node["size"] || 10)
32
- end
32
+ def select_parse(node, out)
33
+ text_input(out, node["size"] || 10)
34
+ end
33
35
 
34
- def label_parse(node, out)
35
- node.children.each do |n|
36
- parse(n, out)
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
- def option_parse(node, out); end
42
+ def option_parse(node, out); end
41
43
 
42
- def textarea_parse(_node, out)
43
- out.table **{ border: 1, width: "50%" } do |t|
44
- t.tr do |tr|
45
- tr.td do |td|
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
- out << "Termbase #{node['base']}, term ID #{node['target']}"
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", b.document)
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::HtmlFunction
2
- module Form
3
- def form_parse(node, out)
4
- out.form **attr_code(id: node["id"], name: node["name"],
5
- action: node["action"]) do |div|
6
- node.children.each do |n|
7
- parse(n, div)
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
- def input_parse(node, out)
13
- out.input nil, **attr_code(
14
- id: node["id"], name: node["name"], type: node["type"],
15
- value: node["value"], disabled: node["disabled"],
16
- readonly: node["readonly"], checked: node["checked"],
17
- maxlength: node["maxlength"], minlength: node["minlength"]
18
- )
19
- end
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
- def select_parse(node, out)
22
- selected = node.at(ns("./option[@value = '#{node['value']}']"))
23
- selected and selected["selected"] = true
24
- out.select **attr_code(
25
- id: node["id"], name: node["name"], size: node["size"],
26
- disabled: node["disabled"], multiple: node["multiple"]
27
- ) do |div|
28
- node.children.each do |n|
29
- parse(n, div)
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
- def label_parse(node, out)
35
- out.label **attr_code(for: node["for"]) do |div|
36
- node.children.each do |n|
37
- parse(n, div)
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
- def option_parse(node, out)
43
- out.option **attr_code(
44
- disabled: node["disabled"], selected: node["selected"],
45
- value: node["value"]
46
- ) do |o|
47
- node.children.each do |n|
48
- parse(n, o)
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
- def textarea_parse(node, out)
54
- out.textarea **attr_code(
55
- id: node["id"], name: node["name"], rows: node["rows"],
56
- cols: node["cols"]
57
- ) do |div|
58
- node["value"] and div << node["value"]
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
@@ -74,6 +74,8 @@ module IsoDoc::HtmlFunction
74
74
  end
75
75
 
76
76
  def html_button
77
+ return "" if @bare
78
+
77
79
  '<button onclick="topFunction()" id="myBtn" '\
78
80
  'title="Go to top">Top</button>'.freeze
79
81
  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
  )