[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/htmlize 3a7415f 009/134: Version 0.62.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/htmlize 3a7415f 009/134: Version 0.62. |
Date: |
Sat, 7 Aug 2021 09:16:56 -0400 (EDT) |
branch: elpa/htmlize
commit 3a7415f2a6380445f8ba5b8e77f88d22cd9657e8
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>
Version 0.62.
---
htmlize.el | 78 +++++++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 60 insertions(+), 18 deletions(-)
diff --git a/htmlize.el b/htmlize.el
index 5d75dad..53536a2 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -97,7 +97,7 @@
(defvar font-lock-auto-fontify)
(defvar global-font-lock-mode))
-(defconst htmlize-version "0.57")
+(defconst htmlize-version "0.62")
;; Incantations to make custom stuff work without customize, e.g. on
;; XEmacs 19.14 or GNU Emacs 19.34.
@@ -184,9 +184,11 @@ This is run by the `htmlize-file'.")
;;; Protection of HTML strings.
-;; This is only a stub. Implementing this to be correct under all
-;; variants of Mule and Mule-less Emacsen is extremely hard and
-;; error-prone. Leave it commented for now.
+;; This is only a stub. Implementing this correctly is extremely hard
+;; due to two things: the multitude of ways that international
+;; characters can be represented in HTML, and the incompatibilities
+;; between various implementations of Mule. Leave it commented out
+;; for now.
;(defvar htmlize-protected-chars
; '((?& amp)
@@ -485,7 +487,10 @@ in the system directories."
;; non-nil, background color is used.
(defun htmlize-face-rgb-string-direct (face &optional bg-p)
(apply #'format "#%02x%02x%02x"
- (if (fboundp 'color-instance-rgb-components)
+ ;; Here I cannot conditionalize on (fboundp ...) because
+ ;; ps-print under some versions of GNU Emacs defines its own
+ ;; dummy version of color-instance-rgb-components.
+ (if htmlize-running-xemacs
(mapcar (lambda (arg)
(/ arg 256))
(color-instance-rgb-components
@@ -641,7 +646,9 @@ in the system directories."
(htmlize-face-rgb-foreground default-face-object))))
(push (format "color: %s;" (htmlize-face-rgb-foreground face-object))
result))
- ;; Here we used to say:
+ ;; Specification of background-color used to be conditionalized
+ ;; like this, to ensure that we specify the background color only
+ ;; for faces that differ from the default face:
;; (when (or (not default-face-object)
;; (not (equal (htmlize-face-rgb-background face-object)
;; (htmlize-face-rgb-background
default-face-object))))
@@ -704,11 +711,34 @@ in the system directories."
;;; <font> support
-;; We use the HTML Pro DTD by default. Note that under W3-procured
-;; DTD's it is illegal to specify <font> under <pre>.
(defun htmlize-font-doctype ()
nil ; no doc-string
- "<!DOCTYPE HTML PUBLIC \"+//Silmaril//DTD HTML Pro v0r11 19970101//EN\">")
+
+ ;; According to DTDs published by the W3C, it is illegal to embed
+ ;; <font> in <pre>. This makes sense in general, but is bad for
+ ;; htmlize's intended usage of <font> to specify the document color.
+
+ ;; To make generated HTML legal, htmlize.el used to specify the SGML
+ ;; declaration of "HTML Pro" DTD here. HTML Pro aka Silmaril DTD
+ ;; was a project whose goal was to produce a DTD that would
+ ;; encompass all the incompatible HTML extensions procured by
+ ;; Netscape, MSIE, and other players in the field. Apparently the
+ ;; project got abandoned, the last available version being "Draft 0
+ ;; Revision 11" from January 1997, as documented at
+ ;; <http://validator.w3.org/sgml-lib/pro/html/dtds/htmlpro.html>.
+
+ ;; Since by now (2001) HTML Pro is remembered by none but the most
+ ;; die-hard early-web-days nostalgics and used by not even them,
+ ;; there is no use in specifying it. So we return the standard HTML
+ ;; 4.0 declaration, which makes generated HTML technically illegal.
+ ;; If you have a problem with that, use the `css' generation engine
+ ;; which I believe creates fully conformant HTML.
+
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">"
+
+ ;; Now-abandond HTML Pro declaration.
+ ;"<!DOCTYPE HTML PUBLIC \"+//Silmaril//DTD HTML Pro v0r11 19970101//EN\">"
+ )
(defun htmlize-font-body-tag ()
(let ((face-object (gethash 'default htmlize-face-hash)))
@@ -736,7 +766,8 @@ in the system directories."
;;;###autoload
(defun htmlize-buffer (&optional buffer)
- "HTML-ize BUFFER."
+ "Convert buffer to HTML, preserving the font-lock colorization.
+HTML contents will be provided in a new buffer."
(interactive)
(or buffer
(setq buffer (current-buffer)))
@@ -813,6 +844,17 @@ in the system directories."
;; to free up the used conses.
(clrhash htmlize-face-hash)))
+;;;###autoload
+(defun htmlize-region (beg end)
+ "Convert the region to HTML, preserving the font-lock colorization."
+ (interactive "r")
+ ;; We don't want the region highlighting to get in the way.
+ (when (fboundp 'zmacs-deactivate-region)
+ (zmacs-deactivate-region))
+ (save-restriction
+ (narrow-to-region beg end)
+ (htmlize-buffer)))
+
(defun htmlize-make-file-name (file)
"Make an HTML file name from FILE.
The HTML file name is the regular file name, with its extension
@@ -883,15 +925,15 @@ corresponding source file."
(interactive
(list
(let (list file)
- ;; Check for `ommadawn', because checking against nil doesn't do
- ;; what you'd expect.
- (while (not (eq (setq file (read-file-name "HTML-ize file (RET to
finish): "
- (and list (file-name-directory
- (car list)))
- 'ommadawn t))
- 'ommadawn))
+ ;; Use empty string as DEFAULT because setting DEFAULT to nil
+ ;; defaults to the directory name, which is not what we want.
+ (while (not (equal (setq file (read-file-name "HTML-ize file (RET to
finish): "
+ (and list
(file-name-directory
+ (car list)))
+ "" t))
+ ""))
(push file list))
- list)))
+ (nreverse list))))
(dolist (file files)
(htmlize-file file target-directory)))
- [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 <=
- [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, 2021/08/07
- [nongnu] elpa/htmlize a763320 029/134: Tweak comments., ELPA Syncer, 2021/08/07