polint 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 230c13623db8e5c272c96404b565e76d1149e11b
4
- data.tar.gz: 8d70271797b9a0342001833308874f11e8b24ed7
3
+ metadata.gz: 5581d49373dcf898408c22673c59507e11f9b24b
4
+ data.tar.gz: 171d892f367886303386b34c33edc664e56efdaa
5
5
  SHA512:
6
- metadata.gz: d7d72c3db3edbcc9d4bf52a18bcb316206361f0e28f0e8fcdd80e0f5d2e24ff5c59a48bb0e50546dc56218715d7c2c76a09cb6f5bf182c83ea1995fd78ff9f4f
7
- data.tar.gz: 279c37ba16b2dfb3ba1eea26645c9a44a05002c10ba2f1ae9e628351c617e19413a04065f14302f026e21eac43fca42e0e26841c81c17fd5b9d468b510274a7c
6
+ metadata.gz: 795013d51d2c71423f00be82b3855cd1ba9d9bc8cadb504a7596e46ec343f956acd1dc009b92ac26aadace8efdf6424dd7b225e3968bef93a745d24a22b27d48
7
+ data.tar.gz: dfd3f6fa9f36a281e3e4bb3b5263adcfa476c7546e647d09a932e94796e15d067a1bb6db39c2fb38706457e7fdaaf6082242cef2eb5e83d9a94211fa656caae5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polint (0.2.1)
4
+ polint (0.2.2)
5
5
  parslet (~> 1.7, >= 1.7.1)
6
6
  term-ansicolor
7
7
 
@@ -33,7 +33,7 @@ module Polint
33
33
  rule(:flag) { str(',') >> lwsp >> match(/[a-z\-]/).repeat(1).as(:flag) >> lwsp }
34
34
  rule(:flag_comment) { start_comment >> flag.repeat(1).as(:flags) >> endl }
35
35
  rule(:reference_comment) { start_comment >> str(':') >> lwsp >> match(/[^\n]/).repeat.as(:reference) >> endl }
36
- rule(:unparsed_comment) { start_comment >> (match(/[^~]/) >> lwsp >> match(/[^\n]/).repeat).as(:comment) >> endl }
36
+ rule(:unparsed_comment) { start_comment >> match(/[^~]/) >> lwsp >> match(/[^\n]/).repeat.as(:comment) >> endl }
37
37
  rule(:comment) { flag_comment | reference_comment | unparsed_comment }
38
38
  rule(:comments) { comment.repeat }
39
39
 
@@ -47,7 +47,7 @@ module Polint
47
47
  rule(:translations) { translation.repeat }
48
48
 
49
49
  rule(:obsolete_line) { start_comment >> str('~') >> lwsp >> match(/[^\n]/).repeat >> endl }
50
- rule(:obsolete_translation) { obsolete_line.repeat(1).as(:obsolete_translation) >> blank_line }
50
+ rule(:obsolete_translation) { (comment.repeat >> obsolete_line.repeat(1).as(:text)).as(:obsolete_translation) >> blank_line }
51
51
  rule(:obsolete_translations) { obsolete_translation.repeat }
52
52
 
53
53
  rule(:file) { (headers >> translations >> obsolete_translations).as(:file) }
@@ -1,3 +1,3 @@
1
1
  module Polint
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -17,6 +17,7 @@ msgid_plural "Hello %{n} Worlds Plural"
17
17
  msgstr[0] "Hello World Plural"
18
18
  msgstr[1] "Hello %{n} Worlds Plural"
19
19
 
20
+ # comment on obsolete translation
20
21
  #~ msgid "Obsolete Translation"
21
22
  #~ msgstr "Obsolete Translation"
22
23
 
@@ -94,17 +94,17 @@ RSpec.describe Polint::Parser do
94
94
 
95
95
  context 'when matching a translator comment' do
96
96
  let(:line) { '# no semantics here' }
97
- it { expect(tree).to eq comment: ' no semantics here' }
97
+ it { expect(tree).to eq comment: 'no semantics here' }
98
98
  end
99
99
 
100
100
  context 'when matching an extracted comment' do
101
101
  let(:line) { '#. no semantics here' }
102
- it { expect(tree).to eq comment: '. no semantics here' }
102
+ it { expect(tree).to eq comment: 'no semantics here' }
103
103
  end
104
104
 
105
105
  context 'when matching a previous translation comment' do
106
106
  let(:line) { '#| no semantics here' }
107
- it { expect(tree).to eq comment: '| no semantics here' }
107
+ it { expect(tree).to eq comment: 'no semantics here' }
108
108
  end
109
109
 
110
110
  context 'when matching an obsolete translation' do
@@ -286,12 +286,16 @@ RSpec.describe Polint::Parser do
286
286
  context 'when matching a singular single-line msgstr with comments' do
287
287
  let(:lines) {
288
288
  [
289
+ '# comment on obsolete translation',
289
290
  '#~ msgid "Hello World"',
290
291
  '#~ msgstr "Hello World"'
291
292
  ]
292
293
  }
293
294
  it {
294
- expect(tree).to eq obsolete_translation: line
295
+ expect(tree).to eq obsolete_translation: [
296
+ { comment: 'comment on obsolete translation' },
297
+ { text: %{#~ msgid "Hello World"\n#~ msgstr "Hello World"} }
298
+ ]
295
299
  }
296
300
  end
297
301
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Letessier
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-22 00:00:00.000000000 Z
12
+ date: 2016-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler