chupa-text-decomposer-html 1.0.5 → 1.0.6
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/Rakefile +12 -2
- data/chupa-text-decomposer-html.gemspec +1 -1
- data/doc/text/news.md +8 -0
- data/lib/chupa-text/decomposers/html.rb +6 -3
- data/test/test-html.rb +21 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8011fcf3e4474139ed2b25cb2119ba4c1e2f757933ee2a9f2df6d50803d0ffb8
|
|
4
|
+
data.tar.gz: '0198e6902575d462b1384f98c75de279ba82b391a70ee58638788a4c302f142c'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d891df99acd083ac16e6a03659317257e3bee19dda9b25bf6d0219f9c76a8b7504c1b786d2051fc2529b7c6318fba76b1a96b9b1788b034adc914223a0665e57
|
|
7
|
+
data.tar.gz: 0dc3fb7c8362f442d6b23763c94fc2dce72c8a88f754e6ed533558eda960a93b0d32de23878476f49e7a7d2bd90d86ecb598e88aed3367509d44ab00cf532336
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# -*-
|
|
1
|
+
# -*- ruby -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2013-
|
|
3
|
+
# Copyright (C) 2013-2026 Sutou Kouhei <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# This library is free software; you can redistribute it and/or
|
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
|
@@ -46,3 +46,13 @@ desc "Run tests"
|
|
|
46
46
|
task :test do
|
|
47
47
|
ruby("test/run-test.rb")
|
|
48
48
|
end
|
|
49
|
+
|
|
50
|
+
release_task = Rake.application["release"]
|
|
51
|
+
# We use Trusted Publishing.
|
|
52
|
+
release_task.prerequisites.delete("build")
|
|
53
|
+
release_task.prerequisites.delete("release:rubygem_push")
|
|
54
|
+
release_task_comment = release_task.comment
|
|
55
|
+
if release_task_comment
|
|
56
|
+
release_task.clear_comments
|
|
57
|
+
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
|
|
58
|
+
end
|
|
@@ -22,7 +22,7 @@ end
|
|
|
22
22
|
|
|
23
23
|
Gem::Specification.new do |spec|
|
|
24
24
|
spec.name = "chupa-text-decomposer-html"
|
|
25
|
-
spec.version = "1.0.
|
|
25
|
+
spec.version = "1.0.6"
|
|
26
26
|
spec.homepage = "https://github.com/ranguba/chupa-text-decomposer-html"
|
|
27
27
|
spec.authors = ["Kouhei Sutou"]
|
|
28
28
|
spec.email = ["kou@clear-code.com"]
|
data/doc/text/news.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2013-
|
|
1
|
+
# Copyright (C) 2013-2026 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
|
|
@@ -37,8 +37,11 @@ module ChupaText
|
|
|
37
37
|
body = data.body
|
|
38
38
|
return false if body.nil?
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
# Compare as bytes because body may use an ASCII incompatible
|
|
41
|
+
# encoding such as ISO-2022-JP.
|
|
42
|
+
head = body.byteslice(0, 15).b
|
|
43
|
+
return true if head.start_with?("<!DOCTYPE html ")
|
|
44
|
+
return true if head.start_with?("<html")
|
|
42
45
|
|
|
43
46
|
false
|
|
44
47
|
end
|
data/test/test-html.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (C) 2013-
|
|
1
|
+
# Copyright (C) 2013-2026 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
|
|
@@ -121,6 +121,26 @@ class TestHTML < Test::Unit::TestCase
|
|
|
121
121
|
@decomposer.target?(create_data("<html"))
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
|
+
|
|
125
|
+
def test_iso_2022_jp
|
|
126
|
+
body = "<html><body>こんにちは</body></html>".encode("ISO-2022-JP")
|
|
127
|
+
assert do
|
|
128
|
+
@decomposer.target?(create_data(body))
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def test_utf_16le
|
|
133
|
+
body = "<html><body>Hello</body></html>".encode("UTF-16LE")
|
|
134
|
+
assert do
|
|
135
|
+
not @decomposer.target?(create_data(body))
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def test_text
|
|
140
|
+
assert do
|
|
141
|
+
not @decomposer.target?(create_data("Hello"))
|
|
142
|
+
end
|
|
143
|
+
end
|
|
124
144
|
end
|
|
125
145
|
end
|
|
126
146
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chupa-text-decomposer-html
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kouhei Sutou
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: chupa-text
|
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
77
|
version: '0'
|
|
78
78
|
requirements: []
|
|
79
|
-
rubygems_version:
|
|
79
|
+
rubygems_version: 4.0.20
|
|
80
80
|
specification_version: 4
|
|
81
81
|
summary: This is a ChupaText decomposer plugin for to extract text and meta-data from
|
|
82
82
|
HTML.
|