Module: Scripref::English
- Defined in:
- lib/scripref/english.rb
Overview
Mixin for parsing references in English.
Constant Summary collapse
- BOOK_NAMES =
Array of book names.
<<-END.strip.split(/,\s*/) Genesis, Exodus, Leviticus, Numbers, Deuteronomy, Joshua, Judges, Ruth, 1 Samuel, 2 Samuel, 1 Kings, 2 Kings, 1 Chronicles, 2 Chronicles, Ezra, Nehemiah, Esther, Job, Psalms, Proverbs, Ecclesiastes, Song of Songs, Isaiah, Jeremiah, Lamentations, Ezekiel, Daniel, Hosea, Joel, Amos, Obadiah, Jonah, Micah, Nahum, Habakkuk, Zephaniah, Haggai, Zechariah, Malachi, Matthew, Mark, Luke, John, Acts, Romans, 1 Corinthians, 2 Corinthians, Galatians, Ephesians, Philippians, Colossians, 1 Thessalonians, 2 Thessalonians, 1 Timothy, 2 Timothy, Titus, Philemon, Hebrews, James, 1 Peter, 2 Peter, 1 John, 2 John, 3 John, Jude, Revelation END
- BOOKS_RES =
Array of regular expressions to match book names.
BOOK_NAMES.map do |bn| Regexp.new(bn.gsub(/([^1-3A-Z])/, '\1?').gsub('.', '\.') << '\b\s*') end
- BOOK_RE =
Regular expression to match a book.
Regexp.new(BOOKS_RES.map {|re| '(^' << re.to_s << ')' }.join('|'))
- CV_SEPARATOR =
Separator between chapter and verse.
':'- CV_SEP_RE =
Regular expression to match a separator between chapter and verse.
/:\s*/o- HYPHEN_SEPARATOR =
Separator between a range.
'-'- HYPHEN_RE =
Regular expression to match a hyphen.
/\s*-\s*/o- PASS_SEPARATOR =
Separator between passages.
'; '- PASS_SEP_RE =
Regular expression to match a separator between passages.
/;\s*/o- VERSE_SEP_RE =
Regular expression to match a separator between verses.
/,\s*/o- VERSE_ADDON_RE =
Regular expression to match addons for a verse.
/([ab]|ff?)\s*/o- REFERENCE_RE =
Regular expression to parse a reference
/#{pass}(;\s*#{pass})*/o