texsc 0.4.2 → 0.6.0
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/.simplecov +1 -1
- data/Gemfile +1 -1
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/bin/texsc +23 -8
- data/features/cli.feature +1 -1
- data/features/step_definitions/steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/texsc.gemspec +2 -2
- 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: 1a0b900b5f83d63e4125937fd67a0ee1f633278fe34a5a38393057fa4a604019
|
4
|
+
data.tar.gz: 2dc1b9b642e1789a7f4bdc0441c46f3bed2de18e4c59fefa93ae313ec19ed208
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b943bf18daae7bbb2d1af521a6fc2c4e2477347b4c661a90a4a0cc1f97264fa776afadecf0a68422846b48bec9abdbb241f39ddc8df362067b53077ed56a11e3
|
7
|
+
data.tar.gz: cc92c623781f8989dab859ebd07df50cd7c7757ca8f678ddc3be4c6da9065e1610fc8e29735d95a73fff715be3284e2065e897a3362b534ccc04f7c4618c529e
|
data/.simplecov
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2021 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/README.md
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
[](https://codecov.io/github/yegor256/texsc?branch=master)
|
15
15
|
[](https://hitsofcode.com/view/github/yegor256/texsc)
|
16
16
|
|
17
|
+
Read this blog post: [_Spell Check Your LaTeX Writings Using GNU Aspell_](https://www.yegor256.com/2020/10/06/latex-spell-checking.html)
|
18
|
+
|
17
19
|
This tool simplies the usage of [GNU aspell](http://aspell.net/)
|
18
20
|
(you must have it installed)
|
19
21
|
for spell-checking of LaTeX files.
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2021 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/bin/texsc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
4
|
+
# Copyright (c) 2020-2021 Yegor Bugayenko
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -21,19 +21,30 @@
|
|
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.6.0'
|
25
25
|
|
26
26
|
STDOUT.sync = true
|
27
27
|
|
28
28
|
require 'backtrace'
|
29
29
|
require 'loog'
|
30
30
|
require 'open3'
|
31
|
+
require 'shellwords'
|
31
32
|
require 'slop'
|
32
33
|
|
33
34
|
begin
|
34
35
|
log = Loog::REGULAR
|
36
|
+
args = []
|
37
|
+
if File.exist?('.texsc')
|
38
|
+
cfg = File.new('.texsc')
|
39
|
+
body = File.read(cfg)
|
40
|
+
extra = body.split(/\s+/).map(&:strip)
|
41
|
+
args += extra
|
42
|
+
puts "Found #{body.split(/\n/).length} lines in #{File.absolute_path(cfg)}"
|
43
|
+
end
|
44
|
+
args += ARGV
|
45
|
+
|
35
46
|
begin
|
36
|
-
opts = Slop.parse(
|
47
|
+
opts = Slop.parse(args, strict: true, help: true) do |o|
|
37
48
|
o.banner = "Usage (#{VERSION}): texsc [options] files
|
38
49
|
Options are:"
|
39
50
|
o.string '--pws', 'The location of aspell.en.pws file'
|
@@ -55,15 +66,17 @@ Options are:"
|
|
55
66
|
rescue Slop::Error => ex
|
56
67
|
raise ex.message
|
57
68
|
end
|
58
|
-
|
69
|
+
candidates = opts.arguments
|
70
|
+
candidates += Dir['*.tex'] if candidates.empty?
|
59
71
|
if opts[:pws]
|
60
72
|
log.debug("PWS with an additional dictionary is here: #{opts[:pws]}")
|
61
73
|
opts[:pws] = File.expand_path(opts[:pws])
|
62
74
|
log.debug("The real path of PWS is: #{opts[:pws]}")
|
75
|
+
raise "The PWS file #{opts[:pws].inspect} is not found" unless File.exist?(opts[:pws])
|
63
76
|
end
|
64
77
|
errors = 0
|
65
78
|
files = 0
|
66
|
-
|
79
|
+
candidates.each do |f|
|
67
80
|
tex = File.read(f)
|
68
81
|
ignores = opts[:ignore].map do |e|
|
69
82
|
c, o = e.split(':')
|
@@ -83,12 +96,14 @@ Options are:"
|
|
83
96
|
)
|
84
97
|
cmd = [
|
85
98
|
'aspell',
|
86
|
-
"--ignore=#{opts['min-word-length']}",
|
99
|
+
Shellwords.escape("--ignore=#{opts['min-word-length']}"),
|
87
100
|
'--dont-tex-check-comments',
|
88
101
|
'--lang=en',
|
89
102
|
'--mode=tex',
|
90
|
-
opts[:pws] ? "-p #{opts[:pws]}" : '',
|
91
|
-
ignores.map
|
103
|
+
opts[:pws] ? "-p #{Shellwords.escape(opts[:pws])}" : '',
|
104
|
+
ignores.map do |i|
|
105
|
+
"--add-tex-command '#{Shellwords.escape(i[:cmd])} #{Shellwords.escape(i[:opts])}'"
|
106
|
+
end.join(' '),
|
92
107
|
'pipe'
|
93
108
|
].join(' ')
|
94
109
|
log.debug(cmd)
|
data/features/cli.feature
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2021 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/features/support/env.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2021 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
data/texsc.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2020 Yegor Bugayenko
|
3
|
+
# Copyright (c) 2020-2021 Yegor Bugayenko
|
4
4
|
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
# of this software and associated documentation files (the 'Software'), to deal
|
@@ -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.6.0'
|
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'
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
174
|
+
rubygems_version: 3.1.2
|
175
175
|
signing_key:
|
176
176
|
specification_version: 2
|
177
177
|
summary: Spell Checker for LaTeX
|