Bläddra i källkod

Fix verse number formatting, indenting

Fred Gilham 1 dag sedan
förälder
incheckning
ed9bdaa118
1 ändrade filer med 7 tillägg och 9 borttagningar
  1. 7 9
      bible-mode.el

+ 7 - 9
bible-mode.el

@@ -1064,10 +1064,10 @@ XXX In processing subnodes, each case will prepend a space if it needs it."
 	   (let* ((search-string (concat (car bm-current-book) " " (number-to-string bm-current-chapter) ":"))
 		  (match (string-match search-string subnode)))
 	     (when match
-	       (setf subnode (string-replace search-string "" subnode))
-	       (let ((match (string-match "[0-9]+:" subnode)))
-		 ;; Verse number
-		 (add-face-text-property (match-beginning 0) (match-end 0) '(:foreground "purple") nil subnode))))
+	       (setq subnode (string-replace search-string "" subnode))
+	       (setq match (string-match "[0-9]+:" subnode))
+	       ;; Verse number
+	       (add-face-text-property (match-beginning 0) (match-end 0) '(:foreground "purple") nil subnode)))
 	   ;; Red letter
 	   (when (plist-get iproperties 'jesus)
 	     (add-face-text-property 0 (length subnode) '(:foreground "red") nil subnode))
@@ -1075,7 +1075,7 @@ XXX In processing subnodes, each case will prepend a space if it needs it."
 ;;;;	  Maybe process these at some point? Include footnotes etc.
 ;;;	  ((eq (dom-tag subnode) 'node) nil)
 ;;;	  ((eq (dom-tag subnode) 'lb) nil)
-	  ;; These tags appear in ESV modules (and maybe others?)
+	  ;; These tags appear in ESV modules (and maybe others?) XXX still not right
 	  ((eq (dom-tag subnode) 'l)
 	   (let ((attributes (dom-attributes subnode)))
 	     (cond ((equal (cdr (assoc 'type attributes)) "x-br")
@@ -1083,10 +1083,8 @@ XXX In processing subnodes, each case will prepend a space if it needs it."
 		   ((equal (cdr (assoc 'type attributes)) "x-indent")
 		    (insert "\t"))
 		   ((assoc 'level attributes)
-		    (let ((indent (- (string-to-number (cdr (assoc 'level attributes))) 1)))
-		      (when (> indent 0)	
-			(bm-new-line)
-			(dotimes (i indent) (insert "\t"))))))))
+		    (let ((indent (string-to-number (cdr (assoc 'level attributes)))))
+		      (when (= indent 2) (insert "\n\t")))))))
 	  ((eq (dom-tag subnode) 'title)
 	   (when (not notitle) (setq bm-chapter-title subnode) (bm-new-line)))
 	  ((eq (dom-tag subnode) 'body) (bm--insert-domnode-recursive subnode iproperties notitle))