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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/polint/parser.rb +2 -2
- data/lib/polint/version.rb +1 -1
- data/spec/data/en-valid.po +1 -0
- data/spec/lib/polint/parser_spec.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5581d49373dcf898408c22673c59507e11f9b24b
|
4
|
+
data.tar.gz: 171d892f367886303386b34c33edc664e56efdaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 795013d51d2c71423f00be82b3855cd1ba9d9bc8cadb504a7596e46ec343f956acd1dc009b92ac26aadace8efdf6424dd7b225e3968bef93a745d24a22b27d48
|
7
|
+
data.tar.gz: dfd3f6fa9f36a281e3e4bb3b5263adcfa476c7546e647d09a932e94796e15d067a1bb6db39c2fb38706457e7fdaaf6082242cef2eb5e83d9a94211fa656caae5
|
data/Gemfile.lock
CHANGED
data/lib/polint/parser.rb
CHANGED
@@ -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 >>
|
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) }
|
data/lib/polint/version.rb
CHANGED
data/spec/data/en-valid.po
CHANGED
@@ -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: '
|
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: '
|
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: '
|
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:
|
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.
|
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-
|
12
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|