Browse Source

Load books, init bibles correctly, corrections.

master
Silas Vedder 3 years ago
parent
commit
1cf3e19148
  1. 27
      clog.lisp
  2. 24
      data.lisp
  3. 2
      verse.lisp

27
clog.lisp

@ -46,11 +46,28 @@
(d:update-bible (cadar results))
:title "Load a Bible"))))
(defun load-chapter (canvas)
(defun load-book-or-chapter (canvas)
(lambda (data)
(let* ((book (cadr (assoc "book" data :test #'string=)))
(chapter (cadr (assoc "chapter" data :test #'string=)))
(win (window-content
(chapter (cadr (assoc "chapter" data :test #'string=))))
(if (string= chapter "")
(load-book canvas book)
(load-chapter canvas book chapter)))))
(defun load-book (canvas book)
(let* ((win (window-content
(create-gui-window canvas :title (format nil "~A"
book)
:height 400
:width 650)))
(div (create-div win)))
(mapc (lambda (verse)
(v:verse-to-clog verse div))
(s:find-book d:*bible* book))))
(defun load-chapter (canvas book chapter)
(let* ((win (window-content
(create-gui-window canvas :title (format nil "~A ~A"
book
chapter)
@ -59,7 +76,7 @@
(div (create-div win)))
(mapc (lambda (verse)
(v:verse-to-clog verse div))
(s:find-chapter (s:find-book d:*bible* book) chapter)))))
(s:find-chapter (s:find-book d:*bible* book) chapter))))
(defun get-chapter (window body)
(lambda (obj)
@ -67,7 +84,7 @@
(form-dialog window "Which chapter do you want?"
'(("Book" "book" :text)
("Chapter" "chapter" :text))
(load-chapter body)
(load-book-or-chapter body)
:title "Load a Chapter")))
(defun setup-window (body)

24
data.lisp

@ -3,29 +3,37 @@
(in-package #:cl-bible.data)
(defun init-bible (&optional (bible "mng"))
(setf *bible*
(mapcar #'v:string-to-verse
(uiop:read-file-lines
(asdf:system-relative-pathname
"cl-bible"
(format nil "resources/~A.tsv" bible))))))
(format nil "resources/~A.tsv" bible)))))
(defun load-bible (filename)
(v:from-sexp
(read-from-string
(uiop:read-file-string (uiop:native-namestring filename)))))
(defvar *mng* (load-bible "~/.bible/menge.sexp"))
(defvar *vul* (load-bible "~/.bible/vulgata.sexp"))
(defvar *grb* (load-bible "~/.bible/greek.sexp"))
(defvar *kjv* (load-bible "~/.bible/kjv.sexp"))
(defvar *bible* *mng*)
(defvar *mng*)
(defvar *vul*)
(defvar *grb*)
(defvar *kjv*)
(defvar *bible*)
(defun load-bibles ()
(if (uiop:file-exists-p (uiop:native-namestring "~/.bible/menge.sexp"))
(progn
(setf *mng* (init-bible "mng"))
(setf *kjv* (init-bible "kjv"))
(setf *vul* (init-bible "vul"))
(setf *grb* (init-bible "grb")))
(progn
(setf *mng* (load-bible "~/.bible/menge.sexp"))
(setf *vul* (load-bible "~/.bible/vulgata.sexp"))
(setf *grb* (load-bible "~/.bible/greek.sexp"))
(setf *kjv* (load-bible "~/.bible/kjv.sexp")))
(setf *kjv* (load-bible "~/.bible/kjv.sexp")))))
(load-bibles)
(defun update-bible (str)
(let ((bibles `(("mng" . ,*mng*)

2
verse.lisp

@ -65,7 +65,9 @@
:title "Add note")))
(form (clog:create-form win))
(text (clog:create-text-area form :rows 4))
(_ (clog:create-br form))
(button (clog:create-button form :content "submit")))
(declare (ignore _))
(clog:set-on-click button
(lambda (obj)
(declare (ignore obj))

Loading…
Cancel
Save