%PDF- %PDF-
Direktori : /usr/local/share/emacs/27.2/lisp/ |
Current File : //usr/local/share/emacs/27.2/lisp/htmlfontify.elc |
;ELC ;;; Compiled ;;; in Emacs version 27.2 ;;; with all optimizations. ;;; This file contains utf-8 non-ASCII characters, ;;; and so cannot be loaded into Emacs 22 or earlier. (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (string-lessp emacs-version "23") (error "`%s' was compiled for Emacs 23 or later" #$)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\207" [require faces custom font-lock cus-edit htmlfontify-loaddefs] 2) (defconst htmlfontify-version 0.21) #@57 The generator meta tag for this version of htmlfontify. (defconst hfy-meta-tags (format "<meta name=\"generator\" content=\"emacs %s; htmlfontify %0.2f\" />" emacs-version htmlfontify-version) (#$ . 589)) #@1774 Copy and convert buffers and files to HTML, adding hyperlinks between files (driven by etags) if requested. Interactive functions: `htmlfontify-buffer' `htmlfontify-run-etags' `htmlfontify-copy-and-link-dir' `htmlfontify-load-rgb-file' `htmlfontify-unload-rgb-file' In order to: fontify a file you have open: \[htmlfontify-buffer] prepare the etags map for a directory: \[htmlfontify-run-etags] copy a directory, fontifying as you go: \[htmlfontify-copy-and-link-dir] The following might be useful when running non-windowed or in batch mode: (note that they shouldn't be necessary - we have a built in map) load an X11 style rgb.txt file: \[htmlfontify-load-rgb-file] unload the current rgb.txt file: \[htmlfontify-unload-rgb-file] And here's a programmatic example: (defun rtfm-build-page-header (file style) (format "#define TEMPLATE red+black.html #define DEBUG 1 #include <build/menu-dirlist|>\n html-css-url := /css/red+black.css title := rtfm.etla.org ( %s / src/%s ) bodytag := head <=STYLESHEET;\n %s STYLESHEET main-title := rtfm / %s / src/%s\n main-content <=MAIN_CONTENT;\n" rtfm-section file style rtfm-section file)) (defun rtfm-build-page-footer (file) "\nMAIN_CONTENT\n") (defun rtfm-build-source-docs (section srcdir destdir) (interactive "s section[eg- emacs / p4-blame]:\nD source-dir: \nD output-dir: ") (require \='htmlfontify) (hfy-load-tags-cache srcdir) (let ((hfy-page-header \='rtfm-build-page-header) (hfy-page-footer \='rtfm-build-page-footer) (rtfm-section section) (hfy-index-file "index")) (htmlfontify-run-etags srcdir) (htmlfontify-copy-and-link-dir srcdir destdir ".src" ".html"))) (defconst htmlfontify-manual "Htmlfontify Manual" (#$ . 802)) (byte-code "\300\301\302\303\304\305\306\307\306\310\306\311\312\313& \210\314\315\316\317\320DD\321\304\301\322\323\324\325& \210\314\326\316\317\327DD\330\304\301\322\331\324\332& \210\314\333\316\317\334DD\335\304\301\322\336\324\337& \210\314\340\316\317\341DD\342\304\301\322\343\324\344& \210\314\345\316\317\346DD\347\304\301\322\350\324\351& \210\314\352\316\317\353DD\354\304\301\322\355\324\356& \210\314\357\316\317\360DD\361\304\301\322\362\324\363& \210\314\364\316\317\365DD\366\304\301\322\367\324\370& \210\314\371\316\317\372DD\373\304\301\322\374\324\375& \210\314\376\316\317\377DD\201@ \304\301\322\201A \324\201B & \210\314\201C \316\317\201D DD\201E \304\301\322\201F \324\201G & \210\201H \201I \201J \302#\210\201K \211\203\211@\201I N\203\201J N\204\201L \201J \201I N#\210A\266\202\202\353 \210\201M \201I \201J \201N #\210\314\201J \316\317\201O DD\201P \304\301\322\201Q \324\201R & \210\201H \201S \201T \302#\210\201K \211\203z\211@\201S N\203s\201T N\204s\201L \201T \201S N#\210A\266\202\202O\210\201M \201S \201T \201U #\210\314\201T \316\317\201V DD\201W \304\301\322\201X \201Y \201Z \324\201[ &\210\314\201\\ \316\317\201] DD\201^ \304\301\322\201_ \324\201` & \210\314\201a \316\317\201b DD\201c \304\301\322\201d \324\201e & \210\314\201f \316\317\201g DD\201h \304\301\322\201i \324\201j & \207" [custom-declare-group htmlfontify nil "Convert buffers and files to HTML." :group applications :link (variable-link htmlfontify-manual) (custom-manual "(htmlfontify) Top") (info-link "(htmlfontify) Customization") :prefix "hfy-" custom-declare-variable hfy-page-header funcall function #[0 "\300\207" [hfy-default-header] 1] "Function called to build the header of the HTML source.\nThis is called with two arguments (the filename relative to the top\nlevel source directory being etag'd and fontified), and a string containing\nthe <style>...</style> text to embed in the document.\nIt should return a string that will be used as the header for the\nhtmlfontified version of the source file.\n\nSee also `hfy-page-footer'." :tag "page-header" :type (function) hfy-split-index #[0 "\300\207" [nil] 1] "Whether or not to split the index `hfy-index-file' alphabetically.\nIf non-nil, the index is split on the first letter of each tag.\nUseful when the index would otherwise be large and take\na long time to render or be difficult to navigate." "split-index" (boolean) hfy-page-footer #[0 "\300\207" [hfy-default-footer] 1] "As `hfy-page-header', but generates the output footer.\nIt takes only one argument, the filename." "page-footer" (function) hfy-extn #[0 "\300\207" [#1=".html"] 1 #1#] "File extension used for output files." "extension" (string) hfy-src-doc-link-style #[0 "\300\207" [#2="text-decoration: underline;"] 1 #2#] "String to add to the `<style> a' variant of an htmlfontify CSS class." "src-doc-link-style" (string) hfy-src-doc-link-unstyle #[0 "\300\207" [#3=" text-decoration: none;"] 1 #3#] "Regex to remove from the `<style> a' variant of an htmlfontify CSS class." "src-doc-link-unstyle" (string) hfy-link-extn #[0 "\300\207" [nil] 1] "File extension used for href links.\nUseful where the htmlfontify output files are going to be processed\nagain, with a resulting change in file extension. If nil, then any\ncode using this should fall back to `hfy-extn'." "link-extension" (choice string (const nil)) hfy-link-style-fun #[0 "\300\207" [hfy-link-style-string] 1] "Function to customize the appearance of hyperlinks.\nSet this to a function, which will be called with one argument\n(a \"{ foo: bar; ...}\" CSS style-string) - it should return a copy of\nits argument, altered so as to make any changes you want made for text which\nis a hyperlink, in addition to being in the class to which that style would\nnormally be applied." "link-style-function" (function) hfy-index-file #[0 "\300\207" [#4="hfy-index"] 1 #4#] "Name (sans extension) of the tag definition index file produced during\nfontification-and-hyperlinking." "index-file" (string) hfy-instance-file #[0 "\300\207" [#5="hfy-instance"] 1 #5#] "Name (sans extension) of the tag usage index file produced during\nfontification-and-hyperlinking." "instance-file" (string) hfy-html-quote-regex #[0 "\300\207" [#6="\\([<\"&>]\\)"] 1 #6#] "Regex to match (with a single back-reference per match) strings in HTML\nwhich should be quoted with `hfy-html-quote' (and `hfy-html-quote-map')\nto make them safe." "html-quote-regex" (regexp) defvaralias hfy-init-kludge-hooks hfy-init-kludge-hook (saved-value saved-variable-comment) put make-obsolete-variable "23.2" #[0 "\300\207" [(hfy-kludge-cperl-mode)] 1] "List of functions to call when starting `htmlfontify-buffer' to do any\nkludging necessary to get highlighting modes to behave as you want, even\nwhen not running under a window system." "init-kludge-hooks" (hook) hfy-post-html-hooks hfy-post-html-hook "24.3" #[0 "\300\207" [nil] 1] "List of functions to call after creating and filling the HTML buffer.\nThese functions will be called with the HTML buffer as the current buffer." "post-html-hooks" :options (set-auto-mode) (hook) hfy-default-face-def #[0 "\300\207" [nil] 1] "Fallback `defface' specification for the face `default', used when\n`hfy-display-class' has been set (the normal htmlfontify way of extracting\npotentially non-current face information doesn't necessarily work for\n`default').\n\nExample: I customize this to:\n\n((t :background \"black\" :foreground \"white\" :family \"misc-fixed\"))" "default-face-definition" (alist) hfy-etag-regex #[0 "\300\207" [".*\\([^\n]+\\)\\([0-9]+\\),\\([0-9]+\\)$\\|.*[0-9]+,[0-9]+$"] 1] "Regex used to parse an etags entry: must have 3 subexps, corresponding,\nin order, to:\n\n 1 - The tag\n 2 - The line\n 3 - The char (point) at which the tag occurs." "etag-regex" (regexp) hfy-html-quote-map #[0 "\300\207" [(("\"" """) ("<" "<") ("&" "&") (">" ">"))] 1] "Alist of char -> entity mappings used to make the text HTML-safe." "html-quote-map" (alist :key-type (string))] 14) (defconst hfy-e2x-etags-cmd "for src in `find . -type f`;\ndo\n ETAGS=%s;\n case ${src} in\n *.ad[absm]|*.[CFHMSacfhlmpsty]|*.def|*.in[cs]|*.s[as]|*.src|*.cc|\\\n *.hh|*.[chy]++|*.[ch]pp|*.[chy]xx|*.pdb|*.[ch]s|*.[Cc][Oo][Bb]|\\\n *.[eh]rl|*.f90|*.for|*.java|*.[cem]l|*.clisp|*.lisp|*.[Ll][Ss][Pp]|\\\n [Mm]akefile*|*.pas|*.[Pp][LlMm]|*.psw|*.lm|*.pc|*.prolog|*.oak|\\\n *.p[sy]|*.sch|*.scheme|*.[Ss][Cc][Mm]|*.[Ss][Mm]|*.bib|*.cl[os]|\\\n *.ltx|*.sty|*.TeX|*.tex|*.texi|*.texinfo|*.txi|*.x[bp]m|*.yy|\\\n *.[Ss][Qq][Ll])\n ${ETAGS} -o- ${src};\n ;;\n *)\n FTYPE=`file ${src}`;\n case ${FTYPE} in\n *script*text*)\n ${ETAGS} -o- ${src};\n ;;\n *text*)\n SHEBANG=`head -n1 ${src} | grep '#!' -c`;\n if [ ${SHEBANG} -eq 1 ];\n then\n ${ETAGS} -o- ${src};\n fi;\n ;;\n esac;\n ;;\n esac;\ndone;") (defconst hfy-etags-cmd-alist-default (byte-code "\301B\302B\207" [hfy-e2x-etags-cmd "emacs etags" (("exuberant ctags" . "%s -R -f -"))] 2)) (byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313& \210\300\314\302\303\315DD\316\306\307\310\317\312\320& \210\300\321\302\303\322DD\323\306\307\310\324\312\325& \210\300\326\302\303\327DD\330\306\307\310\331\312\332& \207" [custom-declare-variable hfy-etags-cmd-alist funcall function #[0 "\207" [hfy-etags-cmd-alist-default] 1] "Alist of possible shell commands that will generate etags output that\n`htmlfontify' can use. `%s' will be replaced by `hfy-etags-bin'." :group htmlfontify :tag "etags-cmd-alist" :type (alist :key-type (string) :value-type (string)) hfy-etags-bin #[0 "\300\207" [#1="etags"] 1 #1#] "Location of etags binary (we begin by assuming it's in your path).\n\nNote that if etags is not in your path, you will need to alter the shell\ncommands in `hfy-etags-cmd-alist'." "etags-bin" (file) hfy-shell-file-name #[0 "\300\207" [#2="/bin/sh"] 1 #2#] "Shell (Bourne or compatible) to invoke for complex shell operations." "shell-file-name" (file) hfy-ignored-properties #[0 "\300\207" [(read-only intangible modification-hooks insert-in-front-hooks insert-behind-hooks point-entered point-left)] 1] "Properties to omit when copying a fontified buffer for HTML transformation." "ignored-properties" (repeat symbol)] 10) #@64 Return a string indicating which flavor of etags we are using. (defalias 'hfy-which-etags #[0 "\301\302!r\211q\210\303\304\305\306\307!\310\"\311$\216\3121? \313\314\315\314\316%\304=\205; eb\210\317\320\314\315#\2032 \321\202; \317\322\314\315#\205; \3230\202A \210\314*\207" [hfy-etags-bin generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 (file-error) call-process nil t "--version" search-forward "exube" "exuberant ctags" "GNU E" "emacs etags"] 7 (#$ . 11136)]) (byte-code "\301\302\303\304\305DD\306\307\310\311\312\313\314C\211\203( \211@\315\311@AFB\262A\266\202\202 \210\316B\262& \210\301\317\303\304\320DD\321\307\310\311\322\313\323& \210\301\324\303\304\325DD\326\307\310\311\327\313\330& \210\301\331\303\304\332DD\333\313\334\307\310\311\335\336\337&\210\340\341\342\343#\210\344\211\203\216 \211@\341N\203\207 \342N\204\207 \345\342\341N#\210A\266\202\202m \210\346\341\342\347#\210\301\342\303\304\350DD\351\313\352\307\310\311\353& \207" [hfy-etags-cmd-alist custom-declare-variable hfy-etags-cmd funcall function #[0 "\301\302 \"A\207" [hfy-etags-cmd-alist assoc hfy-which-etags] 3] "The etags equivalent command to run in a source directory to generate a tags\nfile for the whole source tree from there on down. The command should emit\nthe etags output on stdout.\n\nTwo canned commands are provided - they drive Emacs's etags and\nexuberant-ctags' etags respectively." :group htmlfontify :tag "etags-command" :type (string) const choice hfy-istext-command #[0 "\300\207" [#1="file %s | sed -e 's@^[^:]*:[ ]*@@'"] 1 #1#] "Command to run with the name of a file, to see whether it is a text file\nor not. The command should emit a string containing the word `text' if\nthe file is a text file, and a string not containing `text' otherwise." "istext-command" (string) hfy-find-cmd #[0 "\300\207" [#2="find . -type f \\! -name \\*~ \\! -name \\*.flc \\! -path \\*/CVS/\\*"] 1 #2#] "Find command used to harvest a list of files to attempt to fontify." "find-command" (string) hfy-display-class #[0 "\300\207" [nil] 1] "Display class to use to determine which display class to use when\ncalculating a face's attributes. This is useful when, for example, you\nare running Emacs on a tty or in batch mode, and want htmlfontify to have\naccess to the face spec you would use if you were connected to an X display.\n\nSome valid class specification elements are:\n\n (class color)\n (class grayscale)\n (background dark)\n (background light)\n (type x-toolkit)\n (type tty)\n (type motif)\n (type lucid)\nMultiple values for a tag may be combined, to indicate that any one or more\nof these values in the specification key constitutes a match, eg:\n\n((class color grayscale) (type tty)) would match any of:\n\n ((class color))\n ((class grayscale))\n ((class color grayscale))\n ((class color foo))\n ((type tty))\n ((type tty) (class color))\n\nand so on." (alist :key-type (symbol) :value-type (symbol)) "display-class" :options ((type (choice (const :tag "X11" x-toolkit) (const :tag "Terminal" tty) (const :tag "Lucid Toolkit" lucid) (const :tag "Motif Toolkit" motif))) (class (choice (const :tag "Color" color) (const :tag "Grayscale" grayscale))) (background (choice (const :tag "Dark" dark) (const :tag "Bright" light)))) defvaralias hfy-optimisations hfy-optimizations nil (saved-value saved-variable-comment) put make-obsolete-variable "25.1" #[0 "\300C\207" [keep-overlays] 1] "Optimizations to turn on: So far, the following have been implemented:\n\n merge-adjacent-tags: If two (or more) span tags are adjacent, identical and\n separated by nothing more than whitespace, they will\n be merged into one span.\n zap-comment-links : Suppress hyperlinking of tags found in comments.\n zap-string-links : Suppress hyperlinking of tags found in strings.\n div-wrapper : Add <div class=\"default\"> </div> tags around the\n output.\n keep-overlays : More of a bell (or possibly whistle) than an\n optimization - If on, preserve overlay highlighting\n (cf ediff or goo-font-lock) as well as basic faces.\n\n body-text-only : Emit only body-text. In concrete terms,\n 1. Suppress calls to `hfy-page-header' and\n `hfy-page-footer'\n 2. Pretend that `div-wrapper' option above is\n turned off\n 3. Don't enclose output in <pre> </pre> tags\n And the following are planned but not yet available:\n\n kill-context-leak : Suppress hyperlinking between files highlighted by\n different modes.\n\nNote: like compiler optimizations, these optimize the _output_ of the code,\nnot the processing of the source itself, and are therefore likely to slow\nhtmlfontify down, at least a little. Except for skip-refontification,\nwhich can never slow you down, but may result in incomplete fontification." (set (const :tag "merge-adjacent-tags" merge-adjacent-tags) (const :tag "zap-comment-links" zap-comment-links) (const :tag "zap-string-links" zap-string-links) (const :tag "skip-refontification" skip-refontification) (const :tag "kill-context-leak" kill-context-leak) (const :tag "div-wrapper" div-wrapper) (const :tag "keep-overlays" keep-overlays) (const :tag "body-text-only" body-text-only)) "optimizations"] 16) #@294 Alist of the form: (("/src/dir/0" . tag-hash0) ("/src/dir/1" tag-hash1) ...) Each tag hash entry then contains entries of the form: "tag_string" => (("file/name.ext" line char) ... ) ie an alist mapping (relative) file paths to line and character offsets. See also `hfy-load-tags-cache'. (defvar hfy-tags-cache nil (#$ . 16689)) #@149 Alist of the form (("/src/dir" . (tag0 tag1 tag2)) ... ) where the tags are stored in descending order of length. See also `hfy-load-tags-cache'. (defvar hfy-tags-sortl nil (#$ . 17030)) #@262 Alist of the form (("/src/dir" . tag-rmap-hash)) where tag-rmap-hash has entries of the form: "tag_string" => ( "file/name.ext" line char ) Unlike `hfy-tags-cache' these are the locations of occurrences of tagged items, not the locations of their definitions. (defvar hfy-tags-rmap nil (#$ . 17226)) #@866 An assoc representing/describing an Emacs face. Properties may be repeated, in which case later properties should be treated as if they were inherited from a `parent' font. (For some properties, only the first encountered value is of any importance, for others the values might be cumulative, and for others they might be cumulative in a complex way.) Some examples: (hfy-face-to-style \='default) => (("background" . "rgb(0, 0, 0)") ("color" . "rgb(255, 255, 255)") ("font-style" . "normal") ("font-weight" . "500") ("font-stretch" . "normal") ("font-family" . "misc-fixed") ("font-size" . "13pt") ("text-decoration" . "none")) (hfy-face-to-style \='Info-title-3-face) => (("font-weight" . "700") ("font-family" . "helv") ("font-size" . "120%") ("text-decoration" . "none")) (defvar hfy-style-assoc 'please-ignore-this-line (#$ . 17534)) #@214 An assoc with elements of the form (face-name style-name . style-string): ((default "default" . "{background: black; color: white}") (font-lock-string-face "string" . "{color: rgb(64,224,208)}")) (defvar hfy-sheet-assoc 'please-ignore-this-line (#$ . 18469)) #@1094 An assoc of (point . FACE-SYMBOL) or (point . DEFFACE-LIST) and (point . \='end) elements, in descending order of point value (ie from the file's end to its beginning). The map is in reverse order because inserting a <style> tag (or any other string) at `point' invalidates the map for all entries with a greater value of point. By traversing the map from greatest to least point, we still invalidate the map as we go, but only those points we have already dealt with (and therefore no longer care about) will be invalid at any time. \='((64820 . end) (64744 . font-lock-comment-face) (64736 . end) (64722 . font-lock-string-face) (64630 . end) (64623 . font-lock-string-face) (64449 . end) (64446 . font-lock-keyword-face) (64406 . end) (64395 . font-lock-constant-face) (64393 . end) (64386 . font-lock-keyword-face) (64379 . end) ;; big similar section elided. You get the idea. (4285 . font-lock-constant-face) (4285 . end) (4221 . font-lock-comment-face) (4221 . end) (4197 . font-lock-constant-face) (4197 . end) (1 . font-lock-comment-face)) (defvar hfy-facemap-assoc 'please-ignore-this-line (#$ . 18753)) #@52 An alist of derived fonts resulting from overlays. (defvar hfy-tmpfont-stack nil (#$ . 19917)) (defconst hfy-hex-regex "[[:xdigit:]]") (defconst hfy-triplet-regex (byte-code "\301\211\302\211\302\211\303\260\n\207" [hfy-hex-regex "\\(" "\\)\\(" "\\)"] 10)) #@86 Return the intersection (using `eq') of two lists SET-A and SET-B. (fn SET-A SET-B) (defalias 'hfy-interq #[514 "\300\211\203 @\262A\262\211>\203 \211B\262\202 \207" [nil] 7 (#$ . 20183)]) #@197 Where COLOR is a color name or #XXXXXX style triplet, return a list of three (16 bit) rgb values for said color. If a window system is unavailable, calls `hfy-fallback-color-values'. (fn COLOR) (defalias 'hfy-color-vals #[257 "\302\"\203 \303\304\305\306\307\310!\311\"\312\313%\314\"\207 \203* \315\316!\203&