clausewitz-spelling 0.2.19 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/clausewitz-spelling.gemspec +1 -1
- data/lib/clausewitz/localisation.rb +11 -3
- data/lib/clausewitz/spelling/checker.rb +7 -7
- data/lib/clausewitz/spelling/version.rb +1 -1
- metadata +11 -12
- data/Gemfile.lock +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2954d070bc209b96fae11b28331a7060fb6678c446f5cf26aa042486d999bb6a
|
4
|
+
data.tar.gz: 282ed9911f05a70e940686cf05afea6c1db88bb3e9f9ab8674a7ff8e1f715d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7637796bbcde0646dc11fb0fe3936cc273a7ce5a5bd2002031bd54cfc952b51eed87d99165029da57f1b2db534da4a7ea4977911e5973a5d933d418315aeb695
|
7
|
+
data.tar.gz: 933f6829704fe62451ab66f707d7ccc7eec30b2977784bfd6dcad8154ef54094ffc0b267d96e79c27b5aef74fe19d0384e8a7cff8b87ac5778cc591128c45cc5
|
data/.gitignore
CHANGED
data/clausewitz-spelling.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.0"
|
26
26
|
spec.add_development_dependency "pry"
|
@@ -83,7 +83,6 @@ module Clausewitz
|
|
83
83
|
current_lang = nil
|
84
84
|
text.lines.each do |line|
|
85
85
|
line.strip!
|
86
|
-
next if line.empty? || line =~ /^#/
|
87
86
|
lang_match = LANG_MAP.keys.find { |lang| line == "#{lang}:" }
|
88
87
|
if lang_match
|
89
88
|
current_lang = lang_match
|
@@ -93,13 +92,22 @@ module Clausewitz
|
|
93
92
|
errors = ["Cannot parse loc key without a langauge being set!"]
|
94
93
|
fail(UnparseableFileError, errors)
|
95
94
|
end
|
95
|
+
contents[current_lang] ||= {}
|
96
|
+
if line =~ /^\s*#\s*spellcheck_ignore:\s*\w+/
|
97
|
+
current_ignores = contents[current_lang]["spellcheck_ignore"] || []
|
98
|
+
ignore_section = line.split(/:\d*\s*/)[1]
|
99
|
+
ignore_section = ignore_section.strip.delete_prefix('"').delete_suffix('"')
|
100
|
+
new_ignores = ignore_section.split(',').map { |key| key.strip.delete_prefix('"').delete_suffix('"') }
|
101
|
+
current_ignores = (current_ignores + new_ignores).uniq
|
102
|
+
contents[current_lang]["spellcheck_ignore"] = current_ignores.join(",")
|
103
|
+
end
|
104
|
+
next if line.empty? || line =~ /^#/
|
96
105
|
key, value = line.split(/\s/, 2)
|
97
106
|
key.gsub!(/:(\d+)?$/, '')
|
98
107
|
value.gsub!(/(^"|"$)/, '')
|
99
|
-
contents[current_lang] ||= {}
|
100
108
|
contents[current_lang][key] = value
|
101
109
|
end
|
102
|
-
|
110
|
+
contents
|
103
111
|
end
|
104
112
|
|
105
113
|
def self.pre_validate(text)
|
@@ -63,10 +63,10 @@ module Clausewitz; module Spelling
|
|
63
63
|
|
64
64
|
begin
|
65
65
|
contents = Clausewitz::Localisation.parse_file(filepath)
|
66
|
-
rescue Clausewitz::Localisation::UnparseableFileError => e
|
67
|
-
|
68
|
-
rescue => e
|
69
|
-
|
66
|
+
#rescue Clausewitz::Localisation::UnparseableFileError => e
|
67
|
+
# return UnparseableFileResult.new(filepath, e.errors)
|
68
|
+
#rescue => e
|
69
|
+
# return UnparseableFileResult.new(filepath, e)
|
70
70
|
end
|
71
71
|
|
72
72
|
changed_keys = Set.new
|
@@ -138,7 +138,7 @@ module Clausewitz; module Spelling
|
|
138
138
|
entry.gsub!(/\$([A-Z]|\||\d|=)+\$/, '')
|
139
139
|
|
140
140
|
# Remove other localisation bits we don't care about.
|
141
|
-
entry.gsub!(/§(%|\*|=|\d|
|
141
|
+
entry.gsub!(/§(%|\*|=|\d|[A-Za-z]|\+|-|!)/, '')
|
142
142
|
entry.gsub!(/(£|\$)\w+(\|.+\$)?/, '')
|
143
143
|
|
144
144
|
## We should also remove punctuation that is never part of words, like
|
@@ -257,8 +257,8 @@ module Clausewitz; module Spelling
|
|
257
257
|
|
258
258
|
# Make sure a file to be checked is actually present and readable.
|
259
259
|
def validate_filepath!(filepath)
|
260
|
-
|
261
|
-
|
260
|
+
puts ("No such file '#{filepath}'!") unless filepath.exist?
|
261
|
+
puts ("Cannot read '#{filepath}'!") unless filepath.readable?
|
262
262
|
end
|
263
263
|
end
|
264
264
|
end; end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clausewitz-spelling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Chappell
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
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:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email:
|
141
141
|
- wtchappell@gmail.com
|
142
142
|
executables:
|
@@ -150,7 +150,6 @@ files:
|
|
150
150
|
- ".travis.yml"
|
151
151
|
- CODE_OF_CONDUCT.md
|
152
152
|
- Gemfile
|
153
|
-
- Gemfile.lock
|
154
153
|
- LICENSE.txt
|
155
154
|
- README.md
|
156
155
|
- Rakefile
|
@@ -167,7 +166,7 @@ homepage: http://github.com/wtchappell/clausewitz-spelling
|
|
167
166
|
licenses:
|
168
167
|
- MIT
|
169
168
|
metadata: {}
|
170
|
-
post_install_message:
|
169
|
+
post_install_message:
|
171
170
|
rdoc_options: []
|
172
171
|
require_paths:
|
173
172
|
- lib
|
@@ -182,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
181
|
- !ruby/object:Gem::Version
|
183
182
|
version: '0'
|
184
183
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
186
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.29
|
185
|
+
signing_key:
|
187
186
|
specification_version: 4
|
188
187
|
summary: Spellchecker tool for Clausewitz engine files
|
189
188
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
clausewitz-spelling (0.2.19)
|
5
|
-
colorize
|
6
|
-
damerau-levenshtein
|
7
|
-
ffi-hunspell-wtchappell
|
8
|
-
optimist
|
9
|
-
pragmatic_tokenizer
|
10
|
-
|
11
|
-
GEM
|
12
|
-
remote: https://rubygems.org/
|
13
|
-
specs:
|
14
|
-
coderay (1.1.2)
|
15
|
-
colorize (0.8.1)
|
16
|
-
damerau-levenshtein (1.3.1)
|
17
|
-
diff-lcs (1.3)
|
18
|
-
ffi (1.11.1)
|
19
|
-
ffi-hunspell-wtchappell (0.4.0)
|
20
|
-
ffi (~> 1.0)
|
21
|
-
method_source (0.9.2)
|
22
|
-
optimist (3.0.0)
|
23
|
-
pragmatic_tokenizer (3.0.7)
|
24
|
-
unicode
|
25
|
-
pry (0.12.2)
|
26
|
-
coderay (~> 1.1.0)
|
27
|
-
method_source (~> 0.9.0)
|
28
|
-
rake (10.5.0)
|
29
|
-
rspec (3.8.0)
|
30
|
-
rspec-core (~> 3.8.0)
|
31
|
-
rspec-expectations (~> 3.8.0)
|
32
|
-
rspec-mocks (~> 3.8.0)
|
33
|
-
rspec-core (3.8.0)
|
34
|
-
rspec-support (~> 3.8.0)
|
35
|
-
rspec-expectations (3.8.2)
|
36
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.8.0)
|
38
|
-
rspec-mocks (3.8.0)
|
39
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.8.0)
|
41
|
-
rspec-support (3.8.0)
|
42
|
-
unicode (0.4.4.4)
|
43
|
-
|
44
|
-
PLATFORMS
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
bundler (~> 1.17.2)
|
49
|
-
clausewitz-spelling!
|
50
|
-
pry
|
51
|
-
rake (~> 10.0)
|
52
|
-
rspec (~> 3.0)
|
53
|
-
|
54
|
-
BUNDLED WITH
|
55
|
-
1.17.2
|