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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 223ae6028e566b369b6848eef6374fe2bc52706a
4
- data.tar.gz: 6b9f27eee78bc4c6ca03254851e80911a9846da6
3
+ metadata.gz: 21205b3151c514f536d81a727778d0ec3ad46a48
4
+ data.tar.gz: 6869a6575b30d177406baa6a9867a7f1534eb3e4
5
5
  SHA512:
6
- metadata.gz: 2f85ed0888401fb880980fd31552720e23494ae879cc6dbc9834dc36d2ffaca33fdbaf62fa4f8856c9bc2754820c53e5701cf6ca44fb73172d452f139916d927
7
- data.tar.gz: 6261f6a48f837d69701270e0083758ded7b3a47c26eb7a4e48f5b345ce9a8ddfc1ca228afea8ac692c2ad208eaa7c625aae87f469a33d0a0c804859ad9b0383a
6
+ metadata.gz: cf00d9e8951725ad7551eafbaf9e841c8549a56d7c90a9aa7de82e158702403bcdc63816dab72f415e996bf0de8807a9e7b75c2c66b09d1690568bc0771b3871
7
+ data.tar.gz: 53d7ed2ade506a9adaa0933537884657b86e2dc89aa596a922c9b51a65a908417a041312173c6583e0dc23027eb745678920ed0fa93dea55543d88ca75d8a4d6
data/Changelog CHANGED
@@ -1,3 +1,6 @@
1
+ 0.12.0
2
+ Allow periods at the end of book abbreviations.
3
+
1
4
  0.11.0
2
5
  Add class Bookname and methods Passage#+ and Passage#-.
3
6
  Make processor working for complex contexts.
@@ -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\s*)' }.join('|'), nil)
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
@@ -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
@@ -3,7 +3,7 @@ require 'delegate'
3
3
 
4
4
  module Scripref
5
5
 
6
- VERSION = '0.11.0'
6
+ VERSION = '0.12.0'
7
7
 
8
8
  autoload :Bookname, 'scripref/bookname'
9
9
  autoload :English, 'scripref/english'
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.11.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-01-26 00:00:00.000000000 Z
11
+ date: 2017-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rim