texsc 0.2.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/.rubocop.yml +1 -1
- data/.travis.yml +1 -0
- data/README.md +14 -2
- data/bin/texsc +28 -7
- data/features/cli.feature +35 -2
- data/texsc.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8063e6182bac05328abe485e362722586fc8c8abc35a80c2446b389b3759924
|
4
|
+
data.tar.gz: 7c38981acf003c3c3c571a3d29f5383c03b801530cf882c47e4623192046ee4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '044273992290b54e58c86ddcbd8f378b011adc2ecefc86122bf95bd05486840b6dbc041694ac50cd3445cdb7eb161dcda7b4ea8619a070287540d53132ddaae1'
|
7
|
+
data.tar.gz: 2489a77e0cbcf9a2572b5e4a5c1855b7232c71a96f3bf722914d1b0a69c92be3ce5fe85e0363ddff86058ce45826a7bf806f5d1c89bef0a9b7c05e70ef2a59a5
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
[](https://codecov.io/github/yegor256/texsc?branch=master)
|
15
15
|
[](https://hitsofcode.com/view/github/yegor256/texsc)
|
16
16
|
|
17
|
-
This tool simplies the usage of [aspell](http://aspell.net/)
|
17
|
+
This tool simplies the usage of [GNU aspell](http://aspell.net/)
|
18
18
|
(you must have it installed)
|
19
19
|
for spell-checking of LaTeX files.
|
20
20
|
|
@@ -30,7 +30,19 @@ Then, you just run it like this for your LaTeX files:
|
|
30
30
|
$ texsc article.tex
|
31
31
|
```
|
32
32
|
|
33
|
-
You may ignore certain tags or environments using `--ignore` option
|
33
|
+
You may ignore certain tags or environments using `--ignore` option
|
34
|
+
|
35
|
+
```bash
|
36
|
+
$ texsc --ignore=citet,citep --ignore=newminted article.tex
|
37
|
+
```
|
38
|
+
|
39
|
+
You can specify the method of ignoring,
|
40
|
+
as [aspell suggests](http://aspell.net/man-html/The-Options.html#TeX_002fLaTeX-Filter)
|
41
|
+
(by default it's 'p'):
|
42
|
+
|
43
|
+
```bash
|
44
|
+
$ texsc --ignore=newminted:opp article.tex
|
45
|
+
```
|
34
46
|
|
35
47
|
You may also use your own additional dictionary, via `--pws` option.
|
36
48
|
The file must contain one word per line:
|
data/bin/texsc
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
22
|
# SOFTWARE.
|
23
23
|
|
24
|
-
VERSION = '0.
|
24
|
+
VERSION = '0.4.1'
|
25
25
|
|
26
26
|
STDOUT.sync = true
|
27
27
|
|
@@ -65,10 +65,22 @@ Options are:"
|
|
65
65
|
files = 0
|
66
66
|
opts.arguments.each do |f|
|
67
67
|
tex = File.read(f)
|
68
|
-
opts[:ignore].
|
69
|
-
|
68
|
+
ignores = opts[:ignore].map do |e|
|
69
|
+
c, o = e.split(':')
|
70
|
+
{ cmd: c, opts: o || 'p' }
|
71
|
+
end
|
72
|
+
ignores.each do |i|
|
73
|
+
tex = tex.gsub(/\\begin{#{Regexp.escape(i[:cmd])}}.+\\end{#{Regexp.escape(i[:cmd])}}/m, '')
|
70
74
|
end
|
71
75
|
log.info("Checking #{f} (#{tex.length} chars)...")
|
76
|
+
log.debug(
|
77
|
+
tex.split("\n").each_with_index.map do |t, i|
|
78
|
+
if t.start_with?('---')
|
79
|
+
log.info("Line #{i + 1} starts with '---', this may lead to unexpected errors")
|
80
|
+
end
|
81
|
+
format('%<pos>4d: %<line>s', pos: i + 1, line: t)
|
82
|
+
end.join("\n")
|
83
|
+
)
|
72
84
|
cmd = [
|
73
85
|
'aspell',
|
74
86
|
"--ignore=#{opts['min-word-length']}",
|
@@ -76,7 +88,7 @@ Options are:"
|
|
76
88
|
'--lang=en',
|
77
89
|
'--mode=tex',
|
78
90
|
opts[:pws] ? "-p #{opts[:pws]}" : '',
|
79
|
-
|
91
|
+
ignores.map { |i| "--add-tex-command '#{i[:cmd]} #{i[:opts]}'" }.join(' '),
|
80
92
|
'pipe'
|
81
93
|
].join(' ')
|
82
94
|
log.debug(cmd)
|
@@ -88,9 +100,18 @@ Options are:"
|
|
88
100
|
log.error(stderr.read)
|
89
101
|
raise "Failed to run aspell, exit code is #{status}"
|
90
102
|
end
|
91
|
-
stdout.read
|
92
|
-
|
93
|
-
|
103
|
+
out = stdout.read
|
104
|
+
if out.nil?
|
105
|
+
log.info('aspell produced no output, hm...')
|
106
|
+
else
|
107
|
+
lines = out.split("\n")
|
108
|
+
log.debug("aspell produced #{lines.length} lines of output")
|
109
|
+
lines.each_with_index do |t, i|
|
110
|
+
if t.start_with?('&')
|
111
|
+
log.info("[#{i}] #{t}")
|
112
|
+
errors += 1
|
113
|
+
end
|
114
|
+
end
|
94
115
|
end
|
95
116
|
end
|
96
117
|
files += 1
|
data/features/cli.feature
CHANGED
@@ -26,9 +26,9 @@ Feature: Command Line Processing
|
|
26
26
|
How are you, my dear friiend?
|
27
27
|
\end{document}
|
28
28
|
"""
|
29
|
-
When I run bin/texsc with "article.tex"
|
29
|
+
When I run bin/texsc with "--verbose article.tex"
|
30
30
|
Then Exit code is not zero
|
31
|
-
And Stdout contains "& friiend
|
31
|
+
And Stdout contains "& friiend "
|
32
32
|
|
33
33
|
Scenario: Bad LaTeX with PWS can be spell checked
|
34
34
|
Given I have a "article.tex" file with content:
|
@@ -74,6 +74,39 @@ Feature: Command Line Processing
|
|
74
74
|
When I run bin/texsc with "--ignore nospell article.tex"
|
75
75
|
Then Exit code is zero
|
76
76
|
|
77
|
+
Scenario: Bad LaTeX with complex --ignore can be spell checked
|
78
|
+
Given I have a "article.tex" file with content:
|
79
|
+
"""
|
80
|
+
\documentclass{article}
|
81
|
+
\begin{document}
|
82
|
+
How are you, my dear \nospell[friiend]{friiend}{friiend}?
|
83
|
+
\end{document}
|
84
|
+
"""
|
85
|
+
When I run bin/texsc with "--ignore nospell:opp article.tex"
|
86
|
+
Then Exit code is zero
|
87
|
+
|
88
|
+
Scenario: Bad LaTeX with complex --ignore can be spell checked
|
89
|
+
Given I have a "article.tex" file with content:
|
90
|
+
"""
|
91
|
+
\documentclass{article}
|
92
|
+
\begin{document}
|
93
|
+
How are you, \begin{nospell}{test}friiend\end{nospell}?
|
94
|
+
\end{document}
|
95
|
+
"""
|
96
|
+
When I run bin/texsc with "--ignore nospell:p article.tex"
|
97
|
+
Then Exit code is zero
|
98
|
+
|
99
|
+
Scenario: Bad LaTeX with complex --ignore can be spell checked
|
100
|
+
Given I have a "article.tex" file with content:
|
101
|
+
"""
|
102
|
+
\documentclass{article}
|
103
|
+
\begin{document}
|
104
|
+
How are you, \begin{Nospell*}{test}friiend\end{Nospell*}?
|
105
|
+
\end{document}
|
106
|
+
"""
|
107
|
+
When I run bin/texsc with "--ignore Nospell*:p article.tex"
|
108
|
+
Then Exit code is zero
|
109
|
+
|
77
110
|
Scenario: Bad LaTeX with too short words can be spell checked
|
78
111
|
Given I have a "article.tex" file with content:
|
79
112
|
"""
|
data/texsc.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.rubygems_version = '2.2'
|
33
33
|
s.required_ruby_version = '>= 2.3'
|
34
34
|
s.name = 'texsc'
|
35
|
-
s.version = '0.
|
35
|
+
s.version = '0.4.1'
|
36
36
|
s.license = 'MIT'
|
37
37
|
s.summary = 'Spell Checker for LaTeX'
|
38
38
|
s.description = 'Simple command-line spell checker for LaTeX documents'
|
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_runtime_dependency 'backtrace', '~> 0.3'
|
48
48
|
s.add_runtime_dependency 'loog', '~> 0.2'
|
49
49
|
s.add_runtime_dependency 'slop', '~> 4.6'
|
50
|
-
s.add_development_dependency 'codecov', '0.
|
50
|
+
s.add_development_dependency 'codecov', '0.2.8'
|
51
51
|
s.add_development_dependency 'cucumber', '~> 1.3.17'
|
52
52
|
s.add_development_dependency 'rake', '12.0.0'
|
53
53
|
s.add_development_dependency 'rubocop', '0.61.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texsc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.2.8
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.2.8
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cucumber
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|