[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/htmlize d562fb4 031/134: Extract the code that massages bu
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/htmlize d562fb4 031/134: Extract the code that massages buffer substring into HTML in a separate function. |
Date: |
Sat, 7 Aug 2021 09:17:01 -0400 (EDT) |
branch: elpa/htmlize
commit d562fb49f6f70d5c9b25049bc613a7b75405a30c
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>
Extract the code that massages buffer substring into HTML in a separate
function.
---
htmlize.el | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/htmlize.el b/htmlize.el
index 39844b3..39d0c0f 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -495,6 +495,22 @@ next-single-char-property-change")))
;; Generate the output from the available chunks.
(apply #'concat (nreverse chunks)))))
+(defun htmlize-extract-text (beg end trailing-ellipsis)
+ ;; Extract buffer text, sans the invisible parts. Then
+ ;; untabify it and escape the HTML metacharacters.
+ (setq text (htmlize-buffer-substring-no-invisible
+ (point) next-change))
+ (when trailing-ellipsis
+ (setq text (htmlize-trim-ellipsis text)))
+ ;; If TEXT ends up empty, don't change trailing-ellipsis.
+ (when (> (length text) 0)
+ (setq trailing-ellipsis
+ (get-text-property (1- (length text))
+ 'htmlize-ellipsis text)))
+ (setq text (htmlize-untabify text (current-column)))
+ (setq text (htmlize-protect-string text))
+ (values text trailing-ellipsis))
+
(defun htmlize-despam-address (string)
"Replace every occurrence of '@' in STRING with @.
`htmlize-make-hyperlinks' uses this to spam-protect mailto links
@@ -1368,19 +1384,8 @@ it's called with the same value of KEY. All other
times, the cached
fstruct-list (delq nil (mapcar (lambda (f)
(gethash f face-map))
face-list)))
- ;; Extract buffer text, sans the invisible parts. Then
- ;; untabify it and escape the HTML metacharacters.
- (setq text (htmlize-buffer-substring-no-invisible
- (point) next-change))
- (when trailing-ellipsis
- (setq text (htmlize-trim-ellipsis text)))
- ;; If TEXT ends up empty, don't change trailing-ellipsis.
- (when (> (length text) 0)
- (setq trailing-ellipsis
- (get-text-property (1- (length text))
- 'htmlize-ellipsis text)))
- (setq text (htmlize-untabify text (current-column)))
- (setq text (htmlize-protect-string text))
+ (multiple-value-setq (text trailing-ellipsis)
+ (htmlize-extract-text (point) next-change trailing-ellipsis))
;; Don't bother writing anything if there's no text (this
;; happens in invisible regions).
(when (> (length text) 0)
- [nongnu] elpa/htmlize 3f70004 001/134: Initialize the repository., (continued)
- [nongnu] elpa/htmlize 3f70004 001/134: Initialize the repository., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 3a7415f 009/134: Version 0.62., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 0cc4dd3 011/134: Version 0.65., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 28aeeb3 015/134: Version 1.12., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 8b35e1a 018/134: Version 1.28., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize ce12545 013/134: Version 1.0., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize b9e708c 006/134: Version 0.50., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 57e99e0 016/134: Version 1.16., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize f0cd7a7 019/134: Version 1.34., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 2a42b1a 020/134: Version 1.36., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize d562fb4 031/134: Extract the code that massages buffer substring into HTML in a separate function.,
ELPA Syncer <=
- [nongnu] elpa/htmlize a763320 029/134: Tweak comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 9f0ffec 034/134: Don't treat an overlay that specifies `face' as a block., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 83f2745 035/134: Simplify loop, noticing that overlay-faces is invariant throughout the loop., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 179f267 036/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 06e9a88 037/134: Make the header package.el compatible, ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize aa7969b 038/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize c0bea5b 040/134: Don't use the old name x-color-values., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 11e675b 041/134: Get rid of a silly warning., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 3dfd7c9 044/134: Insert multiple runs having the same fstruct-list with the same HTML markup., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize cbbbc47 045/134: Kill htmlbuf in case of error., ELPA Syncer, 2021/08/07