pericope 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +5 -1
- data/lib/pericope.rb +11 -5
- data/lib/pericope/version.rb +1 -1
- metadata +1 -1
data/README.mdown
CHANGED
@@ -48,10 +48,14 @@ It recognizes common abbreviations and misspellings for names of the books of th
|
|
48
48
|
|
49
49
|
# History
|
50
50
|
|
51
|
+
# 0.6.1
|
52
|
+
|
53
|
+
- Deprecated the `report` and `extract` methods (they will be removed in 0.7.0)
|
54
|
+
|
51
55
|
# 0.6.0
|
52
56
|
|
53
57
|
- Removed the `index` attribute
|
54
|
-
- Deprecated the `pattern` argument to the method `Pericope.split(text, pattern=nil)`
|
58
|
+
- Deprecated the `pattern` argument to the method `Pericope.split(text, pattern=nil)` (it will be removed in 0.7.0)
|
55
59
|
- Improved performance by 2x
|
56
60
|
- Added this README
|
57
61
|
- Fixed a bug with parsing inverted [invalid] ranges (e.g. Mark 3-1)
|
data/lib/pericope.rb
CHANGED
@@ -126,6 +126,7 @@ class Pericope
|
|
126
126
|
|
127
127
|
|
128
128
|
def self.extract(text)
|
129
|
+
puts "DEPRECATION NOTICE: the 'extract' method will be removed in Pericope 0.7.0"
|
129
130
|
segments = split(text)
|
130
131
|
text = ""
|
131
132
|
pericopes = []
|
@@ -170,6 +171,7 @@ class Pericope
|
|
170
171
|
|
171
172
|
|
172
173
|
def report
|
174
|
+
puts "DEPRECATION NOTICE: the 'report' method will be removed in Pericope 0.7.0"
|
173
175
|
" #{self.original_string} => #{self}"
|
174
176
|
end
|
175
177
|
|
@@ -405,14 +407,12 @@ private
|
|
405
407
|
|
406
408
|
def self.parse_reference(book, reference)
|
407
409
|
reference = normalize_reference(reference)
|
408
|
-
|
410
|
+
parse_ranges(book, reference.split(/[,;]/))
|
409
411
|
end
|
410
412
|
|
411
413
|
def self.normalize_reference(reference)
|
412
|
-
|
413
|
-
|
414
|
-
[%r{[^0-9,:;\-–—]},''] # remove everything but [0-9,;:-]
|
415
|
-
].each { |pattern, replacement| reference.gsub!(pattern, replacement) }
|
414
|
+
reference = reference.to_s
|
415
|
+
NORMALIZATIONS.each { |(regex, replacement)| reference.gsub!(regex, replacement) }
|
416
416
|
reference
|
417
417
|
end
|
418
418
|
|
@@ -594,6 +594,12 @@ private
|
|
594
594
|
|
595
595
|
PERICOPE_PATTERN = /(#{BOOK_PATTERN})\.? (#{REFERENCE_PATTERN})/i
|
596
596
|
|
597
|
+
NORMALIZATIONS = [
|
598
|
+
[/(\d+)[".](\d+)/, '\1:\2'], # 12"5 and 12.5 -> 12:5
|
599
|
+
[/[–—]/, '-'], # convert em dash and en dash to -
|
600
|
+
[/[^0-9,:;\-–—]/, ''] # remove everything but [0-9,;:-]
|
601
|
+
]
|
602
|
+
|
597
603
|
|
598
604
|
|
599
605
|
end
|
data/lib/pericope/version.rb
CHANGED