cmess 0.4.0 → 0.4.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 +4 -4
- data/ChangeLog +5 -0
- data/README +5 -6
- data/Rakefile +2 -2
- data/lib/cmess.rb +1 -1
- data/lib/cmess/bconv.rb +3 -6
- data/lib/cmess/cinderella.rb +1 -1
- data/lib/cmess/cli.rb +4 -7
- data/lib/cmess/guess_encoding/automatic.rb +9 -9
- data/lib/cmess/version.rb +1 -1
- metadata +83 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac20cb55f5cf6cf51e70976198b7c92587fa2f16
|
4
|
+
data.tar.gz: e249042daace0a5ec023e4f6ae0af745b652f254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efb2614cc280ddfe49a530f14081b054d4ed46f80f0202c9c075c71ef0d039d14521d447ecc577bf358c120cf35825026aa0f29e83fa9c85424846dd04c46f27
|
7
|
+
data.tar.gz: c590474057294fea1e463fc111777691b60d100f5550a51d1f4660b7639d42a95e7bdb9196afd2d4e71c8719d160725343459de7bf13961107c56142f48b9a5a
|
data/ChangeLog
CHANGED
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== VERSION
|
4
4
|
|
5
|
-
This documentation refers to cmess version 0.4.
|
5
|
+
This documentation refers to cmess version 0.4.1
|
6
6
|
|
7
7
|
|
8
8
|
== DESCRIPTION
|
@@ -31,10 +31,9 @@ Ruby versions. CMess has been tested with ruby 2.0.0p247 on x86_64-linux.
|
|
31
31
|
|
32
32
|
== LINKS
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
RubyGem:: http://rubygems.org/gems/cmess
|
34
|
+
Documentation:: https://blackwinter.github.com/cmess
|
35
|
+
Source code:: https://github.com/blackwinter/cmess
|
36
|
+
RubyGem:: https://rubygems.org/gems/cmess
|
38
37
|
|
39
38
|
|
40
39
|
== AUTHORS
|
@@ -54,7 +53,7 @@ RubyGem:: http://rubygems.org/gems/cmess
|
|
54
53
|
Copyright (C) 2007-2012 University of Cologne,
|
55
54
|
Albertus-Magnus-Platz, 50923 Cologne, Germany
|
56
55
|
|
57
|
-
Copyright (C) 2013 Jens Wille
|
56
|
+
Copyright (C) 2013-2014 Jens Wille
|
58
57
|
|
59
58
|
cmess is free software: you can redistribute it and/or modify it under the
|
60
59
|
terms of the GNU Affero General Public License as published by the Free
|
data/Rakefile
CHANGED
@@ -15,10 +15,10 @@ following tools: #{Dir['bin/*'].map { |e| File.basename(e) }.sort.join(', ')})
|
|
15
15
|
EOT
|
16
16
|
author: %q{Jens Wille},
|
17
17
|
email: %q{jens.wille@gmail.com},
|
18
|
-
license: %q{AGPL},
|
18
|
+
license: %q{AGPL-3.0},
|
19
19
|
homepage: :blackwinter,
|
20
20
|
extra_files: FileList['data/**/*'].to_a,
|
21
|
-
dependencies: [
|
21
|
+
dependencies: %w[htmlentities nuggets safe_yaml],
|
22
22
|
|
23
23
|
required_ruby_version: '>= 1.9.2'
|
24
24
|
}
|
data/lib/cmess.rb
CHANGED
@@ -40,7 +40,7 @@ module CMess
|
|
40
40
|
autoload :DecodeEntities, 'cmess/decode_entities'
|
41
41
|
autoload :GuessEncoding, 'cmess/guess_encoding'
|
42
42
|
|
43
|
-
DATA_DIR = File.expand_path('../../data', __FILE__)
|
43
|
+
DATA_DIR = ENV['CMESS_DATA'] || File.expand_path('../../data', __FILE__)
|
44
44
|
|
45
45
|
class << self
|
46
46
|
|
data/lib/cmess/bconv.rb
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
#++
|
30
30
|
|
31
31
|
require 'cmess'
|
32
|
-
require '
|
32
|
+
require 'safe_yaml/load'
|
33
33
|
|
34
34
|
# Convert between bibliographic (and other) encodings.
|
35
35
|
|
@@ -51,7 +51,7 @@ class CMess::BConv
|
|
51
51
|
chartab = load_chartab(chartab)
|
52
52
|
|
53
53
|
chartab[chartab.keys.first].keys.map { |encoding|
|
54
|
-
encoding.upcase unless encoding
|
54
|
+
encoding.upcase unless encoding.start_with?('__')
|
55
55
|
}.compact.sort
|
56
56
|
end
|
57
57
|
|
@@ -61,7 +61,7 @@ class CMess::BConv
|
|
61
61
|
chartab
|
62
62
|
when String
|
63
63
|
raise "chartab file not found: #{chartab}" unless File.readable?(chartab)
|
64
|
-
|
64
|
+
SafeYAML.load_file(chartab)
|
65
65
|
else
|
66
66
|
raise ArgumentError, "invalid chartab of type #{chartab.class}"
|
67
67
|
end
|
@@ -74,9 +74,6 @@ class CMess::BConv
|
|
74
74
|
:input, :output, :source_encoding, :target_encoding
|
75
75
|
)
|
76
76
|
|
77
|
-
@source_encoding = options[:source_encoding].upcase
|
78
|
-
@target_encoding = options[:target_encoding].upcase
|
79
|
-
|
80
77
|
@chartab = self.class.load_chartab(options[:chartab] || DEFAULT_CHARTAB_FILE)
|
81
78
|
@encodings = self.class.encodings(@chartab)
|
82
79
|
|
data/lib/cmess/cinderella.rb
CHANGED
data/lib/cmess/cli.rb
CHANGED
@@ -32,7 +32,6 @@ require 'cmess'
|
|
32
32
|
|
33
33
|
require 'optparse'
|
34
34
|
require 'tempfile'
|
35
|
-
require 'yaml'
|
36
35
|
require 'nuggets/env/user_encoding'
|
37
36
|
require 'nuggets/string/capitalize_first'
|
38
37
|
require 'nuggets/string/word_wrap'
|
@@ -68,7 +67,7 @@ module CMess::CLI
|
|
68
67
|
when 'r' then STDIN
|
69
68
|
when 'w' then STDOUT
|
70
69
|
when 'a' then STDERR
|
71
|
-
else
|
70
|
+
else raise ArgumentError, "don't know how to handle mode `#{mode}'"
|
72
71
|
end
|
73
72
|
else
|
74
73
|
ensure_readable(file) unless mode == 'w'
|
@@ -84,7 +83,7 @@ module CMess::CLI
|
|
84
83
|
STDIN.each { |line| temp << line }
|
85
84
|
else
|
86
85
|
ensure_readable(file)
|
87
|
-
File.
|
86
|
+
File.foreach(file) { |line| temp << line }
|
88
87
|
end
|
89
88
|
}
|
90
89
|
|
@@ -95,11 +94,9 @@ module CMess::CLI
|
|
95
94
|
|
96
95
|
def trailing_args_as_input(options)
|
97
96
|
unless ARGV.empty? || options[:input_set]
|
98
|
-
options[:input] =
|
99
|
-
open_file_or_std(ARGV.first)
|
100
|
-
else
|
97
|
+
options[:input] = ARGV.size == 1 ?
|
98
|
+
open_file_or_std(ARGV.first) :
|
101
99
|
open_temporary_input(*ARGV)
|
102
|
-
end
|
103
100
|
end
|
104
101
|
end
|
105
102
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# Albertus-Magnus-Platz, #
|
10
10
|
# 50923 Cologne, Germany #
|
11
11
|
# #
|
12
|
-
# Copyright (C) 2013 Jens Wille
|
12
|
+
# Copyright (C) 2013-2014 Jens Wille #
|
13
13
|
# #
|
14
14
|
# Authors: #
|
15
15
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -36,9 +36,9 @@
|
|
36
36
|
|
37
37
|
require 'cmess/guess_encoding'
|
38
38
|
|
39
|
-
require 'yaml'
|
40
39
|
require 'stringio'
|
41
40
|
require 'forwardable'
|
41
|
+
require 'safe_yaml/load'
|
42
42
|
|
43
43
|
# Tries to detect the encoding of a given input by applying several
|
44
44
|
# heuristics to determine the <b>most likely</b> candidate. If no
|
@@ -91,7 +91,7 @@ class CMess::GuessEncoding::Automatic
|
|
91
91
|
e, f = self[k], UTF_8
|
92
92
|
TEST_ENCODINGS << e unless TEST_ENCODINGS.include?(e)
|
93
93
|
h[e] = CHARS_TO_TEST.flat_map { |c| c.encode(e, f).unpack('C') }
|
94
|
-
}.update(
|
94
|
+
}.update(SafeYAML.load_file(File.join(CMess::DATA_DIR, 'test_chars.yaml')))
|
95
95
|
|
96
96
|
# Relative count of TEST_CHARS must exceed this threshold to yield
|
97
97
|
# a direct match.
|
@@ -122,9 +122,9 @@ class CMess::GuessEncoding::Automatic
|
|
122
122
|
|
123
123
|
def encoding(*encodings, &block)
|
124
124
|
encodings.flatten.each { |encoding|
|
125
|
-
unless
|
126
|
-
|
127
|
-
|
125
|
+
unless supported_encoding?(encoding)
|
126
|
+
supported_encodings << encoding
|
127
|
+
encoding_guessers << block
|
128
128
|
end
|
129
129
|
}
|
130
130
|
end
|
@@ -134,9 +134,9 @@ class CMess::GuessEncoding::Automatic
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def bom_encoding(encoding, &block)
|
137
|
-
unless
|
138
|
-
|
139
|
-
|
137
|
+
unless supported_bom?(encoding)
|
138
|
+
supported_boms << encoding
|
139
|
+
bom_guessers << lambda { |*| encoding if instance_eval(&block) }
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
data/lib/cmess/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: htmlentities
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: nuggets
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: safe_yaml
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hen
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
39
81
|
- !ruby/object:Gem::Version
|
40
82
|
version: '0'
|
41
83
|
description: |
|
@@ -53,16 +95,10 @@ extra_rdoc_files:
|
|
53
95
|
- COPYING
|
54
96
|
- ChangeLog
|
55
97
|
files:
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
- lib/cmess/decode_entities.rb
|
61
|
-
- lib/cmess/guess_encoding.rb
|
62
|
-
- lib/cmess/guess_encoding/automatic.rb
|
63
|
-
- lib/cmess/guess_encoding/encoding.rb
|
64
|
-
- lib/cmess/guess_encoding/manual.rb
|
65
|
-
- lib/cmess/version.rb
|
98
|
+
- COPYING
|
99
|
+
- ChangeLog
|
100
|
+
- README
|
101
|
+
- Rakefile
|
66
102
|
- bin/bconv
|
67
103
|
- bin/cinderella
|
68
104
|
- bin/decode_entities
|
@@ -87,10 +123,6 @@ files:
|
|
87
123
|
- data/csets/utf-8.yaml
|
88
124
|
- data/csets/utf8.yaml
|
89
125
|
- data/test_chars.yaml
|
90
|
-
- COPYING
|
91
|
-
- ChangeLog
|
92
|
-
- README
|
93
|
-
- Rakefile
|
94
126
|
- example/cinderella/crop
|
95
127
|
- example/cinderella/crop_repaired
|
96
128
|
- example/cinderella/empty6-slash.txt
|
@@ -101,35 +133,51 @@ files:
|
|
101
133
|
- example/guess_encoding/en.utf-8.txt
|
102
134
|
- example/guess_encoding/fr.utf-8.txt
|
103
135
|
- example/guess_encoding/it.utf-8.txt
|
136
|
+
- lib/cmess.rb
|
137
|
+
- lib/cmess/bconv.rb
|
138
|
+
- lib/cmess/cinderella.rb
|
139
|
+
- lib/cmess/cli.rb
|
140
|
+
- lib/cmess/decode_entities.rb
|
141
|
+
- lib/cmess/guess_encoding.rb
|
142
|
+
- lib/cmess/guess_encoding/automatic.rb
|
143
|
+
- lib/cmess/guess_encoding/encoding.rb
|
144
|
+
- lib/cmess/guess_encoding/manual.rb
|
145
|
+
- lib/cmess/version.rb
|
104
146
|
homepage: http://github.com/blackwinter/cmess
|
105
147
|
licenses:
|
106
|
-
- AGPL
|
148
|
+
- AGPL-3.0
|
107
149
|
metadata: {}
|
108
|
-
post_install_message:
|
150
|
+
post_install_message: |2+
|
151
|
+
|
152
|
+
cmess-0.4.1 [2014-06-20]:
|
153
|
+
|
154
|
+
* Various updates/refactorings.
|
155
|
+
* Housekeeping.
|
156
|
+
|
109
157
|
rdoc_options:
|
110
|
-
- --
|
158
|
+
- "--title"
|
159
|
+
- cmess Application documentation (v0.4.1)
|
160
|
+
- "--charset"
|
111
161
|
- UTF-8
|
112
|
-
- --line-numbers
|
113
|
-
- --all
|
114
|
-
- --
|
115
|
-
- cmess Application documentation (v0.4.0)
|
116
|
-
- --main
|
162
|
+
- "--line-numbers"
|
163
|
+
- "--all"
|
164
|
+
- "--main"
|
117
165
|
- README
|
118
166
|
require_paths:
|
119
167
|
- lib
|
120
168
|
required_ruby_version: !ruby/object:Gem::Requirement
|
121
169
|
requirements:
|
122
|
-
- -
|
170
|
+
- - ">="
|
123
171
|
- !ruby/object:Gem::Version
|
124
172
|
version: 1.9.2
|
125
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
174
|
requirements:
|
127
|
-
- -
|
175
|
+
- - ">="
|
128
176
|
- !ruby/object:Gem::Version
|
129
177
|
version: '0'
|
130
178
|
requirements: []
|
131
179
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.0
|
180
|
+
rubygems_version: 2.3.0
|
133
181
|
signing_key:
|
134
182
|
specification_version: 4
|
135
183
|
summary: 'Assist with handling messed up encodings (Currently includes the following
|