[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/htmlize 3551c6b 063/134: Respect `before-string' and `afte
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/htmlize 3551c6b 063/134: Respect `before-string' and `after-string' overlay properties. |
Date: |
Sat, 7 Aug 2021 09:17:07 -0400 (EDT) |
branch: elpa/htmlize
commit 3551c6bd63be9e2d90b8033ee359da5de0721416
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>
Respect `before-string' and `after-string' overlay properties.
---
htmlize.el | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/htmlize.el b/htmlize.el
index 6c0aa87..5b731c7 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -488,6 +488,35 @@ next-single-char-property-change")))
((cdr-safe (car match)) 'ellipsis)
(t nil)))))
+(defun htmlize-add-before-after-strings (beg end text)
+ ;; Find overlays specifying before-string and after-string in [beg,
+ ;; pos). If any are found, splice them into TEXT and return the new
+ ;; text.
+ (let (additions)
+ (dolist (overlay (overlays-in beg end))
+ (let ((before (overlay-get overlay 'before-string))
+ (after (overlay-get overlay 'after-string)))
+ (when after
+ (push (cons (- (overlay-end overlay) beg)
+ after)
+ additions))
+ (when before
+ (push (cons (- (overlay-start overlay) beg)
+ before)
+ additions))))
+ (if additions
+ (let ((textlist nil)
+ (strpos 0))
+ (dolist (add (sort* additions #'< :key #'car))
+ (let ((addpos (car add))
+ (addtext (cdr add)))
+ (push (substring text strpos addpos) textlist)
+ (push addtext textlist)
+ (setq strpos addpos)))
+ (push (substring text strpos) textlist)
+ (apply #'concat (nreverse textlist)))
+ text)))
+
(defun htmlize-get-text-with-display (beg end)
;; Like buffer-substring-no-properties, except it copies the
;; `display' property from the buffer, if found. We cannot rely on
@@ -504,6 +533,8 @@ next-single-char-property-change")))
(put-text-property (- pos beg) (- next-change beg)
'display display text))
(setq pos next-change))
+ (unless running-xemacs
+ (setq text (htmlize-add-before-after-strings beg end text)))
text))
(defun htmlize-buffer-substring-no-invisible (beg end)
- [nongnu] elpa/htmlize 11fec7b 050/134: Recognize the `display' property and render it into the HTML, including images., (continued)
- [nongnu] elpa/htmlize 11fec7b 050/134: Recognize the `display' property and render it into the HTML, including images., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize f7cc2af 051/134: Display a buffer portion with a single `display' property as a single, ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize c34b364 053/134: Create an image with a data: URI for image data descriptors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize c13175c 058/134: Don't use CL's lexical-let if lexical binding is in use., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 97b6b8d 078/134: Escape link text., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 5ce4c6e 083/134: Support XEmacs again., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize aa6e2f6 096/134: Removed support for GNU Emacs 21., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 29f3960 104/134: Nicer readme., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize fb85e84 005/134: Version 0.45., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 94faffa 056/134: Just use `locate-file'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 3551c6b 063/134: Respect `before-string' and `after-string' overlay properties.,
ELPA Syncer <=
- [nongnu] elpa/htmlize 3ed76d8 065/134: Use find-image to find the actual location of the image file in image-load-path., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 73333fc 068/134: Add an option `htmlize-use-images' to turn off image generation., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 5e04b38 072/134: Improve docs., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 1ea27b3 071/134: Escape double quote in attribute values., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 18693fd 081/134: Bumped version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 4f0e317 085/134: Show `display' strings with the `htmlize-literal' property as raw HTML., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 4538849 088/134: Bumped version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 0a17c7c 087/134: It's `htmlize-running-xemacs', not `running-xemacs'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 6f9bb1f 100/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize f74ea31 106/134: Bump version., ELPA Syncer, 2021/08/07