spellr 0.8.4 → 0.8.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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +10 -3
- data/lib/spellr/check.rb +1 -0
- data/lib/spellr/token_regexps.rb +1 -0
- data/lib/spellr/tokenizer.rb +4 -2
- data/lib/spellr/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80438eca6b5b281ceab331e0ab9886fcb9c622cfe1e91ca2762ed10628c44ee1
|
4
|
+
data.tar.gz: 434910ca88653cb6a7d4bb11dabc32e4c782b22df4e65cc488ebaf6439bb3b38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b14f3fe397b01f9a7e1742246a451e68238833c98e98b6716e36a11bb38d556463d992a0cdb8577f2dac2b65bb39eb0a9f3d050f884814c7449d0b6d2239e013
|
7
|
+
data.tar.gz: 45fe01c33fd31faafd21248751f2a85f38c3807b75eb242fa994ffbdd14735f2dde343cf397b5f14281a24107ca5532d45b4c107b720546ac4994121c5599e58
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -175,14 +175,21 @@ Type `e` to add this word to the english wordlist and continue on through the sp
|
|
175
175
|
|
176
176
|
### Disabling the tokenizer
|
177
177
|
|
178
|
-
If the tokenizer finds a word you don't want to add to the wordlist (perhaps it's an intentional example of a typo, or a non-word string not excluded by the heuristic) then
|
178
|
+
If the tokenizer finds a word you don't want to add to the wordlist (perhaps it's an intentional example of a typo, or a non-word string not excluded by the heuristic) then add any kind of comment containing `spellr:disable-line` to the line.
|
179
|
+
```ruby
|
180
|
+
open('mispeled_filename.txt') # spellr:disable-line
|
181
|
+
```
|
182
|
+
|
183
|
+
You can also disable multiple lines, by surrounding the offending code with `spellr:disable` and `spellr:enable`
|
179
184
|
```ruby
|
180
185
|
# spellr:disable
|
181
|
-
"Test typo of the: teh"
|
186
|
+
it "Test typo of the: teh" do
|
187
|
+
fill_in(field, with: "teh")
|
188
|
+
end
|
182
189
|
# spellr:enable
|
183
190
|
```
|
184
191
|
|
185
|
-
|
192
|
+
If your language supports inline comments you can also surround with `spellr:disable` and `spellr:enable` in the same line:
|
186
193
|
```html
|
187
194
|
<span><!-- spellr:disable -->nonsenseword<!-- spellr:enable --></span>
|
188
195
|
```
|
data/lib/spellr/check.rb
CHANGED
data/lib/spellr/token_regexps.rb
CHANGED
data/lib/spellr/tokenizer.rb
CHANGED
@@ -28,7 +28,7 @@ module Spellr
|
|
28
28
|
|
29
29
|
def each_term(&block)
|
30
30
|
file.each_line do |line|
|
31
|
-
prepare_tokenizer_for_line(line)
|
31
|
+
prepare_tokenizer_for_line(line)&.each_term(&block)
|
32
32
|
end
|
33
33
|
ensure
|
34
34
|
file.close
|
@@ -36,7 +36,7 @@ module Spellr
|
|
36
36
|
|
37
37
|
def each_token(skip_term_proc: nil) # rubocop:disable Metrics/MethodLength
|
38
38
|
each_line_with_stats do |line, line_number, char_offset, byte_offset|
|
39
|
-
prepare_tokenizer_for_line(line)
|
39
|
+
prepare_tokenizer_for_line(line)&.each_token(skip_term_proc: skip_term_proc) do |token|
|
40
40
|
token.line = prepare_line(line, line_number, char_offset, byte_offset)
|
41
41
|
|
42
42
|
yield token
|
@@ -75,6 +75,8 @@ module Spellr
|
|
75
75
|
attr_reader :line_tokenizer
|
76
76
|
|
77
77
|
def prepare_tokenizer_for_line(line)
|
78
|
+
return if line.match?(Spellr::TokenRegexps::SPELLR_LINE_DISABLE_RE)
|
79
|
+
|
78
80
|
line_tokenizer.string = line
|
79
81
|
line_tokenizer.pos = 0
|
80
82
|
line_tokenizer
|
data/lib/spellr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spellr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -315,8 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
315
|
- !ruby/object:Gem::Version
|
316
316
|
version: '0'
|
317
317
|
requirements: []
|
318
|
-
|
319
|
-
rubygems_version: 2.7.10
|
318
|
+
rubygems_version: 3.0.8
|
320
319
|
signing_key:
|
321
320
|
specification_version: 4
|
322
321
|
summary: Spell check your source code
|