chupa-text 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +6 -0
- data/lib/chupa-text/decomposers/csv.rb +3 -3
- data/lib/chupa-text/decomposers/office-open-xml-document.rb +1 -1
- data/lib/chupa-text/decomposers/office-open-xml-presentation.rb +2 -2
- data/lib/chupa-text/decomposers/office-open-xml-workbook.rb +2 -2
- data/lib/chupa-text/decomposers/opendocument-presentation.rb +2 -2
- data/lib/chupa-text/decomposers/opendocument-spreadsheet.rb +4 -4
- data/lib/chupa-text/decomposers/opendocument-text.rb +2 -2
- data/lib/chupa-text/decomposers/xml.rb +2 -2
- data/lib/chupa-text/sax-parser.rb +17 -6
- data/lib/chupa-text/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e24f007b2ce32dbfd3e2bc8a453d003d3cd9d528d097214e7c9a0a59a6e7427
|
4
|
+
data.tar.gz: efbe5bc163d8f170f04074272071815002678ccbf7ec0f7d6282d7382aec5b2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29dcae1ce19af6cade4f2cacbdd465f6f6af14ff566054c44fe021bfb8cdfd9d475a8fe5871387d46ade8063b30a0711f70470f677d405961f5a8e7eca04cfd9
|
7
|
+
data.tar.gz: 638682d059e805c471b76ab0c1413e917acb690cee80b54b2855837203d029b8c0383c0e5e96d2d7676144cb79e048f0e4bd81b59b24e59c566c1b5cf0b3d731
|
data/doc/text/news.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2019 Kouhei
|
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-
|
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
|
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
|
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
|
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-
|
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
|
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
|
-
|
160
|
-
|
161
|
-
|
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
|
-
|
164
|
-
|
173
|
+
def cdata(content)
|
174
|
+
@listener.cdata(CGI.unescapeHTML(content))
|
175
|
+
end
|
165
176
|
end
|
166
177
|
end
|
167
178
|
end
|
data/lib/chupa-text/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-
|
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.
|
18
|
+
VERSION = "1.3.5"
|
19
19
|
end
|