texsc 0.3.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a9ce196f041bb2f75dfbc277670ce33f4d9583e64603fbc3721b4506bd80667
4
- data.tar.gz: 324d0dcff1ddd4ca59466d597940be991bb252fa781b36ba7fa46d5f10791011
3
+ metadata.gz: 287fe4226d8590443fd5fdc6e6f1484f958ebc59fa995b144dd3810e96eb7568
4
+ data.tar.gz: 5a4cc39bd64baece9b719e30e181c7362ace4c6768562d117a8501aed0efc46f
5
5
  SHA512:
6
- metadata.gz: 8f0d81dd04f8cf8290747163a133f294ea7d4cb8a10aa04211a8efe56c3bb06ba3a8ec32827043cf91d7e2e6a5e91047d792cd12eaa43010bc4de3eeb36f085c
7
- data.tar.gz: c52b375086fcd1e6e3b5167295fe49849095ddd79b8ea564318bb823fa845f4566ecf10d6053cfe2e49c4b36bd4f67ebe416b50ee05431d9b799724ccb06e057
6
+ metadata.gz: 6ca3c9aa54f93f8cc592f89210889fb85c7d2078c461465d0fd0a20189a95852ab50524fbf267c443d7eca8ba4264c9d8fec1fcd19e9897928ee0b524c095430
7
+ data.tar.gz: 23481f20b3e4be353df48a77ec4fab49f689465b9fc2f92b8ff3c2ca557136a6969bb65ae7ffc1c7129128aeb5464d93efb341b3bd85bcd41b8413c67a714d05
@@ -11,7 +11,7 @@ Layout/EndOfLine:
11
11
  Style/MultilineTernaryOperator:
12
12
  Enabled: false
13
13
  Metrics/BlockLength:
14
- Max: 50
14
+ Max: 60
15
15
  Layout/AlignParameters:
16
16
  Enabled: false
17
17
  Layout/EmptyLineAfterGuardClause:
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.1'
24
+ VERSION = '0.4.3'
25
25
 
26
26
  STDOUT.sync = true
27
27
 
@@ -60,6 +60,7 @@ Options are:"
60
60
  log.debug("PWS with an additional dictionary is here: #{opts[:pws]}")
61
61
  opts[:pws] = File.expand_path(opts[:pws])
62
62
  log.debug("The real path of PWS is: #{opts[:pws]}")
63
+ raise "The PWS file #{opts[:pws].inspect} is not found" unless File.exist?(opts[:pws])
63
64
  end
64
65
  errors = 0
65
66
  files = 0
@@ -70,9 +71,17 @@ Options are:"
70
71
  { cmd: c, opts: o || 'p' }
71
72
  end
72
73
  ignores.each do |i|
73
- tex = tex.gsub(/\\begin{#{i[:cmd]}}.+\\end{#{i[:cmd]}}/m, '')
74
+ tex = tex.gsub(/\\begin{#{Regexp.escape(i[:cmd])}}.+\\end{#{Regexp.escape(i[:cmd])}}/m, '')
74
75
  end
75
76
  log.info("Checking #{f} (#{tex.length} chars)...")
77
+ log.debug(
78
+ tex.split("\n").each_with_index.map do |t, i|
79
+ if t.start_with?('---')
80
+ log.info("Line #{i + 1} starts with '---', this may lead to unexpected errors")
81
+ end
82
+ format('%<pos>4d: %<line>s', pos: i + 1, line: t)
83
+ end.join("\n")
84
+ )
76
85
  cmd = [
77
86
  'aspell',
78
87
  "--ignore=#{opts['min-word-length']}",
@@ -93,10 +102,16 @@ Options are:"
93
102
  raise "Failed to run aspell, exit code is #{status}"
94
103
  end
95
104
  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
105
+ if out.nil?
106
+ log.info('aspell produced no output, hm...')
107
+ else
108
+ lines = out.split("\n")
109
+ log.debug("aspell produced #{lines.length} lines of output")
110
+ lines.each_with_index do |t, i|
111
+ if t.start_with?('&')
112
+ log.info("[#{i}] #{t}")
113
+ errors += 1
114
+ end
100
115
  end
101
116
  end
102
117
  end
@@ -26,7 +26,7 @@ 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
31
  And Stdout contains "& friiend "
32
32
 
@@ -96,6 +96,17 @@ Feature: Command Line Processing
96
96
  When I run bin/texsc with "--ignore nospell:p article.tex"
97
97
  Then Exit code is zero
98
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
+
99
110
  Scenario: Bad LaTeX with too short words can be spell checked
100
111
  Given I have a "article.tex" file with content:
101
112
  """
@@ -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.1'
35
+ s.version = '0.4.3'
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'
@@ -46,8 +46,8 @@ Gem::Specification.new do |s|
46
46
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
47
47
  s.add_runtime_dependency 'backtrace', '~> 0.3'
48
48
  s.add_runtime_dependency 'loog', '~> 0.2'
49
- s.add_runtime_dependency 'slop', '~> 4.6'
50
- s.add_development_dependency 'codecov', '0.1.10'
49
+ s.add_runtime_dependency 'slop', '~> 4.8'
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.3.1
4
+ version: 0.4.3
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-07 00:00:00.000000000 Z
11
+ date: 2020-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.6'
47
+ version: '4.8'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.6'
54
+ version: '4.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: codecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.10
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.1.10
68
+ version: 0.2.8
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: cucumber
71
71
  requirement: !ruby/object:Gem::Requirement