|
|
@ -2,56 +2,121 @@ |
|
|
|
|
|
|
|
|
|
|
|
(in-package #:cl-bible.data) |
|
|
|
(in-package #:cl-bible.data) |
|
|
|
|
|
|
|
|
|
|
|
(defun init-bible (&optional (bible "mng")) |
|
|
|
|
|
|
|
(mapcar #'v:string-to-verse |
|
|
|
|
|
|
|
(uiop:read-file-lines |
|
|
|
|
|
|
|
(asdf:system-relative-pathname |
|
|
|
|
|
|
|
"cl-bible" |
|
|
|
|
|
|
|
(format nil "resources/~A.tsv" bible))))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun load-bible (filename) |
|
|
|
(defun load-bible (filename) |
|
|
|
(v:from-sexp |
|
|
|
(v:from-sexp |
|
|
|
(read-from-string |
|
|
|
(read-from-string |
|
|
|
(uiop:read-file-string (uiop:native-namestring filename))))) |
|
|
|
(uiop:read-file-string (uiop:native-namestring filename))))) |
|
|
|
|
|
|
|
|
|
|
|
(defvar *mng*) |
|
|
|
(defvar *translation* :mng) |
|
|
|
(defvar *vul*) |
|
|
|
|
|
|
|
(defvar *grb*) |
|
|
|
|
|
|
|
(defvar *kjv*) |
|
|
|
|
|
|
|
(defvar *bible*) |
|
|
|
(defvar *bible*) |
|
|
|
|
|
|
|
|
|
|
|
(defun load-bibles () |
|
|
|
(defun load-bibles () |
|
|
|
(ensure-directories-exist (uiop:native-namestring "~/.bible/")) |
|
|
|
(ensure-directories-exist (uiop:native-namestring "~/.bible/")) |
|
|
|
(if (uiop:file-exists-p (uiop:native-namestring "~/.bible/menge.sexp")) |
|
|
|
(if (uiop:file-exists-p (uiop:native-namestring "~/.bible/bible.sexp")) |
|
|
|
(progn |
|
|
|
(setf *bible* (load-bible "~/.bible/bible.sexp")) |
|
|
|
(setf *mng* (load-bible "~/.bible/menge.sexp")) |
|
|
|
(setf *bible* |
|
|
|
(setf *vul* (load-bible "~/.bible/vulgata.sexp")) |
|
|
|
(load-bible |
|
|
|
(setf *grb* (load-bible "~/.bible/greek.sexp")) |
|
|
|
(asdf:system-relative-pathname :cl-bible |
|
|
|
(setf *kjv* (load-bible "~/.bible/kjv.sexp"))) |
|
|
|
"resources/bible.sexp"))))) |
|
|
|
(progn |
|
|
|
|
|
|
|
(setf *mng* (init-bible "mng")) |
|
|
|
|
|
|
|
(setf *kjv* (init-bible "kjv")) |
|
|
|
|
|
|
|
(setf *vul* (init-bible "vul")) |
|
|
|
|
|
|
|
(setf *grb* (init-bible "grb"))))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(load-bibles) |
|
|
|
(load-bibles) |
|
|
|
|
|
|
|
|
|
|
|
(defun update-bible (str) |
|
|
|
(defun update-bible (translation) |
|
|
|
(let ((bibles `(("mng" . ,*mng*) |
|
|
|
(setf *translation* (intern translation :keyword))) |
|
|
|
("kjv" . ,*kjv*) |
|
|
|
|
|
|
|
("vul" . ,*vul*) |
|
|
|
|
|
|
|
("grb" . ,*grb*)))) |
|
|
|
|
|
|
|
(setf *bible* (cdr (assoc str bibles :test #'string=))))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun persist-bible (bible filename) |
|
|
|
(defun persist-bible (bible filename filepath) |
|
|
|
(with-open-file (file (uiop:native-namestring (concatenate 'string "~/.bible/" filename ".sexp")) |
|
|
|
(with-open-file (file (uiop:native-namestring (concatenate 'string filepath filename ".sexp")) |
|
|
|
:direction :output |
|
|
|
:direction :output |
|
|
|
:if-exists :overwrite |
|
|
|
:if-exists :overwrite |
|
|
|
:if-does-not-exist :create) |
|
|
|
:if-does-not-exist :create) |
|
|
|
(print (v:to-sexp bible) file))) |
|
|
|
(print (v:to-sexp bible) file))) |
|
|
|
|
|
|
|
|
|
|
|
(defun persist () |
|
|
|
(defun persist (&optional (filepath "~/.bible/")) |
|
|
|
(let ((bibles (list *mng* *vul* *grb* *kjv*)) |
|
|
|
(ensure-directories-exist (uiop:native-namestring filepath)) |
|
|
|
(files '("menge" "vulgata" "greek" "kjv"))) |
|
|
|
(persist-bible *bible* "bible" filepath)) |
|
|
|
(ensure-directories-exist (uiop:native-namestring "~/.bible/")) |
|
|
|
|
|
|
|
(mapcar #'persist-bible bibles files))) |
|
|
|
(defvar mapping '(("Genesis" . "Genesis") |
|
|
|
|
|
|
|
("Exodus" . "Exodus") |
|
|
|
|
|
|
|
("Levitikus" . "Levitikus") |
|
|
|
|
|
|
|
("Numeri" . "Numeri") |
|
|
|
|
|
|
|
("Deuteronomium" . "Deuteronomium") |
|
|
|
|
|
|
|
("Josua" . "Josua") |
|
|
|
|
|
|
|
("Richter" . "Richter") |
|
|
|
|
|
|
|
("Rut" . "Ruth") |
|
|
|
|
|
|
|
("1 Samuel" . "1 Samuel") |
|
|
|
|
|
|
|
("2 Samuel" . "2 Samuel") |
|
|
|
|
|
|
|
("1 Könige" . "1 Könige") |
|
|
|
|
|
|
|
("2 Könige" . "2 Könige") |
|
|
|
|
|
|
|
("1 Chronik" . "1 Chronika") |
|
|
|
|
|
|
|
("2 Chronik" . "2 Chronika") |
|
|
|
|
|
|
|
("Esra" . "Esra") |
|
|
|
|
|
|
|
("Nehemia" . "Nehemia") |
|
|
|
|
|
|
|
("Ester" . "Esther") |
|
|
|
|
|
|
|
("Ijob" . "Hiob") |
|
|
|
|
|
|
|
("Psalmen" . "Psalmen") |
|
|
|
|
|
|
|
("Sprüche" . "Sprüche") |
|
|
|
|
|
|
|
("Kohelet" . "Kohelet") |
|
|
|
|
|
|
|
("Hohelied" . "Hohelied") |
|
|
|
|
|
|
|
("Jesaja" . "Jesaja") |
|
|
|
|
|
|
|
("Jeremia" . "Jeremia") |
|
|
|
|
|
|
|
("Klagelieder" . "Klagelieder") |
|
|
|
|
|
|
|
("Ezechiel" . "Hesekiel") |
|
|
|
|
|
|
|
("Daniel" . "Daniel") |
|
|
|
|
|
|
|
("Hosea" . "Hosea") |
|
|
|
|
|
|
|
("Joël" . "Joel") |
|
|
|
|
|
|
|
("Amos" . "Amos") |
|
|
|
|
|
|
|
("Obadja" . "Obadja") |
|
|
|
|
|
|
|
("Jona" . "Jona") |
|
|
|
|
|
|
|
("Micha" . "Micha") |
|
|
|
|
|
|
|
("Nahum" . "Nahum") |
|
|
|
|
|
|
|
("Habakuk" . "Habakuk") |
|
|
|
|
|
|
|
("Zephanja" . "Zephania") |
|
|
|
|
|
|
|
("Haggai" . "Haggai") |
|
|
|
|
|
|
|
("Sacharja" . "Sacharia") |
|
|
|
|
|
|
|
("Maleachi" . "Maleachi") |
|
|
|
|
|
|
|
("Matthäus" . "Matthäus") |
|
|
|
|
|
|
|
("Markus" . "Markus") |
|
|
|
|
|
|
|
("Lukas" . "Lukas") |
|
|
|
|
|
|
|
("Johannes" . "Johannes") |
|
|
|
|
|
|
|
("Apostelgeschichte" . "Apostelgeschichte") |
|
|
|
|
|
|
|
("Römer" . "Römer") |
|
|
|
|
|
|
|
("1 Korinther" . "1 Korinther") |
|
|
|
|
|
|
|
("2 Korinther" . "2 Korinther") |
|
|
|
|
|
|
|
("Galater" . "Galater") |
|
|
|
|
|
|
|
("Epheser" . "Epheser") |
|
|
|
|
|
|
|
("Philipper" . "Philipper") |
|
|
|
|
|
|
|
("Kolosser" . "Kolosser") |
|
|
|
|
|
|
|
("1 Thessalonicher" . "1 Thessalonicher") |
|
|
|
|
|
|
|
("2 Thessalonicher" . "2 Thessalonicher") |
|
|
|
|
|
|
|
("1 Timotheus" . "1 Timotheus") |
|
|
|
|
|
|
|
("2 Timotheus" . "2 Timotheus") |
|
|
|
|
|
|
|
("Titus" . "Titus") |
|
|
|
|
|
|
|
("Philemon" . "Philemon") |
|
|
|
|
|
|
|
("Hebräer" . "Hebräer") |
|
|
|
|
|
|
|
("Jakobus" . "Jakobus") |
|
|
|
|
|
|
|
("1 Petrus" . "1 Petrus") |
|
|
|
|
|
|
|
("2 Petrus" . "2 Petrus") |
|
|
|
|
|
|
|
("1 Johannes" . "1 Johannes") |
|
|
|
|
|
|
|
("2 Johannes" . "2 Johannes") |
|
|
|
|
|
|
|
("3 Johannes" . "3 Johannes") |
|
|
|
|
|
|
|
("Judas" . "Judas") |
|
|
|
|
|
|
|
("Offenbarung" . "Offenbarung") |
|
|
|
|
|
|
|
("Judit" . "Judit") |
|
|
|
|
|
|
|
("Weisheit" . "Weisheit") |
|
|
|
|
|
|
|
("Tobit" . "Tobit") |
|
|
|
|
|
|
|
("Sirach" . "Sirach") |
|
|
|
|
|
|
|
("Baruch" . "Baruch") |
|
|
|
|
|
|
|
("1 Makkabäer" . "1 Makkabäer") |
|
|
|
|
|
|
|
("2 Makkabäer" . "2 Makkabäer") |
|
|
|
|
|
|
|
("xDaniel" . "xDaniel") |
|
|
|
|
|
|
|
("Manasse" . "Manasse") |
|
|
|
|
|
|
|
("xEster" . "xEster"))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun add-bible (bible new name mapping) |
|
|
|
|
|
|
|
(mapc (lambda (map) |
|
|
|
|
|
|
|
(mapc (lambda (old new) |
|
|
|
|
|
|
|
(push (cons name (v:text new)) |
|
|
|
|
|
|
|
(v::translations old))) |
|
|
|
|
|
|
|
(cl-bible.search:find-book bible (car map)) |
|
|
|
|
|
|
|
(cl-bible.search:find-book new (cdr map)))) |
|
|
|
|
|
|
|
mapping)) |
|
|
|