texsc 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/texsc +14 -11
  3. data/features/cli.feature +11 -0
  4. data/texsc.gemspec +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f0e7863fdd9141c6d4d448b60e0feabc45b48bfa2652a93a6bce2cc39fd6087
4
- data.tar.gz: 80a989ea2b50f79af5860bb396cbd4a0a6d47aaa9a6bcd368296004c8972b29e
3
+ metadata.gz: 7a9ce196f041bb2f75dfbc277670ce33f4d9583e64603fbc3721b4506bd80667
4
+ data.tar.gz: 324d0dcff1ddd4ca59466d597940be991bb252fa781b36ba7fa46d5f10791011
5
5
  SHA512:
6
- metadata.gz: dc4ee93d540b0fce8255a43bc4c7f1f744de57cd9e38b93f548af9fcc7857d6d8b25bdb3e2012e80a79b3c6c998ec752000a3473aa91919afec550882f0870b9
7
- data.tar.gz: 2d430663f77c0726fc498026dfbad83e94424f0d272f506ff0c2082c23dcebe0ab250d1e665df7e731b9cd2018b79fcf6b5cf04dd4bee2ba5442df345603bbb4
6
+ metadata.gz: 8f0d81dd04f8cf8290747163a133f294ea7d4cb8a10aa04211a8efe56c3bb06ba3a8ec32827043cf91d7e2e6a5e91047d792cd12eaa43010bc4de3eeb36f085c
7
+ data.tar.gz: c52b375086fcd1e6e3b5167295fe49849095ddd79b8ea564318bb823fa845f4566ecf10d6053cfe2e49c4b36bd4f67ebe416b50ee05431d9b799724ccb06e057
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.3.0'
24
+ VERSION = '0.3.1'
25
25
 
26
26
  STDOUT.sync = true
27
27
 
@@ -65,8 +65,12 @@ Options are:"
65
65
  files = 0
66
66
  opts.arguments.each do |f|
67
67
  tex = File.read(f)
68
- opts[:ignore].each do |e|
69
- tex = tex.gsub(/\\begin{#{e}}.+\\end{#{e}}/m, '')
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{#{i[:cmd]}}.+\\end{#{i[:cmd]}}/m, '')
70
74
  end
71
75
  log.info("Checking #{f} (#{tex.length} chars)...")
72
76
  cmd = [
@@ -76,11 +80,7 @@ Options are:"
76
80
  '--lang=en',
77
81
  '--mode=tex',
78
82
  opts[:pws] ? "-p #{opts[:pws]}" : '',
79
- opts[:ignore].map do |e|
80
- cmd, opts = e.split(':')
81
- opts = 'p' if opts.nil?
82
- "--add-tex-command '#{cmd} #{opts}'"
83
- end.join(' '),
83
+ ignores.map { |i| "--add-tex-command '#{i[:cmd]} #{i[:opts]}'" }.join(' '),
84
84
  'pipe'
85
85
  ].join(' ')
86
86
  log.debug(cmd)
@@ -92,9 +92,12 @@ Options are:"
92
92
  log.error(stderr.read)
93
93
  raise "Failed to run aspell, exit code is #{status}"
94
94
  end
95
- stdout.read.split("\n").select { |t| t.start_with?('&') }.each do |t|
96
- log.info(t)
97
- errors += 1
95
+ out = stdout.read
96
+ unless out.nil?
97
+ out.split("\n").select { |t| t.start_with?('&') }.each do |t|
98
+ log.info(t)
99
+ errors += 1
100
+ end
98
101
  end
99
102
  end
100
103
  files += 1
@@ -85,6 +85,17 @@ Feature: Command Line Processing
85
85
  When I run bin/texsc with "--ignore nospell:opp article.tex"
86
86
  Then Exit code is zero
87
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
+
88
99
  Scenario: Bad LaTeX with too short words can be spell checked
89
100
  Given I have a "article.tex" file with content:
90
101
  """
@@ -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.3.0'
35
+ s.version = '0.3.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'
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.3.0
4
+ version: 0.3.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-08-02 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace