isodoc 2.1.2.1 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 415f9833363761b737893c9c03f3d71c1b765ff06500f16223f12a7dbac27152
4
- data.tar.gz: dda95049642e7d2743552b4e5249dddeab5a748e6314771ed09c8b2429e02b56
3
+ metadata.gz: 3bf48bda8bc7d17d20a766f93c30bcf9f6e7e597497f8663f2c96ff292ada4f5
4
+ data.tar.gz: 7efd7f5c3aff9ee37fc631eecd1a564213ab56f92780807d1dff2b17e05c402b
5
5
  SHA512:
6
- metadata.gz: ac02cacff1a871b347de4b8d5726fcb888d8887923e002f1615dd446203c42d42d66a252caedd48111058f8389d50eec7fc0ca49ce7701fc5a14cac4edcaaad2
7
- data.tar.gz: e4e62b67708eddf8d38fa2d19e2df91877a5647d6b5b84251f6de85105ed7c44db835c74ffef7e50b6834f1bc411efa7f5cddab0d731b067772198cdaa7e74f3
6
+ metadata.gz: 449d645dc7a4caaf2cd778dedfa4bb995344c3c83b076abbe4ea971b32d6fc9515ee7ae1140d76dfbc5f2c01220513979ea239c095fc2037b84263996a728e4f
7
+ data.tar.gz: 2031af0175ba1ba995fe3cca887180fa0e0d097dcfd6e2afb51eb7dc60ad8934bfbf4fc17dd9f91f1f2fba8e63e46efd8cee7a2fb2e9693d3f3f804ef432f662
@@ -62,5 +62,21 @@ module IsoDoc
62
62
  end
63
63
  xml.root.children.to_xml
64
64
  end
65
+
66
+ def nearest_block_parent(node)
67
+ until %w(p title td th name formula li dt dd sourcecode pre quote
68
+ note example)
69
+ .include?(node.name)
70
+ node = node.parent
71
+ end
72
+ node
73
+ end
74
+
75
+ # node is at the start of sentence in a Metanorma XML context
76
+ def start_of_sentence(node)
77
+ prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
78
+ node.xpath("./preceding::text()")
79
+ prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join)
80
+ end
65
81
  end
66
82
  end
@@ -11,6 +11,10 @@ module IsoDoc
11
11
  self.class.ns(xpath)
12
12
  end
13
13
 
14
+ def start_of_sentence(node)
15
+ self.class.start_of_sentence(node)
16
+ end
17
+
14
18
  def insert_tab(out, count)
15
19
  tab = %w(Hans Hant).include?(@script) ? "&#x3000;" : "&#xa0; "
16
20
  [1..count].each { out << tab }
@@ -8,6 +8,10 @@ module IsoDoc
8
8
  text.capitalize
9
9
  end
10
10
 
11
+ def block_delim
12
+ "&#xa0;&#x2014; "
13
+ end
14
+
11
15
  def prefix_name(node, delim, number, elem)
12
16
  return if number.nil? || number.empty?
13
17
 
@@ -31,7 +35,7 @@ module IsoDoc
31
35
  return if labelled_ancestor(elem)
32
36
 
33
37
  lbl = @xrefs.anchor(elem["id"], :label, false) or return
34
- prefix_name(elem, "&#xa0;&#x2014; ",
38
+ prefix_name(elem, block_delim,
35
39
  l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
36
40
  end
37
41
 
@@ -60,7 +64,7 @@ module IsoDoc
60
64
  else
61
65
  l10n("#{@i18n.example} #{n[:label]}")
62
66
  end
63
- prefix_name(elem, "&#xa0;&#x2014; ", lbl, "name")
67
+ prefix_name(elem, block_delim, lbl, "name")
64
68
  end
65
69
 
66
70
  def note(docxml)
@@ -130,7 +134,7 @@ module IsoDoc
130
134
  return if elem["unnumbered"] && !elem.at(ns("./name"))
131
135
 
132
136
  n = @xrefs.anchor(elem["id"], :label, false)
133
- prefix_name(elem, "&#xa0;&#x2014; ", l10n("#{lower2cap @i18n.table} #{n}"),
137
+ prefix_name(elem, block_delim, l10n("#{lower2cap @i18n.table} #{n}"),
134
138
  "name")
135
139
  end
136
140
 
@@ -32,7 +32,7 @@ module IsoDoc
32
32
  return if elem.at(ns("./figure")) && !elem.at(ns("./name"))
33
33
 
34
34
  lbl = @xrefs.anchor(elem["id"], :label, false) or return
35
- prefix_name(elem, "&#xa0;&#x2014; ",
35
+ prefix_name(elem, block_delim,
36
36
  l10n("#{lower2cap @i18n.figure} #{lbl}"), "name")
37
37
  end
38
38
 
@@ -3,14 +3,6 @@ require_relative "xrefs"
3
3
 
4
4
  module IsoDoc
5
5
  class PresentationXMLConvert < ::IsoDoc::Convert
6
- def nearest_block_parent(node)
7
- until %w(p title td th name formula li dt dd sourcecode pre)
8
- .include?(node.name)
9
- node = node.parent
10
- end
11
- node
12
- end
13
-
14
6
  def non_locality_elems(node)
15
7
  node.children.reject do |c|
16
8
  %w{locality localityStack location}.include? c.name
@@ -177,7 +177,7 @@ module IsoDoc
177
177
 
178
178
  def toc(docxml)
179
179
  docxml.xpath(ns("//toc//xref[text()]")).each do |x|
180
- lbl = @xrefs.get[x["target"]][:label] or next
180
+ lbl = @xrefs.anchor(x["target"], :label) or next
181
181
  x.children.first.previous = "#{lbl}<tab/>"
182
182
  end
183
183
  end
@@ -105,9 +105,7 @@ module IsoDoc
105
105
  end
106
106
 
107
107
  def capitalise_xref1(node, linkend)
108
- prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
109
- node.xpath("./preceding::text()")
110
- if prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map(&:text).join)
108
+ if start_of_sentence(node)
111
109
  Common::case_with_markup(linkend, "capital", @script)
112
110
  else linkend
113
111
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.1.2.1".freeze
2
+ VERSION = "2.1.3".freeze
3
3
  end
@@ -1,9 +1,14 @@
1
1
  module IsoDoc
2
2
  module WordFunction
3
3
  module Body
4
- def section_break(body)
4
+ def section_break(body, continuous: false)
5
5
  body.p do |p|
6
- p.br **{ clear: "all", class: "section" }
6
+ if continuous
7
+ p.br **{ clear: "all", style: "page-break-before:auto;"\
8
+ "mso-break-type:section-break" }
9
+ else
10
+ p.br **{ clear: "all", class: "section" }
11
+ end
7
12
  end
8
13
  end
9
14
 
data/lib/isodoc/xref.rb CHANGED
@@ -52,7 +52,7 @@ module IsoDoc
52
52
 
53
53
  # extract names for all anchors, xref and label
54
54
  def parse(docxml)
55
- amend_preprocess(docxml) if @parse_settings.empty?
55
+ amend_preprocess(docxml) if @parse_settings.empty?
56
56
  initial_anchor_names(docxml)
57
57
  back_anchor_names(docxml)
58
58
  # preempt clause notes with all other types of note (ISO default)
@@ -132,6 +132,7 @@ relatedterms:
132
132
  contrast: مضاد
133
133
  # تباين
134
134
  see: انظر
135
+ seealso: انظر أيضا
135
136
  inflection:
136
137
  فقرة:
137
138
  sg: فقرة
@@ -138,6 +138,7 @@ relatedterms:
138
138
  compare: vergleiche
139
139
  contrast: dagegen
140
140
  see: siehe
141
+ seealso: siehe auch
141
142
  inflection:
142
143
  Klausel:
143
144
  sg: Klausel
@@ -138,6 +138,7 @@ relatedterms:
138
138
  compare: compare
139
139
  contrast: contrast
140
140
  see: see
141
+ seealso: see also
141
142
  inflection:
142
143
  Clause:
143
144
  sg: Clause
@@ -138,6 +138,7 @@ relatedterms:
138
138
  compare: relacionado
139
139
  contrast: difiere
140
140
  see: véase
141
+ seealso: véase tambien
141
142
  inflection:
142
143
  Cláusula:
143
144
  sg: Cláusula
@@ -136,6 +136,7 @@ relatedterms:
136
136
  compare: comparez
137
137
  contrast: contrastez
138
138
  see: voir
139
+ seealso: voir aussi
139
140
  inflection:
140
141
  Clause:
141
142
  sg: Article
@@ -143,6 +143,7 @@ relatedterms:
143
143
  compare: наравне
144
144
  contrast: противоположный
145
145
  see: см.
146
+ seealso: см. также
146
147
  inflection:
147
148
  Пункт:
148
149
  sg: Пункт
@@ -132,4 +132,5 @@ relatedterms:
132
132
  compare: 比较
133
133
  contrast: 对比
134
134
  see: 见
135
+ seealso: 参见
135
136
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2.1
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -504,7 +504,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
504
504
  - !ruby/object:Gem::Version
505
505
  version: '0'
506
506
  requirements: []
507
- rubygems_version: 3.3.7
507
+ rubygems_version: 3.3.16
508
508
  signing_key:
509
509
  specification_version: 4
510
510
  summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.