\input texinfo @c documentation for htmlfontify @c written by Vivek Dasmohapatra @comment %**start of header (This is for running Texinfo on a region.) @setfilename htmlfontify.info @settitle Htmlfontify User Manual @dircategory Emacs @direntry * Htmlfontify: (htmlfontify). A source code -> linked html + css transformer @end direntry @exampleindent 2 @comment %**end of header (This is for running Texinfo on a region.) @ifinfo This file documents Htmlfontify, a source code -> crosslinked + formatted + syntax colourised html transformer. Copyright (c) 2002,2003 Vivek Dasmohapatra Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation Licence, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the licence is included in the section entitled "GNU Free Documentation Licence". @end ifinfo @titlepage @title Htmlfontify User Manual @sp 4 @subtitle Htmlfontify version 0.20 @sp 1 @subtitle Jun 2002 @sp 5 @author Vivek Dasmohapatra @page @vskip 0pt plus 1filll @noindent Copyright @copyright{} 2002 Vivek Dasmohapatra Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation Licence, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the licence is included in the section entitled "GNU Free Documentation Licence". @end titlepage @page @node Top, Introduction, (dir), (dir) @menu * Introduction:: About Htmlfontify. * Usage & Examples:: How to use Htmlfontify. * Customisation:: Fine tuning Htmlfontify's behaviour. * Requirements:: External programs used by Htmlfontify. * Index:: Index of Contents. * COPYING:: The GNU Free Documentation Licence. @end menu @node Introduction, Usage & Examples, Top, Top @chapter Introduction @cindex Introduction Htmlfontify provides a means of converting individual emacs buffers, source files, or entire source trees to html, preserving formatting and emacs colourisation / 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 customisation 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 ). @node Usage & Examples, Customisation, Introduction, Top @chapter Usage & Examples @cindex Usage & Examples Htmlfontify can be used both interactively and as part of another elisp function. If you're running it in emacs21 ( its native land, it were ), it will also run when attached to a terminal ( ie w/o X ) or even when in batch mode. @menu * Interactive:: Using htmlfontify interactively. * Non-interactive:: Using htmlfontify from elisp. * Variables:: Variables (other than customisation entries). * Data Structures:: Important Data Structures. * Examples:: Example(s) of htmlfontify in use. @end menu @node Interactive, Non-interactive, , Usage & Examples @section Interactive @cindex Interactive @cindex functions (interactive) Htmlfontify provides the following interactive functions: @table @code @item htmlfontify-buffer @findex htmlfontify-buffer @anchor{htmlfontify-buffer} @lisp (htmlfontify-buffer &optional @var{srcdir} @var{file}) @end lisp 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 eight-bit characters such as ^L (\x0c) or ¤ (\xa4) won't get mapped yet. If the @var{srcdir} and @var{file} arguments are set, lookup etags derived entries in the @ref{hfy-tags-cache} and add html anchors and hyperlinks as appropriate. @item htmlfontify-run-etags @findex htmlfontify-run-etags @anchor{htmlfontify-run-etags} @lisp (htmlfontify-run-etags @var{srcdir}) @end lisp Load the etags cache for @var{srcdir}. See @ref{hfy-load-tags-cache}. @item htmlfontify-copy-and-link-dir @findex htmlfontify-copy-and-link-dir @anchor{htmlfontify-copy-and-link-dir} @lisp (htmlfontify-copy-and-link-dir @var{srcdir} @var{dstdir} &optional @var{f-ext} @var{l-ext}) @end lisp Trawl @var{srcdir} and write fontified-and-hyperlinked output in @var{dstdir} @var{f-ext} and @var{l-ext} specify values for @ref{hfy-extn} and @ref{hfy-link-extn}. You may also want to set @ref{hfy-page-header} and @ref{hfy-page-footer}. @item htmlfontify-load-rgb-file @findex htmlfontify-load-rgb-file @anchor{htmlfontify-load-rgb-file} @lisp (htmlfontify-load-rgb-file &optional @var{file}) @end lisp Load an X11 style rgb.txt file (search @code{hfy-rgb-load-path} if @var{file} is not specified). Note that this is not necessary if all you want is the standard X11 (XFree86 4.1.0) colour name -> rgb triplet mapping, htmlfontify has a copy built in, for use when it cannot contact an X server. Loads the variable @code{hfy-rgb-txt-colour-map}, which is used by @ref{hfy-fallback-colour-values}. @item htmlfontify-unload-rgb-file @findex htmlfontify-unload-rgb-file @anchor{htmlfontify-unload-rgb-file} @lisp (htmlfontify-unload-rgb-file) @end lisp Unload the currently loaded X11 style rgb.txt file ( if any ). @end table @node Non-interactive, Variables, Interactive, Usage & Examples @section Non-interactive @cindex Noninteractive @cindex functions (noninteractive) In addition to the aforementioned interactive methods, htmlfontify provides the following non-interactive ones: @table @code @comment AUTOGENERATED BLOCK @item hfy-face-to-style @findex hfy-face-to-style @anchor{hfy-face-to-style} @lisp (hfy-face-to-style @var{fn}) @end lisp Take @var{fn}, a font or @code{defface} style font specification, (as returned by @code{face-attr-construct} or @ref{hfy-face-attr-for-class}) and return a @ref{hfy-style-assoc}. See also: @ref{hfy-face-to-style-i}, @ref{hfy-flatten-style}. @item hfy-fallback-colour-values @findex hfy-fallback-colour-values @anchor{hfy-fallback-colour-values} @lisp (hfy-fallback-colour-values @var{colour-string}) @end lisp Use a fallback method for obtaining the rgb values for a colour. If @ref{htmlfontify-load-rgb-file} has been called, it uses the colour map specified, otherwise it uses htmlfontify's built in map. @item hfy-combined-face-spec @findex hfy-combined-face-spec @anchor{hfy-combined-face-spec} @lisp (hfy-combined-face-spec @var{face}) @end lisp Return a @code{defface} style alist of possible specifications for @var{face}, with any entries resulting from user customisation (@code{custom-set-faces}) taking precedence. See also: @ref{hfy-default-face-def} @item hfy-word-regex @findex hfy-word-regex @anchor{hfy-word-regex} @lisp (hfy-word-regex @var{string}) @end lisp Return a regex that matches @var{string} as the first @code{match-string}, with non word characters on either side (vaguely emulating the perl @code{\b} regex atom). @item hfy-force-fontification @findex hfy-force-fontification @anchor{hfy-force-fontification} @lisp (hfy-force-fontification) @end lisp Emacs' 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 colourise 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 nneds to or not. Oh yes: it operates on the current buffer. @item hfy-link-style-string @findex hfy-link-style-string @anchor{hfy-link-style-string} @lisp (hfy-link-style-string @var{style-string}) @end lisp Replace the end of a css style declaration @var{style-string} with the contents of the variable @ref{hfy-src-doc-link-style}, removing text matching the regex @ref{hfy-src-doc-link-unstyle} first, if necessary. @item hfy-prepare-index-i @findex hfy-prepare-index-i @anchor{hfy-prepare-index-i} @lisp (hfy-prepare-index-i @var{srcdir} @var{dstdir} @var{filename} &optional @var{stub} @var{map}) @end lisp Prepare a tags index buffer for @var{srcdir}. @ref{hfy-tags-cache} must already have an entry for @var{srcdir} for this to work. @ref{hfy-page-header}, @ref{hfy-page-footer}, @ref{hfy-link-extn} and @ref{hfy-extn} all play a part here. If @var{stub} is set, prepare an (appropriately named) index buffer specifically for entries beginning with @var{stub}. If @var{map} is set, use that instead of @ref{hfy-tags-cache}. @item hfy-compile-stylesheet @findex hfy-compile-stylesheet @anchor{hfy-compile-stylesheet} @lisp (hfy-compile-stylesheet) @end lisp Trawl the current buffer, construct and return a @ref{hfy-sheet-assoc}. @item hfy-css-name @findex hfy-css-name @anchor{hfy-css-name} @lisp (hfy-css-name @var{fn}) @end lisp Strip some of the boring bits from a font-name and return a css style name. If @var{fn} is a @code{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. @item hfy-make-directory @findex hfy-make-directory @anchor{hfy-make-directory} @lisp (hfy-make-directory @var{dir}) @end lisp Approx equivalent of mkdir -p @var{dir} @item hfy-triplet @findex hfy-triplet @anchor{hfy-triplet} @lisp (hfy-triplet @var{colour}) @end lisp Takes a colour 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, (esp if you've redefined it to have a triplet member lower than that of the colour you are processing, strange things may happen). @item hfy-default-footer @findex hfy-default-footer @anchor{hfy-default-footer} @lisp (hfy-default-footer @var{file}) @end lisp Default value for @ref{hfy-page-footer} @item hfy-list-files @findex hfy-list-files @anchor{hfy-list-files} @lisp (hfy-list-files @var{directory}) @end lisp Return a list of files under @var{directory}. Strips any leading "./" from each filename. @item hfy-colour-vals @findex hfy-colour-vals @anchor{hfy-colour-vals} @lisp (hfy-colour-vals @var{colour}) @end lisp Where @var{colour} is a colour name or #XXXXXX style triplet, return a list of 3 (16 bit) rgb values for said colour. If a window system is unavailable, calls @ref{hfy-fallback-colour-values}. @item hfy-href-stub @findex hfy-href-stub @anchor{hfy-href-stub} @lisp (hfy-href-stub @var{this-file} @var{def-files} @var{tag}) @end lisp Return an href stub for a tag href: if @var{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 @ref{hfy-split-index} is set, and the href wil be to an index file rather than a source file, append a .X to @ref{hfy-index-file}, where X is the uppercased first character of @var{tag}. See also: @ref{hfy-relstub}, @ref{hfy-index-file}. @item hfy-line-number @findex hfy-line-number @anchor{hfy-line-number} @lisp (hfy-line-number) @end lisp Returns the line number of the point in the current buffer. @item hfy-merge-adjacent-spans @findex hfy-merge-adjacent-spans @anchor{hfy-merge-adjacent-spans} @lisp (hfy-merge-adjacent-spans @var{face-map}) @end lisp Where @var{face-map} is a @ref{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. @code{narf brain} (as interpreted from @var{face-map}) would become: @code{narf brain} Returns a modified copy of @var{face-map} (also a @ref{hfy-facemap-assoc}). @item hfy-mark-tag-names @findex hfy-mark-tag-names @anchor{hfy-mark-tag-names} @lisp (hfy-mark-tag-names @var{srcdir} @var{file}) @end lisp Mark tags in @var{file} (lookup @var{srcdir} in @ref{hfy-tags-cache}) with the 'hfy-anchor property, with a value of "tag.line-number". @item hfy-weight @findex hfy-weight @anchor{hfy-weight} @lisp (hfy-weight @var{weight}) @end lisp Derive a font-weight css specifier from an emacs weight spec symbol. @item hfy-size @findex hfy-size @anchor{hfy-size} @lisp (hfy-size @var{height}) @end lisp 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. @item hfy-default-header @findex hfy-default-header @anchor{hfy-default-header} @lisp (hfy-default-header @var{file} @var{style}) @end lisp Default value for @ref{hfy-page-header} @item hfy-family @findex hfy-family @anchor{hfy-family} @lisp (hfy-family @var{family}) @end lisp Derives a css font-family specifier from an emacs :family attribute. @item hfy-mark-tag-hrefs @findex hfy-mark-tag-hrefs @anchor{hfy-mark-tag-hrefs} @lisp (hfy-mark-tag-hrefs @var{srcdir} @var{file}) @end lisp Mark href start points with the 'hfy-link prop (value: href string) Mark href end points with the 'hfy-endl prop (value t) Avoid overlapping links, and mark links in descending length of tag name in order to prevent subtags from usurping supertags, (eg "term" for "terminal"). @item hfy-box @findex hfy-box @anchor{hfy-box} @lisp (hfy-box @var{box}) @end lisp Derive CSS border-* attributes from the emacs :box attribute. @item hfy-box-to-style @findex hfy-box-to-style @anchor{hfy-box-to-style} @lisp (hfy-box-to-style @var{spec}) @end lisp Convert a complex :box emacs font attribute set to a list of CSS border-* attributes. Don't call this directly - it is called by @ref{hfy-box} when necessary. @item hfy-html-enkludge-buffer @findex hfy-html-enkludge-buffer @anchor{hfy-html-enkludge-buffer} @lisp (hfy-html-enkludge-buffer) @end lisp Mark dangerous ["<>] characters with the 'hfy-quoteme property. See also @ref{hfy-html-dekludge-buffer}. @item hfy-buffer @findex hfy-buffer @anchor{hfy-buffer} @lisp (hfy-buffer) @end lisp Generate and return an htmlfontify html output buffer for the current buffer. May trample an existing buffer. @item hfy-fontified-p @findex hfy-fontified-p @anchor{hfy-fontified-p} @lisp (hfy-fontified-p) @end lisp @code{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 @code{font-lock-mode} and @code{font-lock-fontified} for truth. @item hfy-lookup @findex hfy-lookup @anchor{hfy-lookup} @lisp (hfy-lookup @var{face} @var{style}) @end lisp Where @var{style} is a @ref{hfy-sheet-assoc} and @var{face} is an emacs face, return the relevant @var{css} style name. @item hfy-fontify-buffer @findex hfy-fontify-buffer @anchor{hfy-fontify-buffer} @lisp (hfy-fontify-buffer &optional @var{srcdir} @var{file}) @end lisp Implement the guts of @ref{htmlfontify-buffer} @item hfy-colour @findex hfy-colour @anchor{hfy-colour} @lisp (hfy-colour @var{colour}) @end lisp Convert an emacs :foreground property to a CSS colour property. @item hfy-flatten-style @findex hfy-flatten-style @anchor{hfy-flatten-style} @lisp (hfy-flatten-style @var{style}) @end lisp Take @var{style} (see @ref{hfy-face-to-style-i}, @ref{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 @ref{hfy-style-assoc}. @item hfy-size-to-int @findex hfy-size-to-int @anchor{hfy-size-to-int} @lisp (hfy-size-to-int @var{spec}) @end lisp Convert @var{spec}, a css font-size specifier, back to an emacs :height attribute value. Used while merging multiple font-size attributes. @item hfy-sprintf-stylesheet @findex hfy-sprintf-stylesheet @anchor{hfy-sprintf-stylesheet} @lisp (hfy-sprintf-stylesheet @var{css} @var{file}) @end lisp Generates a header, via @ref{hfy-page-header}, for @var{file}, containing the stylesheet derived from @var{css}, which is a @ref{hfy-sheet-assoc}. Returns a string containing the same. @item hfy-relstub @findex hfy-relstub @anchor{hfy-relstub} @lisp (hfy-relstub @var{file} &optional @var{start}) @end lisp Return a "../" stub of the appropriate length for the current source tree depth (as determined from @var{file}). iyswim. @item hfy-compile-face-map @findex hfy-compile-face-map @anchor{hfy-compile-face-map} @lisp (hfy-compile-face-map) @end lisp Compile and return a @ref{hfy-facemap-assoc} for the current buffer. @item hfy-prepare-index @findex hfy-prepare-index @anchor{hfy-prepare-index} @lisp (hfy-prepare-index @var{srcdir} @var{dstdir}) @end lisp Return as list of index buffer(s), as determined by @ref{hfy-split-index}. Uses @ref{hfy-prepare-index-i} to do this. @item hfy-prepare-tag-map @findex hfy-prepare-tag-map @anchor{hfy-prepare-tag-map} @lisp (hfy-prepare-tag-map @var{srcdir} @var{dstdir}) @end lisp 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: @ref{hfy-prepare-index}, @ref{hfy-split-index} @item hfy-subtract-maps @findex hfy-subtract-maps @anchor{hfy-subtract-maps} @lisp (hfy-subtract-maps @var{srcdir}) @end lisp Internal function - strips definitions of tags from the instance map. See: @ref{hfy-tags-cache} and @ref{hfy-tags-rmap} @item hfy-face-to-style-i @findex hfy-face-to-style-i @anchor{hfy-face-to-style-i} @lisp (hfy-face-to-style-i @var{fn}) @end lisp The guts of @ref{hfy-face-to-style}: @var{fn} should be a @code{defface} font specification, as returned by @code{face-attr-construct} or @ref{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 - @ref{hfy-flatten-style} should do this. @item hfy-face-to-css @findex hfy-face-to-css @anchor{hfy-face-to-css} @lisp (hfy-face-to-css @var{fn}) @end lisp Take @var{fn}, a font or @code{defface} specification (cf. @code{face-attr-construct}) and return a CSS style specification. See also: @ref{hfy-face-to-style} @item hfy-html-quote @findex hfy-html-quote @anchor{hfy-html-quote} @lisp (hfy-html-quote @var{char-string}) @end lisp Map a string (usu. 1 char long) to an html safe string (entity) if need be. @item hfy-link-style @findex hfy-link-style @anchor{hfy-link-style} @lisp (hfy-link-style @var{style-string}) @end lisp Convert the CSS style spec @var{style-string} to it's equivalent hyperlink style. See: @ref{hfy-link-style-fun}. @item hfy-p-to-face @findex hfy-p-to-face @anchor{hfy-p-to-face} @lisp (hfy-p-to-face @var{props}) @end lisp Given @var{props}, a list of text-properties, return the value of the face property, or nil. @item hfy-box-to-border-assoc @findex hfy-box-to-border-assoc @anchor{hfy-box-to-border-assoc} @lisp (hfy-box-to-border-assoc @var{spec}) @end lisp Helper function for @ref{hfy-box-to-style}. @item hfy-face-attr-for-class @findex hfy-face-attr-for-class @anchor{hfy-face-attr-for-class} @lisp (hfy-face-attr-for-class @var{face} &optional @var{class}) @end lisp Return the face attributes for @var{face}. If @var{class} is set, it must be a @code{defface} alist key [see below]. Prior to version 0.18, the first face specification returned by @ref{hfy-combined-face-spec} which @emph{didn't} clash with @var{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 @code{t} is considered to match any class you specify: This matches emacs' behaviour when deciding on which face attributes to use, to the best of my understanding ). If @var{class} is nil, then you just get get whatever @code{face-attr-construct} returns, ie the current specification in effect for @var{face}. See @ref{hfy-display-class} for details of valid values for @var{class}. @item hfy-face-at @findex hfy-face-at @anchor{hfy-face-at} @lisp (hfy-face-at P) @end lisp Find face in effect at point P. If overlays are to be considered (see @ref{hfy-optimisations}) then this may return a @code{defface} style list of face properties instead of a face symbol. @item hfy-bgcol @findex hfy-bgcol @anchor{hfy-bgcol} @lisp (hfy-bgcol @var{colour}) @end lisp As per @ref{hfy-colour} but for background colours. @item hfy-kludge-cperl-mode @findex hfy-kludge-cperl-mode @anchor{hfy-kludge-cperl-mode} @lisp (hfy-kludge-cperl-mode) @end lisp cperl mode does its damndest not to do some of its fontification when not in a windowing system - we try to trick it... @item hfy-href @findex hfy-href @anchor{hfy-href} @lisp (hfy-href @var{this-file} @var{def-files} @var{tag} @var{tag-map}) @end lisp Return a relative href to the tag in question, based on @var{this-file} @ref{hfy-link-extn} @ref{hfy-extn} @var{def-files} @var{tag} and @var{tag-map} @var{this-file} is the current source file @var{def-files} is a list of file containing possible link endpoints for @var{tag} @var{tag} is the @var{tag} in question @var{tag-map} is the entry in @ref{hfy-tags-cache}. @item hfy-shell @findex hfy-shell @anchor{hfy-shell} @lisp (hfy-shell) @end lisp Returns a best guess at a bourne compatible shell to use: If the current shell doesn't look promising, fall back to @ref{hfy-shell-file-name}. @item hfy-load-tags-cache @findex hfy-load-tags-cache @anchor{hfy-load-tags-cache} @lisp (hfy-load-tags-cache @var{srcdir}) @end lisp Run @ref{hfy-etags-cmd} on @var{srcdir}: load @ref{hfy-tags-cache} and @ref{hfy-tags-sortl}. @item hfy-parse-tags-buffer @findex hfy-parse-tags-buffer @anchor{hfy-parse-tags-buffer} @lisp (hfy-parse-tags-buffer @var{srcdir} @var{buffer}) @end lisp Parse a @var{buffer} containing etags formatted output, loading the @ref{hfy-tags-cache} and @ref{hfy-tags-sortl} entries for @var{srcdir}. @item hfy-interq @findex hfy-interq @anchor{hfy-interq} @lisp (hfy-interq @var{set-a} @var{set-b}) @end lisp Return the intersection ( using @code{eq} ) of 2 lists. @item hfy-text-p @findex hfy-text-p @anchor{hfy-text-p} @lisp (hfy-text-p @var{srcdir} @var{file}) @end lisp Is @var{srcdir}/@var{file} text? Uses @ref{hfy-istext-command} to determine this. @item hfy-opt @findex hfy-opt @anchor{hfy-opt} @lisp (hfy-opt @var{symbol}) @end lisp Is @ref{hfy-optimisations} member @var{symbol} set or not? @item hfy-dirname @findex hfy-dirname @anchor{hfy-dirname} @lisp (hfy-dirname @var{file}) @end lisp 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. @item hfy-html-dekludge-buffer @findex hfy-html-dekludge-buffer @anchor{hfy-html-dekludge-buffer} @lisp (hfy-html-dekludge-buffer) @end lisp Transform all dangerous characters marked with the 'hfy-quoteme property using @ref{hfy-html-quote} See also @ref{hfy-html-enkludge-buffer}. @item hfy-copy-and-fontify-file @findex hfy-copy-and-fontify-file @anchor{hfy-copy-and-fontify-file} @lisp (hfy-copy-and-fontify-file @var{srcdir} @var{dstdir} @var{file}) @end lisp open @var{file} in @var{srcdir} - if fontified, write a fontified copy to @var{dstdir} adding an extension of @ref{hfy-extn}. Fontification is actually done by @ref{htmlfontify-buffer}. If the buffer is not fontified, just copy it. @item hfy-decor @findex hfy-decor @anchor{hfy-decor} @lisp (hfy-decor @var{tag} @var{val}) @end lisp Derive CSS text-decoration specifiers from various emacs font attributes. @item hfy-slant @findex hfy-slant @anchor{hfy-slant} @lisp (hfy-slant @var{slant}) @end lisp 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. @item hfy-tags-for-file @findex hfy-tags-for-file @anchor{hfy-tags-for-file} @lisp (hfy-tags-for-file @var{srcdir} @var{file}) @end lisp List of etags tags that have definitions in this @var{file}. Looks up the tags cache in @ref{hfy-tags-cache} using @var{srcdir} as the key. @item hfy-width @findex hfy-width @anchor{hfy-width} @lisp (hfy-width @var{width}) @end lisp Convert an emacs :width attribute to a CSS font-stretch attribute. @comment /AUTOGENERATED BLOCK @end table @node Variables, Data Structures, Non-interactive, Usage & Examples @section Variables @cindex variables Important variables which are not customisation items: @table @code @item hfy-tags-cache @vindex hfy-tags-cache @anchor{hfy-tags-cache} This is an alist of the form: @example (("/src/dir/0" . tag-hash0) ("/src/dir/1" tag-hash1) ...) @end example Each tag hash entry then contains entries of the form: @example "tag_string" => (("file/name.ext" line char) ... ) @end example ie an alist mapping (relative) file paths to line and character offsets. See @ref{hfy-load-tags-cache}. @item hfy-tags-rmap @vindex hfy-tags-rmap @anchor{hfy-tags-rmap} @code{hfy-tags-rmap} is an alist of the form: @lisp (("/src/dir" . tag-rmap-hash)) @end lisp Where tag-rmap-hash has entries of the form: @example "tag_string" => ( "file/name.ext" line char ) @end example Unlike @ref{hfy-tags-cache} these are the locations of occurrences of tagged items, not the locations of their definitions. @item hfy-tags-sortl @vindex hfy-tags-sortl @anchor{hfy-tags-sortl} @code{hfy-tags-sortl} is an alist of the form: @example (("/src/dir" . (tag0 tag1 tag2)) ... ) @end example Where the tags are stored in descending order of length. See: @ref{hfy-load-tags-cache}. @end table @node Data Structures, Examples, Variables, Usage & Examples @section Data Structures @cindex Data Structures Some of the (informal) data structures used in Htmlfontify are detailed here: @table @code @item hfy-style-assoc @cindex hfy-style-assoc @anchor{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: @lisp (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") ) @end lisp @item hfy-sheet-assoc @cindex hfy-sheet-assoc @anchor{hfy-sheet-assoc} An assoc with elements of the form (face-name style-name . stlye-string): The actual stylesheet for each page is derived from one of these. @lisp '((default "default" . "@{ background: black; color: white@}") (font-lock-string-face "string" . "@{ color: rgb(64,224,208) @}")) @end lisp @item hfy-facemap-assoc @cindex hfy-facemap-assoc @anchor{hfy-facemap-assoc} An assoc of (point . @var{face-symbol}) or (point . @code{defface} attribute 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 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: @ref{hfy-page-footer} @item hfy-src-doc-link-style @vindex hfy-src-doc-link-style @anchor{hfy-src-doc-link-style} String to add to the '