chupa-text 1.3.4 → 1.3.5

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: d81031d80654a357700972d1443aea5994ba4e3f4a1684e670a19b7041b12073
4
- data.tar.gz: 17d66e6f6660066fd8c4fd83baf01eee8c2296a2a7a777ab7c0db3bbf9917d56
3
+ metadata.gz: 8e24f007b2ce32dbfd3e2bc8a453d003d3cd9d528d097214e7c9a0a59a6e7427
4
+ data.tar.gz: efbe5bc163d8f170f04074272071815002678ccbf7ec0f7d6282d7382aec5b2e
5
5
  SHA512:
6
- metadata.gz: e3ab55e7923da653b4c277491712e6564db633b664830ad2153b60b0ada7d09de69576074a0a3592406b03041f09990fa7a0daf0fd3f99d798543d22d5416a2c
7
- data.tar.gz: ab8e04142b49119e51c9d7da40776efc674e75034148670c7f921a06320896426f7aba99a42ff467a97d07bd89c776bc4e04ddfa788ce826d51481baf8890470
6
+ metadata.gz: 29dcae1ce19af6cade4f2cacbdd465f6f6af14ff566054c44fe021bfb8cdfd9d475a8fe5871387d46ade8063b30a0711f70470f677d405961f5a8e7eca04cfd9
7
+ data.tar.gz: 638682d059e805c471b76ab0c1413e917acb690cee80b54b2855837203d029b8c0383c0e5e96d2d7676144cb79e048f0e4bd81b59b24e59c566c1b5cf0b3d731
data/doc/text/news.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # News
2
2
 
3
+ ## 1.3.5: 2024-09-22
4
+
5
+ ### Improvements
6
+
7
+ * Added support for REXML 3.3.2 or later.
8
+
3
9
  ## 1.3.4: 2024-09-22
4
10
 
5
11
  ### Improvements
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2017 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@ module ChupaText
36
36
  end
37
37
 
38
38
  def decompose(data)
39
- text = ""
39
+ text = +""
40
40
  data.open do |input|
41
41
  begin
42
42
  csv = ::CSV.new(input, liberal_parsing: true)
@@ -68,7 +68,7 @@ module ChupaText
68
68
  width, height = data.expected_screenshot_size
69
69
  max_n_lines = 10
70
70
  font_size = height / max_n_lines
71
- target_text = ""
71
+ target_text = +""
72
72
  text.each_line.with_index do |line, i|
73
73
  break if i == max_n_lines
74
74
  target_text << line
@@ -41,7 +41,7 @@ module ChupaText
41
41
 
42
42
  private
43
43
  def start_decompose(context)
44
- context[:text] = ""
44
+ context[:text] = +""
45
45
  end
46
46
 
47
47
  def process_entry(entry, context)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2019-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -56,7 +56,7 @@ module ChupaText
56
56
  case entry.zip_path
57
57
  when /\Appt\/slides\/slide(\d+)\.xml/
58
58
  nth_slide = Integer($1, 10)
59
- slide_text = ""
59
+ slide_text = +""
60
60
  extract_text(entry, slide_text)
61
61
  context[:slides] << [nth_slide, slide_text]
62
62
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019-2022 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2019-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -73,7 +73,7 @@ module ChupaText
73
73
  sheets = context[:sheets].sort_by(&:first).collect(&:last)
74
74
  sheet_names = context[:sheet_names]
75
75
  sheets.each_with_index do |sheet, i|
76
- sheet_text = ""
76
+ sheet_text = +""
77
77
  sheet.each do |row|
78
78
  row_texts = row.collect do |cell|
79
79
  case cell
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2019-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -72,7 +72,7 @@ module ChupaText
72
72
  when DRAW_URI
73
73
  case local_name
74
74
  when "page"
75
- @slides << {text: ""}
75
+ @slides << {text: +""}
76
76
  end
77
77
  end
78
78
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2019-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -96,9 +96,9 @@ module ChupaText
96
96
  when "table-row"
97
97
  @sheets.last[:rows] << []
98
98
  when "table-cell"
99
- @sheets.last[:rows].last << {text: ""}
99
+ @sheets.last[:rows].last << {text: +""}
100
100
  when "covered-table-cell"
101
- @sheets.last[:rows].last << {text: ""}
101
+ @sheets.last[:rows].last << {text: +""}
102
102
  when "shapes"
103
103
  @in_shapes = true
104
104
  end
@@ -116,7 +116,7 @@ module ChupaText
116
116
  case local_name
117
117
  when "table"
118
118
  sheet = @sheets.last
119
- text = ""
119
+ text = +""
120
120
  shape_texts = sheet[:shape_texts]
121
121
  unless shape_texts.empty?
122
122
  text << shape_texts.join("\n") << "\n"
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2019-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,7 @@ module ChupaText
29
29
 
30
30
  private
31
31
  def process_content(entry, context, &block)
32
- context[:text] = ""
32
+ context[:text] = +""
33
33
  listener = TextListener.new(context[:text])
34
34
  parse(entry.file_data, listener)
35
35
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2013-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,7 @@ module ChupaText
29
29
  end
30
30
 
31
31
  def decompose(data)
32
- text = ""
32
+ text = +""
33
33
  listener = Listener.new(text)
34
34
  data.open do |input|
35
35
  begin
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2019 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2019-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -16,6 +16,7 @@
16
16
 
17
17
  require "cgi/util"
18
18
  require "rexml/parsers/sax2parser"
19
+ require "rexml/rexml"
19
20
  require "rexml/sax2listener"
20
21
 
21
22
  begin
@@ -156,12 +157,22 @@ module ChupaText
156
157
  @listener.end_element(*args)
157
158
  end
158
159
 
159
- def characters(text)
160
- @listener.characters(CGI.unescapeHTML(text))
161
- end
160
+ if (REXML::VERSION <=> "3.3.2") >= 0
161
+ def characters(text)
162
+ @listener.characters(text)
163
+ end
164
+
165
+ def cdata(content)
166
+ @listener.cdata(content)
167
+ end
168
+ else
169
+ def characters(text)
170
+ @listener.characters(CGI.unescapeHTML(text))
171
+ end
162
172
 
163
- def cdata(content)
164
- @listener.cdata(CGI.unescapeHTML(content))
173
+ def cdata(content)
174
+ @listener.cdata(CGI.unescapeHTML(content))
175
+ end
165
176
  end
166
177
  end
167
178
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2022 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2013-2024 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module ChupaText
18
- VERSION = "1.3.4"
18
+ VERSION = "1.3.5"
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chupa-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sutou Kouhei