[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/htmlize 0cc4dd3 011/134: Version 0.65.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/htmlize 0cc4dd3 011/134: Version 0.65. |
Date: |
Sat, 7 Aug 2021 09:16:56 -0400 (EDT) |
branch: elpa/htmlize
commit 0cc4dd371646593234c19004fe4b02110d67ee86
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>
Version 0.65.
---
htmlize.el | 89 ++++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 67 insertions(+), 22 deletions(-)
diff --git a/htmlize.el b/htmlize.el
index b03c4b3..c8fde00 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -98,7 +98,7 @@
(defvar font-lock-auto-fontify)
(defvar global-font-lock-mode))
-(defconst htmlize-version "0.64")
+(defconst htmlize-version "0.65")
;; Incantations to make custom stuff work without customize, e.g. on
;; XEmacs 19.14 or GNU Emacs 19.34.
@@ -132,7 +132,11 @@ with description of faces, and use it in the HTML
document, specifying
the faces in the actual text with <span class=\"FACE\">.
When set to `font', the properties will be set using layout tags
-<font>, <b>, <i>, <u>, and <strike>."
+<font>, <b>, <i>, <u>, and <strike>.
+
+`css' output is normally preferred, but `font' is still useful for
+supporting old, pre-CSS browsers, or for easy embedding of colorized
+text in foreign HTML documents (no style sheet to carry around) ."
:type '(choice (const css) (const font))
:group 'htmlize)
@@ -144,6 +148,20 @@ do your own hyperlinkification from htmlize-after-hook.)"
:type 'boolean
:group 'htmlize)
+(defcustom htmlize-hyperlink-style " a {
+ color: inherit;
+ background-color: inherit;
+ font: inherit;
+ text-decoration: inherit;
+ }
+ a:hover {
+ text-decoration: underline;
+ }
+"
+ "*The CSS style used for hyperlinks when in CSS mode."
+ :type 'string
+ :group 'htmlize)
+
(defcustom htmlize-use-rgb-map t
"*Controls when `rgb.txt' should be looked up for color values.
@@ -391,15 +409,50 @@ This is run by the `htmlize-file'.")
(and (buffer-live-p ,temp-buffer)
(kill-buffer ,temp-buffer))))))))
-;; Under XEmacs, `next-single-property-change' works for all kinds of
-;; extents. Under FSF, `next-char-property-change' works for text
-;; properties and overlays, but doesn't accept a PROP argument. What
-;; we need is something like `next-char-single-property-change', and
-;; that doesn't exist. :-(
-(if htmlize-running-xemacs
- (defalias 'htmlize-next-change 'next-single-property-change)
- ;; As I said above, this ignores overlays. Let it be for now.
+;; We need a function that efficiently finds the next change of the
+;; `face' property, preferably regardless of whether the change
+;; occurred because of a text property or an extent/overlay. As it
+;; turns out, it is not easy to do that compatibly.
+
+;; Under XEmacs, `next-single-property-change' does that. Under GNU
+;; Emacs beginning with version 21, `next-single-char-property-change'
+;; is available and works. GNU Emacs 20 had
+;; `next-char-property-change', which we can use. GNU Emacs 19 didn't
+;; provide any means for simultaneously examining overlays and text
+;; properties, so when using Emacs 19.34, we punt and fall back to
+;; `next-single-property-change', thus ignoring overlays altogether.
+
+(cond
+ (htmlize-running-xemacs
+ ;; XEmacs: good.
(defalias 'htmlize-next-change 'next-single-property-change))
+ ((fboundp 'next-single-char-property-change)
+ ;; GNU Emacs 21: good.
+ (defalias 'htmlize-next-change 'next-single-char-property-change))
+ ((fboundp 'next-char-property-change)
+ ;; GNU Emacs 20: bad, but fixable.
+ (defun htmlize-next-change (pos prop)
+ (let ((done nil)
+ (current-value (get-char-property pos prop))
+ newpos next-value)
+ ;; Loop over positions returned by next-char-property-change
+ ;; until the value of PROP changes or we've hit EOB.
+ (while (not done)
+ (setq newpos (next-char-property-change pos)
+ next-value (get-char-property newpos prop))
+ (cond ((eq newpos pos)
+ ;; Possibly at EOB? Whatever, just don't infloop.
+ (setq done t))
+ ((eq next-value current-value)
+ ;; PROP hasn't changed -- keep looping.
+ )
+ (t
+ (setq done t)))
+ (setq pos newpos))
+ pos)))
+ (t
+ ;; GNU Emacs 19.34: hopeless.
+ (defalias 'htmlize-next-change 'next-single-property-change)))
(defvar htmlize-x-library-search-path
'("/usr/X11R6/lib/X11/"
@@ -691,16 +744,7 @@ in the system directories."
(mapconcat #'identity (htmlize-css-specs default-face-object)
"\n ")
"
- } /* default */
- a {
- color: inherit;
- background-color: inherit;
- font: inherit;
- text-decoration: inherit;
- }
- a:hover {
- text-decoration: underline;
- }\n")
+ } /* default */\n")
(maphash
(lambda (face face-object)
(let ((cleaned-up-face-name (symbol-name face)))
@@ -720,7 +764,8 @@ in the system directories."
(mapconcat #'identity specs "\n ")))
(insert "\n } /* " cleaned-up-face-name " */\n")))))
htmlize-face-hash))
- (insert " -->\n </style>\n"))
+ (insert htmlize-hyperlink-style
+ " -->\n </style>\n"))
(defun htmlize-css-face-prejunk (face-object)
(concat "<span class=\"" (htmlize-face-css-name face-object) "\">"))
@@ -861,7 +906,7 @@ HTML contents will be provided in a new buffer."
(point-max)))
(and (consp face)
;; Choose the first face. Here we might want to merge
- ;; the faces. In XEmacs, we might also want to take
+ ;; the faces. Under XEmacs, we might also want to take
;; into account all the `face' properties of all the
;; extents overlapping next-change. *sigh*
(setq face (car face)))
- [nongnu] branch elpa/htmlize created (now 4920510), ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 24cf2f0 008/134: Version 0.57., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize f14e369 002/134: Version 0.7., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 2118e9e 004/134: Version 0.34., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 6ca4f29 003/134: Version 0.33., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize fd1999a 007/134: Version 0.55., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize f9075a4 017/134: Version 1.27., ELPA Syncer, 2021/08/07
- [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 <=
- [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, 2021/08/07
- [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