Bläddra i källkod

First cut at inserting commentary xrefs. Need to parse more.

Fred Gilham 1 vecka sedan
förälder
incheckning
952ccdbd14
1 ändrade filer med 17 tillägg och 10 borttagningar
  1. 17 10
      bible.el

+ 17 - 10
bible.el

@@ -241,6 +241,7 @@ See `bible--display-lemma-hebrew'."
     ("3 John"           . 1))
   "A-list of name / chapter count for Bible books.")
 
+;; Abbreviations from NETnote module and Clarke module (commentaries).
 ;; TODO: Add abbreviations found in other documents/commentaries? (FMG 5-Mar-2026)
 (defvar bible--book-name-abbreviations
   '(;; Old Testament
@@ -444,6 +445,7 @@ See `bible--display-lemma-hebrew'."
 (define-key bible-search-mode-map "n" 'bible-next-search-item)
 (define-key bible-search-mode-map "p" 'bible-previous-search-item)
 (define-key bible-search-mode-map (kbd "RET") 'bible-search-mode-follow-verse)
+(define-key bible-search-mode-map [mouse-1] 'bible-search-mode-follow-verse)
 
 ;;;;; Term display
 
@@ -1261,6 +1263,20 @@ stored in `bible-chapter-title'."
           ((equal level "2")
 	   (newline)))))
 
+(defun bible--insert-xref (node)
+  (let* ((word (bible-dom-text node))
+	 (refs (split-string word ";" t)))
+    (message "refs %s" refs)
+    (dolist (ref refs)
+      (let ((start (point)))
+	(insert " " ref ";")
+	(let ((end (point)))
+	  (put-text-property start end 'xref ref)
+	  (put-text-property start end 'keymap bible-term-mode-map)
+	  (put-text-property start end 'help-echo (concat "Go to " ref))
+	  (add-face-text-property start end '(:foreground "blue")))))))
+
+
 (defun bible--insert-domnode-recursive (node &optional iproperties)
   "Recursively parse domnode NODE obtained from `libxml-parse-html-region'.
 Inserts resulting text into active buffer with properties specified in
@@ -1321,16 +1337,7 @@ In processing subnodes, each case will prepend a space if it needs it."
 		       (bible-new-line)))
                ;; For commentaries and the like.
                ;; TODO: Clicking on verse doesn't work yet. This will take work. (FMG 5-Mar-2026)
-               ((or 'scripref 'reference)
-                (let ((word (bible-dom-text subnode)))
-                  (let ((start (point)))
-                    (insert " " word)
-                    (let ((end (point)))
-;;		      (message "crossreferencing %s" (buffer-substring start end))
-                      (put-text-property start end 'xref word)
-                      (put-text-property start end 'keymap bible-term-mode-map)
-                      (put-text-property start end 'help-echo (concat "Go to " word " (incomplete feature)"))
-                      (add-face-text-property start end '(:foreground "blue"))))))
+               ((or 'scripref 'reference) (bible--insert-xref subnode))
                ;; Various text properties---ignore for now
                ((or 'b 'u) (bible--insert-domnode-recursive subnode iproperties))
                ;; Word inserted by translation, not in original, give visual indication.