PageRenderTime 196ms CodeModel.GetById 32ms RepoModel.GetById 3ms app.codeStats 1ms

/lib/DDG/Spice/Bible.pm

https://github.com/aembleton/zeroclickinfo-spice
Perl | 29 lines | 22 code | 7 blank | 0 comment | 3 complexity | 211092274fbf9c4173840fb63d6d8157 MD5 | raw file
  1. package DDG::Spice::Bible;
  2. use DDG::Spice;
  3. primary_example_queries "genesis 15:7";
  4. secondary_example_queries "bible genesis 26:4";
  5. description "Bible verses";
  6. name "Bible";
  7. icon_url "/i/blueletterbible.org.ico";
  8. source "Blue Letter Bible";
  9. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Bible.pm";
  10. topics "special_interest", "everyday";
  11. category "random";
  12. attribution github => ['https://github.com/hunterlang','Hunter Lang'],
  13. web => 'http://hunterlang.com/';
  14. triggers any => "bible", ":", "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";
  15. spice to => 'http://labs.bible.org/api/?type=json&callback={{callback}}&formatting=plain&passage=$1';
  16. handle query_lc => sub {
  17. 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]+)$/) {
  18. return $1 if $1;
  19. }
  20. return;
  21. };
  22. 1;