scripref 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +3 -0
- data/lib/scripref/basic_methods.rb +1 -1
- data/lib/scripref/parser.rb +1 -0
- data/lib/scripref.rb +1 -1
- data/test/test_parser.rb +14 -0
- 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: 21205b3151c514f536d81a727778d0ec3ad46a48
|
4
|
+
data.tar.gz: 6869a6575b30d177406baa6a9867a7f1534eb3e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf00d9e8951725ad7551eafbaf9e841c8549a56d7c90a9aa7de82e158702403bcdc63816dab72f415e996bf0de8807a9e7b75c2c66b09d1690568bc0771b3871
|
7
|
+
data.tar.gz: 53d7ed2ade506a9adaa0933537884657b86e2dc89aa596a922c9b51a65a908417a041312173c6583e0dc23027eb745678920ed0fa93dea55543d88ca75d8a4d6
|
data/Changelog
CHANGED
@@ -24,7 +24,7 @@ module Scripref
|
|
24
24
|
(n.gsub(/([^\dA-Z])/, '\1?').gsub('.', '\.'))
|
25
25
|
end
|
26
26
|
end.flatten
|
27
|
-
@book_re = Regexp.compile(books_res_as_strings.map {|s| '(\b' << s << '\b
|
27
|
+
@book_re = Regexp.compile(books_res_as_strings.map {|s| '(\b' << s << '\b\.?\s*)' }.join('|'), nil)
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
data/lib/scripref/parser.rb
CHANGED
@@ -244,6 +244,7 @@ module Scripref
|
|
244
244
|
|
245
245
|
def abbrev2book str
|
246
246
|
s = str.strip
|
247
|
+
s.sub! /\.$/, ''
|
247
248
|
@books_str ||= ('#' << book_names.map(&:names).flatten.join('#') << '#')
|
248
249
|
pattern = s.chars.map {|c| Regexp.escape(c) << '[^#]*'}.join
|
249
250
|
re = /(?<=#)#{pattern}(?=#)/
|
data/lib/scripref.rb
CHANGED
data/test/test_parser.rb
CHANGED
@@ -15,6 +15,20 @@ class TestParser < Test::Unit::TestCase
|
|
15
15
|
assert_parsed_ast_for_text [pass(text, 8, nil, nil, 8, nil, nil)], text
|
16
16
|
end
|
17
17
|
|
18
|
+
def test_book_abbrev
|
19
|
+
text = 'Ru'
|
20
|
+
assert_parsed_ast_for_text [pass(text, 8, nil, nil, 8, nil, nil)], text
|
21
|
+
text = 'Offb'
|
22
|
+
assert_parsed_ast_for_text [pass(text, 66, nil, nil, 66, nil, nil)], text
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_book_abbrev_with_period
|
26
|
+
text = 'Ru.'
|
27
|
+
assert_parsed_ast_for_text [pass(text, 8, nil, nil, 8, nil, nil)], text
|
28
|
+
text = 'Offb.'
|
29
|
+
assert_parsed_ast_for_text [pass(text, 66, nil, nil, 66, nil, nil)], text
|
30
|
+
end
|
31
|
+
|
18
32
|
def test_ambiguous_book
|
19
33
|
msg = 'Abbreviation Jo is ambiguous it matches Josua, Joel, Jona, Johannes, Jakobus!'
|
20
34
|
assert_parser_error msg do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scripref
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Friedrich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rim
|