[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/htmlize 9ccd74f 010/134: Version 0.64.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/htmlize 9ccd74f 010/134: Version 0.64. |
Date: |
Sat, 7 Aug 2021 09:16:56 -0400 (EDT) |
branch: elpa/htmlize
commit 9ccd74f945a91dd892aa727cfd4160f14e64b3bc
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>
Version 0.64.
---
htmlize.el | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 63 insertions(+), 13 deletions(-)
diff --git a/htmlize.el b/htmlize.el
index 53536a2..b03c4b3 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -1,6 +1,6 @@
;; htmlize.el -- HTML-ize font-lock buffers
-;; Copyright (C) 1997,1998,1999,2000 Hrvoje Niksic
+;; Copyright (C) 1997,1998,1999,2000,2001,2002 Hrvoje Niksic
;; Author: Hrvoje Niksic <hniksic@xemacs.org>
;; Keywords: hypermedia, extensions
@@ -31,10 +31,10 @@
;; htmlize-buffer'. After that, you should find yourself in an HTML
;; buffer, which you can save. Alternatively, `M-x htmlize-file' will
;; find a file, font-lockify the buffer, and save the HTML version,
-;; all before you blink. Even more alternatively, `M-x
-;; htmlize-many-files' will prompt you for a slew of files to undergo
-;; the same treatment. `M-x htmlize-many-files-dired' will do the
-;; same for the files marked by dired.
+;; all before you blink. Furthermore, `M-x htmlize-many-files' will
+;; prompt you for a slew of files to undergo the same treatment. `M-x
+;; htmlize-many-files-dired' will do the same for the files marked by
+;; dired.
;; The code attempts to generate compliant HTML, but I can't make any
;; guarantees; I haven't yet bothered to run the generated markup
@@ -77,7 +77,8 @@
;; <barranquero@laley-actualidad.es> for contributing fixes.
;;
;; * A bunch of other people for sending reports and useful
-;; comments.
+;; comments. I will not attempt to name them because I will
+;; surely forget some.
;;
;; TODO: Should attempt to merge faces (utilize CSS for this?).
@@ -97,7 +98,7 @@
(defvar font-lock-auto-fontify)
(defvar global-font-lock-mode))
-(defconst htmlize-version "0.62")
+(defconst htmlize-version "0.64")
;; Incantations to make custom stuff work without customize, e.g. on
;; XEmacs 19.14 or GNU Emacs 19.34.
@@ -135,6 +136,14 @@ When set to `font', the properties will be set using
layout tags
:type '(choice (const css) (const font))
:group 'htmlize)
+(defcustom htmlize-generate-hyperlinks t
+ "*Non-nil means generate the hyperlinks for URLs and mail addresses.
+This is on by default; set it to nil if you don't want htmlize to
+insert hyperlinks in the resulting HTML. (In which case you can still
+do your own hyperlinkification from htmlize-after-hook.)"
+ :type 'boolean
+ :group 'htmlize)
+
(defcustom htmlize-use-rgb-map t
"*Controls when `rgb.txt' should be looked up for color values.
@@ -636,7 +645,7 @@ in the system directories."
(defun htmlize-css-doctype ()
nil ; no doc-string
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">")
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">")
;; Internal function; not a method.
(defun htmlize-css-specs (face-object &optional default-face-object)
@@ -678,10 +687,20 @@ in the system directories."
(defun htmlize-css-insert-head ()
(insert " <style type=\"text/css\">\n <!--\n")
(let ((default-face-object (gethash 'default htmlize-face-hash)))
- (insert " BODY {\n "
+ (insert " body {\n "
(mapconcat #'identity (htmlize-css-specs default-face-object)
"\n ")
- "\n } /* default */\n")
+ "
+ } /* default */
+ a {
+ color: inherit;
+ background-color: inherit;
+ font: inherit;
+ text-decoration: inherit;
+ }
+ a:hover {
+ text-decoration: underline;
+ }\n")
(maphash
(lambda (face face-object)
(let ((cleaned-up-face-name (symbol-name face)))
@@ -694,7 +713,7 @@ in the system directories."
cleaned-up-face-name)))
(unless (eq face 'default)
(let ((specs (htmlize-css-specs face-object default-face-object)))
- (insert " span." (htmlize-face-css-name face-object))
+ (insert " ." (htmlize-face-css-name face-object))
(if (null specs)
(insert " {")
(insert " {\n "
@@ -734,9 +753,9 @@ in the system directories."
;; 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\">"
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"
- ;; Now-abandond HTML Pro declaration.
+ ;; Now-abandoned HTML Pro declaration.
;"<!DOCTYPE HTML PUBLIC \"+//Silmaril//DTD HTML Pro v0r11 19970101//EN\">"
)
@@ -758,6 +777,35 @@ in the system directories."
(and (htmlize-face-boldp face-object) "</b>")
"</font>"))
+(defun htmlize-make-hyperlinks ()
+ "Make hyperlinks in HTML."
+ ;; Function originally submitted by Ville Skytta. Rewritten by
+ ;; Hrvoje Niksic, then modified by Ville Skytta and Hrvoje Niksic.
+ (goto-char (point-min))
+ (while (re-search-forward
+ "<\\(\\(mailto:\\)?\\([-=+_.a-zA-Z0-9]+@[-_.a-zA-Z0-9]+\\)\\)>"
+ nil t)
+ (let ((address (match-string 3))
+ (link-text (match-string 1)))
+ (delete-region (match-beginning 0) (match-end 0))
+ (insert "<<a href=\"mailto:" address "\">" link-text "</a>>")))
+ (goto-char (point-min))
+ (while (re-search-forward "<\\(\\(URL:\\)?\\([a-zA-Z]+://[^;]+\\)\\)>"
+ nil t)
+ (let ((url (match-string 3))
+ (link-text (match-string 1)))
+ (delete-region (match-beginning 0) (match-end 0))
+ (insert "<<a href=\"" url "\">" link-text "</a>>"))))
+
+;; Tests for htmlize-make-hyperlinks:
+
+;; <mailto:hniksic@xemacs.org>
+;; <http://fly.srk.fer.hr>
+;; <URL:http://www.xemacs.org>
+;; <http://www.mail-archive.com/bbdb-info@xemacs.org/>
+;; <hniksic@xemacs.org>
+;; <xalan-dev-sc.10148567319.hacuhiucknfgmpfnjcpg-john=doe.com@xml.apache.org>
+
(defmacro htmlize-method (method &rest args)
(let ((func (gensym "hm-")))
`(let ((,func (intern (format "htmlize-%s-%s" htmlize-output-type
',method))))
@@ -833,6 +881,8 @@ HTML contents will be provided in a new buffer."
(princ (htmlize-method face-postjunk face-object) newbuf))
(goto-char next-change))))
(insert "</pre>\n </body>\n</html>\n")
+ (when htmlize-generate-hyperlinks
+ (htmlize-make-hyperlinks))
(goto-char (point-min))
(when htmlize-html-major-mode
;; The sucky thing here is that the minor modes, most notably
- [nongnu] elpa/htmlize 6f9bb1f 100/134: Bump version., (continued)
- [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
- [nongnu] elpa/htmlize 32c69e9 108/134: Add htmlize-face-overrides., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 1f7bd72 110/134: Update supported version from 21 -> 22 in README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 06772e6 117/134: Don't use `alist-get', it is not available in Emacs 24. (#17), ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize a872d6b 119/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 33aa3cb 023/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 70529dd 028/134: Abandon compatibility with ancient Emacsen., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize bb3bda0 030/134: Trim comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize c19d29c 012/134: Version 0.67., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 9ccd74f 010/134: Version 0.64.,
ELPA Syncer <=
- [nongnu] elpa/htmlize 9349d4b 014/134: Version 1.4., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 2e7cb2c 021/134: Version 1.37., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 1a14031 022/134: New file: .gitignore, ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 665abf9 024/134: Use `put' instead of `plist-put'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 814e537 026/134: Update instructions for git., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize bcf1d44 025/134: Update copyright and compress individual years to ranges., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 3477a7d 027/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 61760b4 075/134: Implement the `htmlize-link' property to embed links in the HTML., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 296b18e 033/134: Extract a bit of code outside buffer-substring-no-invisible., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize e3d020e 059/134: Remove explicit references to MULE., ELPA Syncer, 2021/08/07