Htmlfontify
***********

This manual documents Htmlfontify, a source code -> crosslinked + formatted + syntax colorized html transformer.

Copyright © 2002-2003, 2013-2014 Free Software Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover Texts as in (a) below.  A copy of the license is included in the section entitled ``GNU Free Documentation License''.

     (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and modify this GNU manual.''

Introduction
************

Htmlfontify provides a means of converting individual Emacs buffers, source files, or entire source trees to html, preserving formatting and Emacs colorization / syntax highlighting as much as possible through careful application of CSS stylesheets and html tags.

It can also turn instances of functions, methods and (for some languages) variables and other constructs and items into links to their definitions, and create an index file (or files) of all such symbols, also linked to their points of definition.

Htmlfontify also provides several customization items, which should allow it to mesh more-or-less seamlessly with various templating or publishing systems (in the event, for instance, that you don't want to produce the html pages directly).

Usage & Examples
****************

Htmlfontify can be used both interactively and as part of another elisp function.  If you're running it in a modern Emacs, it will also run when attached to a terminal (i.e., without X) or even when in batch mode.

Interactive
===========

Htmlfontify provides the following interactive functions:

htmlfontify-buffer

          (htmlfontify-buffer &optional SRCDIR FILE)

     Create a new buffer, named for the current buffer + a .html extension, containing an inline CSS-stylesheet and formatted CSS-markup html that reproduces the look of the current Emacs buffer as closely as possible.

     ``Dangerous'' characters in the existing buffer are turned into html entities, so you should even be able to do html-within-html fontified display.

     You should, however, note that random control or non-ASCII characters such as ^L (\x0c) or ¤ (\xa4) won't get mapped yet.

     If the SRCDIR and FILE arguments are set, lookup etags derived entries in the hfy-tags-cache and add html anchors and hyperlinks as appropriate.

htmlfontify-run-etags

          (htmlfontify-run-etags SRCDIR)

     Load the etags cache for SRCDIR.  See hfy-load-tags-cache.

htmlfontify-copy-and-link-dir

          (htmlfontify-copy-and-link-dir SRCDIR DSTDIR &optional F-EXT L-EXT)

     Trawl SRCDIR and write fontified-and-hyperlinked output in DSTDIR.  F-EXT and L-EXT specify values for hfy-extn and hfy-link-extn.

     You may also want to set hfy-page-header and hfy-page-footer.

htmlfontify-load-rgb-file

          (htmlfontify-load-rgb-file &optional FILE)

     Load an X11 style rgb.txt file (search hfy-rgb-load-path if FILE is not specified).

     Note that this is not necessary if all you want is the standard X11 (XFree86 4.1.0) color name -> rgb triplet mapping.  Htmlfontify has a copy built in, for use when it cannot contact an X server.

     Loads the variable hfy-rgb-txt-color-map, which is used by hfy-fallback-color-values.

htmlfontify-unload-rgb-file

          (htmlfontify-unload-rgb-file)

     Unload the currently loaded X11 style rgb.txt file (if any).

Non-interactive
===============

In addition to the aforementioned interactive methods, Htmlfontify provides the following non-interactive ones:

hfy-face-to-style

          (hfy-face-to-style FN)

     Take FN, a font or defface style font specification, (as returned by face-attr-construct or hfy-face-attr-for-class) and return a hfy-style-assoc.

     See also: hfy-face-to-style-i, hfy-flatten-style.

hfy-fallback-color-values

          (hfy-fallback-color-values COLOR-STRING)

     Use a fallback method for obtaining the rgb values for a color. If htmlfontify-load-rgb-file has been called, it uses the color map specified, otherwise it uses Htmlfontify's built in map.

hfy-combined-face-spec

          (hfy-combined-face-spec FACE)

     Return a defface style alist of possible specifications for FACE, with any entries resulting from user customization (custom-set-faces) taking precedence.

     See also: hfy-default-face-def

hfy-word-regex

          (hfy-word-regex STRING)

     Return a regex that matches STRING as the first match-string, with non word characters on either side (vaguely emulating the perl \b regex atom).

hfy-force-fontification

          (hfy-force-fontification)

     Emacs's fontification is designed for interactive use.  As such, it sometimes does things like deferring fontification until a section of the buffer is exposed and rendered, or until Emacs is idle for a while.  Sometimes, in non-interactive circumstances, or if it can't see X, it doesn't bother with some of the harder stuff.  While this is all great from the perspective of a user waiting for Emacs to load a 20000 line file and colorize it, it's a pain from the point of view from non-interactive code.  This function lies, cheats, steals and generally bullies Emacs into fontifying a buffer from start to finish, with all the extra frills, whether it thinks it needs to or not.  Oh yes: it operates on the current buffer.

hfy-link-style-string

          (hfy-link-style-string STYLE-STRING)

     Replace the end of a CSS style declaration STYLE-STRING with the contents of the variable hfy-src-doc-link-style, removing text matching the regex hfy-src-doc-link-unstyle first, if necessary.

hfy-prepare-index-i

          (hfy-prepare-index-i SRCDIR DSTDIR FILENAME &optional STUB MAP)

     Prepare a tags index buffer for SRCDIR. hfy-tags-cache must already have an entry for SRCDIR for this to work.  hfy-page-header, hfy-page-footer, hfy-link-extn and hfy-extn all play a part here.

     If STUB is set, prepare an (appropriately named) index buffer specifically for entries beginning with STUB.

     If MAP is set, use that instead of hfy-tags-cache.

hfy-compile-stylesheet

          (hfy-compile-stylesheet)

     Trawl the current buffer, construct and return a hfy-sheet-assoc.

hfy-css-name

          (hfy-css-name FN)

     Strip some of the boring bits from a font-name and return a CSS style name.  If FN is a defface attribute list, either construct a name for it, store it in the cache, and return it, or just fetch it from the cache if it's already there.

hfy-make-directory

          (hfy-make-directory DIR)

     Approximate equivalent of mkdir -p DIR.

hfy-triplet

          (hfy-triplet COLOR)

     Takes a color name (string) and return a CSS rgb(R, G, B) triplet string. Uses the definition of ``white'' to map the numbers to the 0-255 range, so if you've redefined white, (especially if you've redefined it to have a triplet member lower than that of the color you are processing, strange things may happen).

hfy-default-footer

          (hfy-default-footer FILE)

     Default value for hfy-page-footer

hfy-list-files

          (hfy-list-files DIRECTORY)

     Return a list of files under DIRECTORY. Strips any leading ./ from each filename.

hfy-color-vals

          (hfy-color-vals COLOR)

     Where COLOR is a color name or #XXXXXX style triplet, return a list of 3 (16 bit) rgb values for said color.  If a window system is unavailable, calls hfy-fallback-color-values.

hfy-href-stub

          (hfy-href-stub THIS-FILE DEF-FILES TAG)

     Return an href stub for a tag href: if DEF-FILES (list of files containing definitions for the tag in question) contains only one entry, the href should link straight to that file.  Otherwise, the link should be to the index file.

     We are not yet concerned with the file extensions/tag line number and so on at this point.

     If hfy-split-index is set, and the href will be to an index file rather than a source file, append a .X to hfy-index-file, where X is the uppercased first character of TAG.

     See also: hfy-relstub, hfy-index-file.

hfy-line-number

          (hfy-line-number)

     Returns the line number of the point in the current buffer.

hfy-merge-adjacent-spans

          (hfy-merge-adjacent-spans FACE-MAP)

     Where FACE-MAP is a hfy-facemap-assoc for the current buffer, this function merges adjacent style blocks which are of the same value and are separated by nothing more interesting than whitespace.

     <span class="foo">narf</span> <span class="foo">brain</span>

     (as interpreted from FACE-MAP) would become:

     <span class="foo">narf brain</span>

     Returns a modified copy of FACE-MAP (also a hfy-facemap-assoc).

hfy-mark-tag-names

          (hfy-mark-tag-names SRCDIR FILE)

     Mark tags in FILE (lookup SRCDIR in hfy-tags-cache) with the hfy-anchor property, with a value of tag.line-number.

hfy-weight

          (hfy-weight WEIGHT)

     Derive a font-weight CSS specifier from an Emacs weight specification symbol.

hfy-size

          (hfy-size HEIGHT)

     Derive a CSS font-size specifier from an Emacs font :height attribute. Does not cope with the case where height is a function to be applied to the height of the underlying font.

hfy-default-header

          (hfy-default-header FILE STYLE)

     Default value for hfy-page-header

hfy-family

          (hfy-family FAMILY)

     Derives a CSS font-family specifier from an Emacs :family attribute.

hfy-mark-tag-hrefs

          (hfy-mark-tag-hrefs SRCDIR FILE)

     Mark href start points with the hfy-link property (value: href string).

     Mark href end points with the hfy-endl property (value t).

     Avoid overlapping links, and mark links in descending length of tag name in order to prevent subtags from usurping supertags; e.g., ``term'' for ``terminal'').

hfy-box

          (hfy-box BOX)

     Derive CSS border-* attributes from the Emacs :box attribute.

hfy-box-to-style

          (hfy-box-to-style SPEC)

     Convert a complex :box Emacs font attribute set to a list of CSS border-* attributes.  Don't call this directly---it is called by hfy-box when necessary.

hfy-html-enkludge-buffer

          (hfy-html-enkludge-buffer)

     Mark dangerous ["<>] characters with the hfy-quoteme property.

     See also hfy-html-dekludge-buffer.

hfy-buffer

          (hfy-buffer)

     Generate and return an Htmlfontify html output buffer for the current buffer.  May trample an existing buffer.

hfy-fontified-p

          (hfy-fontified-p)

     font-lock doesn't like to say a buffer's been fontified when in batch mode, but we want to know if we should fontify or raw copy, so in batch mode we check for non-default face properties.  Otherwise we test font-lock-mode and font-lock-fontified for truth.

hfy-lookup

          (hfy-lookup FACE STYLE)

     Where STYLE is a hfy-sheet-assoc and FACE is an Emacs face, return the relevant CSS style name.

hfy-fontify-buffer

          (hfy-fontify-buffer &optional SRCDIR FILE)

     Implement the guts of htmlfontify-buffer.

hfy-color

          (hfy-color COLOR)

     Convert an Emacs :foreground property to a CSS color property.

hfy-flatten-style

          (hfy-flatten-style STYLE)

     Take STYLE (see hfy-face-to-style-i, hfy-face-to-style) and merge any multiple attributes appropriately.  Currently only font-size is merged down to a single occurrence---others may need special handling, but I haven't encountered them yet.  Returns a hfy-style-assoc.

hfy-size-to-int

          (hfy-size-to-int SPEC)

     Convert SPEC, a CSS font-size specifier, back to an Emacs :height attribute value.  Used while merging multiple font-size attributes.

hfy-sprintf-stylesheet

          (hfy-sprintf-stylesheet CSS FILE)

     Generates a header, via hfy-page-header, for FILE, containing the stylesheet derived from CSS, which is a hfy-sheet-assoc.  Returns a string containing the same.

hfy-relstub

          (hfy-relstub FILE &optional START)

     Return a ../ stub of the appropriate length for the current source tree depth (as determined from FILE).

hfy-compile-face-map

          (hfy-compile-face-map)

     Compile and return a hfy-facemap-assoc for the current buffer.

hfy-prepare-index

          (hfy-prepare-index SRCDIR DSTDIR)

     Return as list of index buffer(s), as determined by hfy-split-index. Uses hfy-prepare-index-i to do this.

hfy-prepare-tag-map

          (hfy-prepare-tag-map SRCDIR DSTDIR)

     Prepare the counterpart(s) to the index buffer(s)---a list of buffers with the same structure, but listing (and linking to) instances of tags (as opposed to their definitions).

     See also: hfy-prepare-index, hfy-split-index

hfy-subtract-maps

          (hfy-subtract-maps SRCDIR)

     Internal function---strips definitions of tags from the instance map. See: hfy-tags-cache and hfy-tags-rmap

hfy-face-to-style-i

          (hfy-face-to-style-i FN)

     The guts of hfy-face-to-style.  FN should be a defface font specification, as returned by face-attr-construct or hfy-face-attr-for-class.  Note that this function does not get font-sizes right if they are based on inherited modifiers (via the :inherit) attribute, and any other modifiers that are cumulative if they appear multiple times need to be merged by the user---hfy-flatten-style should do this.

hfy-face-to-css

          (hfy-face-to-css FN)

     Take FN, a font or defface specification (c.f. face-attr-construct) and return a CSS style specification.

     See also: hfy-face-to-style

hfy-html-quote

          (hfy-html-quote CHAR-STRING)

     Map a string (usually 1 character long) to an html safe string (entity) if need be.

hfy-link-style

          (hfy-link-style STYLE-STRING)

     Convert the CSS style spec STYLE-STRING to its equivalent hyperlink style.

     See: hfy-link-style-fun.

hfy-p-to-face

          (hfy-p-to-face PROPS)

     Given PROPS, a list of text-properties, return the value of the face property, or nil.

hfy-box-to-border-assoc

          (hfy-box-to-border-assoc SPEC)

     Helper function for hfy-box-to-style.

hfy-face-attr-for-class

          (hfy-face-attr-for-class FACE &optional CLASS)

     Return the face attributes for FACE.  If CLASS is set, it must be a defface alist key [see below].  Prior to version 0.18, the first face specification returned by hfy-combined-face-spec which didn't clash with CLASS was returned.  In versions from 0.18 onwards, each font attribute list is scored, and the non-conflicting list with the highest score is returned.  (A specification with a class of t is considered to match any class you specify. This matches Emacs's behavior when deciding on which face attributes to use, to the best of my understanding ).

     If CLASS is nil, then you just get get whatever face-attr-construct returns; i.e., the current specification in effect for FACE.

     See hfy-display-class for details of valid values for CLASS.

hfy-face-at

          (hfy-face-at P)

     Find face in effect at point P.  If overlays are to be considered (see hfy-optimisations) then this may return a defface style list of face properties instead of a face symbol.

hfy-bgcol

          (hfy-bgcol COLOR)

     As per hfy-color but for background colors.

hfy-kludge-cperl-mode

          (hfy-kludge-cperl-mode)

     cperl mode does its best to not do some of its fontification when not in a windowing system---we try to trick it...

hfy-href

          (hfy-href THIS-FILE DEF-FILES TAG TAG-MAP)

     Return a relative href to the tag in question, based on

     THIS-FILE hfy-link-extn hfy-extn DEF-FILES TAG and TAG-MAP

     THIS-FILE is the current source file DEF-FILES is a list of file containing possible link endpoints for TAG TAG is the TAG in question TAG-MAP is the entry in hfy-tags-cache.

hfy-shell

          (hfy-shell)

     Returns a best guess at a Bourne compatible shell to use: If the current shell doesn't look promising, fall back to hfy-shell-file-name.

hfy-load-tags-cache

          (hfy-load-tags-cache SRCDIR)

     Run hfy-etags-cmd on SRCDIR: load hfy-tags-cache and hfy-tags-sortl.

hfy-parse-tags-buffer

          (hfy-parse-tags-buffer SRCDIR BUFFER)

     Parse a BUFFER containing etags formatted output, loading the hfy-tags-cache and hfy-tags-sortl entries for SRCDIR.

hfy-interq

          (hfy-interq SET-A SET-B)

     Return the intersection (using eq) of 2 lists.

hfy-text-p

          (hfy-text-p SRCDIR FILE)

     Is SRCDIR/FILE text?  Uses hfy-istext-command to determine this.

hfy-opt

          (hfy-opt SYMBOL)

     Is hfy-optimisations member SYMBOL set or not?

hfy-dirname

          (hfy-dirname FILE)

     Return everything preceding the last / from a relative filename, on the assumption that this will produce a relative directory name.  Hardly bombproof, but good enough in the context in which it is being used.

hfy-html-dekludge-buffer

          (hfy-html-dekludge-buffer)

     Transform all dangerous characters marked with the hfy-quoteme property using hfy-html-quote

     See also hfy-html-enkludge-buffer.

hfy-copy-and-fontify-file

          (hfy-copy-and-fontify-file SRCDIR DSTDIR FILE)

     Open FILE in SRCDIR---if fontified, write a fontified copy to DSTDIR adding an extension of hfy-extn.  Fontification is actually done by htmlfontify-buffer.  If the buffer is not fontified, just copy it.

hfy-decor

          (hfy-decor TAG VAL)

     Derive CSS text-decoration specifiers from various Emacs font attributes.

hfy-slant

          (hfy-slant SLANT)

     Derive a font-style CSS specifier from the Emacs :slant attribute---CSS does not define the reverse-* styles, so just maps those to the regular specifiers.

hfy-tags-for-file

          (hfy-tags-for-file SRCDIR FILE)

     List of etags tags that have definitions in this FILE.  Looks up the tags cache in hfy-tags-cache using SRCDIR as the key.

hfy-width

          (hfy-width WIDTH)

     Convert an Emacs :width attribute to a CSS font-stretch attribute.

Variables
=========

Important variables that are not customization items:

hfy-tags-cache

     This is an 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) ... )

     i.e., an alist mapping (relative) file paths to line and character offsets.

     See hfy-load-tags-cache.

hfy-tags-rmap

     hfy-tags-rmap is an 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.

hfy-tags-sortl

     hfy-tags-sortl is an alist of the form:

          (("/src/dir" . (tag0 tag1 tag2)) ... )

     Where the tags are stored in descending order of length.

     See: hfy-load-tags-cache.

Data Structures
===============

Some of the (informal) data structures used in Htmlfontify are detailed here:

hfy-style-assoc

     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")      )

hfy-sheet-assoc

     An assoc with elements of the form (face-name style-name . style-string). The actual stylesheet for each page is derived from one of these.

          '((default       "default" . "{ background: black; color: white}")
            (font-lock-string-face "string"  . "{ color: rgb(64,224,208) }"))

hfy-facemap-assoc

     An assoc of (point . FACE-SYMBOL) or (point . defface attribute list) and (point . end) elements, in descending order of point value (i.e., 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)
            ;; Big similar section elided.  You get the idea.
            (5459 . end)
            (5431 . (:inherit font-lock-keyword-face :background "7e7e7e"))
            (5431 . end)
            (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))

Examples
========

The following is a lump of code I use to fontify source code on my site, http://rtfm.etla.org/ (which was the reason, incidentally, that Htmlfontify was written in the first place).

     (defvar rtfm-section nil)

     ;; Constructs an appropriate header string to fit in with rtfm's
     ;; templating system, based on the file and the stylesheet string
     (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))

     ;; the footer:
     (defun rtfm-build-page-footer (file) "\nMAIN_CONTENT\n")

     (defun rtfm-fontify-buffer (section)
       (interactive "s section[eg- emacs / p4-blame]: ")
       (require 'htmlfontify)
       (let ((hfy-page-header  'rtfm-build-page-header)
     	(hfy-page-footer  'rtfm-build-page-footer)
     	(rtfm-section                     section))
         (htmlfontify-buffer)
         )
       )

     ;; Here's the function I actually call---it asks me for a section label,
     ;; and source and destination directories, and then binds a couple of
     ;; customization variable in a let before calling htmlfontify:
     (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")
     	(auto-mode-alist (append auto-mode-alist
     				 '(("dbi\\(shell\\|gtk\\)$" . cperl-mode)
     				   ("\\.xpm$"               . c-mode    ))))
     	)
         (htmlfontify-run-etags srcdir)
         (htmlfontify-copy-and-link-dir srcdir destdir ".src" ".html")))

Customization
*************

Htmlfontify provides the following variable and customization entries:

hfy-link-style-fun

     Set this to a function, which will be called with one argument (a { foo: bar; ...} CSS style-string)---it should return a copy of its argument, altered so as to make any changes you want made for text which is a hyperlink, in addition to being in the class to which that style would normally be applied.

hfy-html-quote-regex

     Regex to match (with a single back-reference per match) strings in HTML which should be quoted with hfy-html-quote (and see hfy-html-quote-map) to make them safe.

hfy-page-footer

     As hfy-page-header, but generates the output footer (and takes only 1 argument, the filename).

hfy-display-class

     Display class to use to determine which display class to use when calculating a face's attributes.  This is useful when, for example, you are running Emacs on a tty or in batch mode, and want Htmlfontify to have access to the face spec you would use if you were connected to an X display.

     Some valid class specification elements are:

            '(class      color)
            '(class      grayscale)
            '(background dark)
            '(background light)
            '(type       x-toolkit)
            '(type       tty)
            '(type       motif)
            '(type       lucid)

     Multiple values for a tag may be combined, to indicate that any one or more of these values in the specification key constitutes a match, eg:

     '((class color grayscale) (type tty)) would match any of:

            '((class color))
            '((class grayscale))
            '((class color grayscale)))
            '((class color foo))
            '((type  tty))
            '((type  tty) (class color))

     and so on.

hfy-page-header

     Function called with two arguments (the filename relative to the top level source directory being etag'd and fontified), and a string containing the <style>...</style> text to embed in the document---the string returned will be used as the header for the htmlfontified version of the source file.

     See also: hfy-page-footer

hfy-src-doc-link-style

     String to add to the <style> a variant of an Htmlfontify CSS class.

hfy-split-index

     Whether or not to split the index hfy-index-file alphabetically on the first letter of each tag.  Useful when the index would otherwise be large and take a long time to render or be difficult to navigate.

hfy-find-cmd

     ``find'' command used to harvest a list of files to attempt to fontify.

hfy-extn

     File extension used for output files.

hfy-default-face-def

     Fallback defface specification for the face default, used when hfy-display-class has been set (the normal Htmlfontify way of extracting potentially non-current face information doesn't necessarily work for default).

     For example, I customize this to:

          ((t :background "black" :foreground "white" :family "misc-fixed"))

hfy-init-kludge-hooks

     List of functions to call when starting htmlfontify-buffer to do any kludging necessary to get highlighting modes to behave as you want, even when not running under a window system.

hfy-shell-file-name

     Should be set to a Bourne compatible shell, which will be invoked for the more complex shell interactions needed by Htmlfontify. Currently this is only required/used when using GNU etags, see hfy-etags-cmd-alist for details.

hfy-optimisations

     Optimizations to turn on.  So far, the following have been implemented:

     merge-adjacent-tags
          If two (or more) span tags are adjacent, identical and separated by nothing more than whitespace, they will be merged into one span.

     zap-comment-links
          Suppress hyperlinking of tags found in comments.

     zap-string-links
          Suppress hyperlinking of tags found in strings.

     div-wrapper
          Add <div class="default"> </div> tags around the fontified body. (Some people like this because they cut and paste the html into a page with different colors than the fontified code.)

     keep-overlays
          Preserve overlay highlighting (c.f. ediff or goo-font-lock) as well as basic faces.  Can result in extremely verbose highlighting if there are many overlays (as is the case with goo-font-lock).

     And the following are planned but not yet available:

     kill-context-leak
          Suppress hyperlinking between files highlighted by different modes.

     Note: like compiler optimizations, these optimize the output of the code, not the processing of the source itself, and are therefore likely to slow Htmlfontify down, at least a little.  Except for skip-refontification, which can never slow you down, but may result in incomplete fontification.

hfy-src-doc-link-unstyle

     Regex to remove from the <style> a variant of an Htmlfontify CSS class.

hfy-link-extn

     File extension used for href links---useful where the Htmlfontify output files are going to be processed again, with a resulting change in file extension.  If nil, then any code using this should fall back to hfy-extn.

hfy-istext-command

     Command to run with the name of a file, to see whether it is a text file or not.  The command should emit a string containing the word text if the file is a text file, and a string not containing text otherwise.

hfy-etags-cmd-alist

     An alist of possible shell commands that will generate etags output that Htmlfontify can use.  %s will be replaced by hfy-etags-bin.

hfy-etags-bin

     The location of the etags binary (we begin by assuming it's in your path).

     Note that if etags is not in your path, you will need to alter the shell commands in hfy-etags-cmd-alist.

     [As of version 0.17, this requirement has been removed: it should all just work(tm).]

hfy-etags-cmd

     An etags shell command to run in the source directory to generate a tags file for the whole source tree from there on down.  The command should emit the etags output on standard output.

     Two canned commands are provided---they drive Emacs's etags and exuberant-ctags's etags respectively.

hfy-etag-regex

     Regex used to parse an etags entry: must have 3 subexps, corresponding, in order, to:

      1. The tag

      2. The line

      3. The character (point) at which the tag occurs

hfy-index-file

     Name (sans extension) of the index file produced during fontification-and-hyperlinking.

hfy-instance-file

     Name (sans extension) of the tag usage index file produced during fontification-and-hyperlinking.

hfy-html-quote-map

     An alist of character -> entity mappings used to make the text html-safe.

Requirements
************

Htmlfontify has a couple of external requirements:

  * GNU Emacs 20.7+ or 21.1+

     Other versions may work---these have been used successfully by the author.  If you intend to use Htmlfontify in batch mode, 21.1+ is pretty much required.  The author does not know if XEmacs, NTemacs, or J.Random Emacs will run Htmlfontify, but reports/patches/bags of money are always welcome.

  * A copy of etags (exuberant-ctags or GNU etags).  Htmlfontify attempts to autodetect the version you have and customize itself accordingly, but you should be able to override this.

     See: Customization

  * A copy of find (e.g., GNU find) that provides the -path predicate.

     You may be able to work around this with a suitable clever shell command and the customization entry: hfy-find-cmd

  * A copy of sed (e.g., GNU sed).

  * A copy of the file command.

GNU Free Documentation License
******************************

     [file doclicense.texi not included]

Index
*****

Concepts

Functions

Variables & Customization