projects
/
gnus
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0c0111c
)
* shr.el: Add headings.
author
Lars Magne Ingebrigtsen
<larsi@quimbies.gnus.org>
Sun, 3 Oct 2010 21:40:19 +0000
(23:40 +0200)
committer
Lars Magne Ingebrigtsen
<larsi@quimbies.gnus.org>
Sun, 3 Oct 2010 21:40:19 +0000
(23:40 +0200)
lisp/shr.el
patch
|
blob
|
history
diff --git
a/lisp/shr.el
b/lisp/shr.el
index
ccb7764
..
3b9596a
100644
(file)
--- a/
lisp/shr.el
+++ b/
lisp/shr.el
@@
-90,13
+90,18
@@
fit these criteria."
(shr-descend sub)))))
(defun shr-tag-p (cont)
(shr-descend sub)))))
(defun shr-tag-p (cont)
- (unless (bobp)
- (shr-ensure-newline)
- (insert "\n"))
+ (shr-ensure-paragraph)
(shr-generic cont)
(unless (bobp)
(insert "\n")))
(shr-generic cont)
(unless (bobp)
(insert "\n")))
+(defun shr-ensure-paragraph ()
+ (unless (bobp)
+ (if (bolp)
+ (unless (eql (char-after (1- (point))) ?\n)
+ (insert "\n"))
+ (insert "\n\n"))))
+
(defun shr-tag-b (cont)
(shr-fontize-cont cont 'bold))
(defun shr-tag-b (cont)
(shr-fontize-cont cont 'bold))
@@
-109,10
+114,11
@@
fit these criteria."
(defun shr-s (cont)
(shr-fontize-cont cont 'strikethru))
(defun shr-s (cont)
(shr-fontize-cont cont 'strikethru))
-(defun shr-fontize-cont (cont
type
)
+(defun shr-fontize-cont (cont
&rest types
)
(let (shr-start)
(shr-generic cont)
(let (shr-start)
(shr-generic cont)
- (shr-add-font (or shr-start (point)) (point) type)))
+ (dolist (type types)
+ (shr-add-font (or shr-start (point)) (point) type))))
(defun shr-add-font (start end type)
(let ((overlay (make-overlay start end)))
(defun shr-add-font (start end type)
(let ((overlay (make-overlay start end)))
@@
-276,6
+282,26
@@
Return a string with image data."
(shr-ensure-newline)
(shr-generic cont))
(shr-ensure-newline)
(shr-generic cont))
+(defun shr-tag-h1 (cont)
+ (shr-heading cont 'bold 'underline))
+
+(defun shr-tag-h2 (cont)
+ (shr-heading cont 'bold))
+
+(defun shr-tag-h3 (cont)
+ (shr-heading cont 'italic))
+
+(defun shr-tag-h4 (cont)
+ (shr-heading cont))
+
+(defun shr-tag-h5 (cont)
+ (shr-heading cont))
+
+(defun shr-heading (cont &rest types)
+ (shr-ensure-paragraph)
+ (apply #'shr-fontize-cont cont types)
+ (shr-ensure-paragraph))
+
(provide 'shr)
;;; shr.el ends here
(provide 'shr)
;;; shr.el ends here