bbl

Read, search and index the Bible on the command line -- Greek, Latin, KJV, Knox, RSV, and more
git clone git://git.wilsonrgheen.com/bbl
Log | Files | Refs | README | LICENSE

drbget.vim (3186B)


      1 let books = ['Genesis', 'Exodus', 'Leviticus', 'Numbers', 'Deuteronomy', 'Josue', 'Judges', 'Ruth', '1 Kings', '2 Kings', '3 Kings', '4 Kings', '1 Paralipomena', '2 Paralipomena', '1 Esdras', '2 Esdras', 'Tobias', 'Judith', 'Esther', 'Job', 'Psalms', 'Proverbs', 'Ecclesiastes', 'Song of Songs', 'Wisdom', 'Ecclesiasticus', 'Isaiah', 'Jeremiah', 'Lamentations', 'Baruch', 'Ezechiel', 'Daniel', 'Osee', 'Joel', 'Amos', 'Abdias', 'Jonas', 'Michaeas', 'Nahum', 'Habacuc', 'Sophonias', 'Aggaeus', 'Zacharias', 'Malachias', '1 Machabees', '2 Machabees', 'Matthew', 'Mark', 'Luke', 'John', 'The 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', 'Apocalypse']
      2 let abbrs = ['Gen', 'Ex', 'Lev', 'Num', 'Dt', 'Jos', 'Jdg', 'Ruth', '1Ki', '2Ki', '3Ki', '4Ki', '1Par', '2Par', 'Esd', 'Neh', 'Tob', 'Jdt', 'Est', 'Job', 'Ps', 'Prv', 'Eccles', 'Cant', 'Wis', 'Ecclus', 'Is', 'Jer', 'Lam', 'Bar', 'Eze', 'Dan', 'Os', 'Joel', 'Amos', 'Abd', 'Jon', 'Mic', 'Nah', 'Hab', 'Sop', 'Agg', 'Zac', 'Mal', '1Mac', '2Mac', 'Mt', 'Mk', 'Lk', 'Jn', 'Acts', 'Rom', '1Cor', '2Cor', 'Gal', 'Eph', 'Phil', 'Col', '1Thess', '2Thess', '1Tim', '2Tim', 'Tit', 'Phm', 'Heb', 'Jas', '1Pet', '2Pet', '1Jn', '2Jn', '3Jn', 'Jude', 'Apoc']
      3 
      4 " https://github.com/thenewmantis/bbl.git
      5 " This script is intended to pull all verses of the Douay-Rheims Bible from the web into plain text, with one verse per line, in the following format: (e.g.)
      6 " Exodus	Exo	2	5	20	And they met Moses and Aaron, who stood over against them as they came out from Pharao:
      7 " The operation of this script is, of course, dependent on the website that hosts the content keeping its URLS and HTML the same, or at least still compatible with the regex used.
      8 " Please feel free to modify and reuse this script or another one like it in order to versify any text you find online
      9 " Every line in the resulting file should match the following regex (typed exactly as it would be in a Vimscript command (but ignore the surrounding whitespace)):
     10 "                      ^\%(\%([1-4] \|The \|Song of \)\?\a\+\|Sirach (Ecclesiasticus)\)\t\%([1-4]\)\?\a\+\t\d\{1,2}\t\d\{1,3}\t\d\{1,3}\t\D\+$
     11 " To run this script successfully, open an empty Vim buffer in the directory that this script is placed, give the buffer a filename and run the following ex command (from the empty buffer):
     12 " :source drbget.vim
     13 
     14 for b in range(len(books))
     15     let c = 1
     16     while 1
     17         exe printf('!curl -Lf ''http://drbo.org/chapter/%02d%03d.htm'' > drb_output.log', b+1, c)
     18         !awk '/\<a href="\/cgi-bin/' drb_output.log | perl -pe 's/<.*?>|[\[\]]//g' > drb_verses.log; [ -s drb_verses.log ]
     19 
     20         if v:shell_error == 0
     21             let verses = readfile('drb_verses.log')
     22 
     23             for verse in verses
     24                 let verseText = substitute(verse, '\d\+\W\?\s*', '', '')
     25                 pu =books[b].'	'.abbrs[b].'	'.(b+1).'	'.c.'	'.str2nr(verse).'	'.verseText
     26 			endfor
     27 
     28 			let c += 1
     29         else
     30             break
     31         endif
     32     endw
     33 endfor
     34 w