PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/DDG/Spice/Bible.pm

http://github.com/duckduckgo/zeroclickinfo-spice
Perl | 22 lines | 16 code | 5 blank | 1 comment | 5 complexity | 1236deba8335929dae4f38cc1783687b MD5 | raw file
Possible License(s): Apache-2.0
  1. package DDG::Spice::Bible;
  2. # ABSTRACT: Bible citations
  3. use strict;
  4. use DDG::Spice;
  5. my @triggers = share('triggers.txt')->slurp;
  6. triggers any => @triggers;
  7. spice to => 'http://labs.bible.org/api/?type=json&callback={{callback}}&formatting=plain&passage=$1';
  8. handle query_lc => sub {
  9. if ($_ =~ /^bible\s+([a-z]+\s*?[0-9]+:[0-9]+)$/i || $_ =~ /^((?:genesis|exodus|leviticus|numbers|deuteronomy|joshua|judges|ruth|1 samuel|2 samuel|1 kings|2 kings|1 chronicles|2 chronicles|ezra|nehemiah|esther|job|psalm|proverbs|ecclesiastes|song of solomon|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)\s+[0-9]+:[0-9]+)$/) {
  10. return $1 if $1;
  11. }
  12. if ($_ =~ /^bible\s+(verse of the day|verse of today)$/i || $_ =~ /^verse\s+(of the day|of today)$/i) {
  13. return 'votd';
  14. }
  15. return;
  16. };
  17. 1;