htmlfontify.texi 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595
  1. \input texinfo
  2. @comment %**start of header
  3. @setfilename ../../info/htmlfontify.info
  4. @settitle Htmlfontify User Manual
  5. @include docstyle.texi
  6. @exampleindent 2
  7. @comment %**end of header
  8. @copying
  9. This manual documents Htmlfontify, a source code -> crosslinked +
  10. formatted + syntax colorized html transformer.
  11. Copyright @copyright{} 2002-2003, 2013-2016 Free Software Foundation,
  12. Inc.
  13. @quotation
  14. Permission is granted to copy, distribute and/or modify this document
  15. under the terms of the GNU Free Documentation License, Version 1.3 or
  16. any later version published by the Free Software Foundation; with no
  17. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
  18. and with the Back-Cover Texts as in (a) below. A copy of the license
  19. is included in the section entitled ``GNU Free Documentation License''.
  20. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  21. modify this GNU manual.''
  22. @end quotation
  23. @end copying
  24. @dircategory Emacs misc features
  25. @direntry
  26. * Htmlfontify: (htmlfontify). Convert source code to html.
  27. @end direntry
  28. @titlepage
  29. @title Htmlfontify User Manual
  30. @sp 4
  31. @subtitle Htmlfontify version 0.20
  32. @sp 1
  33. @subtitle Jun 2002
  34. @sp 5
  35. @author Vivek Dasmohapatra
  36. @page
  37. @vskip 0pt plus 1filll
  38. @noindent
  39. @insertcopying
  40. @end titlepage
  41. @contents
  42. @ifnottex
  43. @node Top
  44. @top Htmlfontify
  45. @insertcopying
  46. @end ifnottex
  47. @menu
  48. * Introduction:: About Htmlfontify.
  49. * Usage & Examples:: How to use Htmlfontify.
  50. * Customization:: Fine-tuning Htmlfontify's behavior.
  51. * Requirements:: External programs used by Htmlfontify.
  52. * GNU Free Documentation License:: The license for this documentation.
  53. * Index:: Index of contents.
  54. @end menu
  55. @node Introduction
  56. @chapter Introduction
  57. @cindex Introduction
  58. Htmlfontify provides a means of converting individual Emacs buffers,
  59. source files, or entire source trees to html, preserving formatting
  60. and Emacs colorization / syntax highlighting as much as possible
  61. through careful application of CSS stylesheets and html tags.
  62. It can also turn instances of functions, methods and (for some
  63. languages) variables and other constructs and items into links
  64. to their definitions, and create an index file (or files) of
  65. all such symbols, also linked to their points of definition.
  66. Htmlfontify also provides several customization items, which should
  67. allow it to mesh more-or-less seamlessly with various templating or
  68. publishing systems (in the event, for instance, that you don't want
  69. to produce the html pages directly).
  70. @node Usage & Examples
  71. @chapter Usage & Examples
  72. @cindex Usage & Examples
  73. Htmlfontify can be used both interactively and as part of another
  74. elisp function. If you're running it in a modern Emacs, it will also
  75. run when attached to a terminal (i.e., without X) or even when in
  76. batch mode.
  77. @menu
  78. * Interactive:: Using Htmlfontify interactively.
  79. * Non-interactive:: Using Htmlfontify from elisp.
  80. * Variables:: Variables (other than customization entries).
  81. * Data Structures:: Important data structures.
  82. * Examples:: Example(s) of Htmlfontify in use.
  83. @end menu
  84. @node Interactive
  85. @section Interactive
  86. @cindex Interactive
  87. @cindex functions (interactive)
  88. Htmlfontify provides the following interactive functions:
  89. @table @code
  90. @item htmlfontify-buffer
  91. @findex htmlfontify-buffer
  92. @anchor{htmlfontify-buffer}
  93. @lisp
  94. (htmlfontify-buffer &optional @var{srcdir} @var{file})
  95. @end lisp
  96. Create a new buffer, named for the current buffer + a .html extension,
  97. containing an inline CSS-stylesheet and formatted CSS-markup html that
  98. reproduces the look of the current Emacs buffer as closely as possible.
  99. ``Dangerous'' characters in the existing buffer are turned into html
  100. entities, so you should even be able to do html-within-html fontified
  101. display.
  102. You should, however, note that random control or non-ASCII characters
  103. such as ^L (\x0c) or ¤ (\xa4) won't get mapped yet.
  104. If the @var{srcdir} and @var{file} arguments are set, lookup etags
  105. derived entries in the @ref{hfy-tags-cache} and add html anchors
  106. and hyperlinks as appropriate.
  107. @item htmlfontify-run-etags
  108. @findex htmlfontify-run-etags
  109. @anchor{htmlfontify-run-etags}
  110. @lisp
  111. (htmlfontify-run-etags @var{srcdir})
  112. @end lisp
  113. Load the etags cache for @var{srcdir}. See @ref{hfy-load-tags-cache}.
  114. @item htmlfontify-copy-and-link-dir
  115. @findex htmlfontify-copy-and-link-dir
  116. @anchor{htmlfontify-copy-and-link-dir}
  117. @lisp
  118. (htmlfontify-copy-and-link-dir @var{srcdir} @var{dstdir} &optional @var{f-ext} @var{l-ext})
  119. @end lisp
  120. Trawl @var{srcdir} and write fontified-and-hyperlinked output in
  121. @var{dstdir}. @var{f-ext} and @var{l-ext} specify values for
  122. @ref{hfy-extn} and @ref{hfy-link-extn}.
  123. You may also want to set @ref{hfy-page-header} and @ref{hfy-page-footer}.
  124. @item htmlfontify-load-rgb-file
  125. @findex htmlfontify-load-rgb-file
  126. @anchor{htmlfontify-load-rgb-file}
  127. @lisp
  128. (htmlfontify-load-rgb-file &optional @var{file})
  129. @end lisp
  130. Load an X11 style rgb.txt file (search @code{hfy-rgb-load-path} if
  131. @var{file} is not specified).
  132. Note that this is not necessary if all you want is the standard X11
  133. (XFree86 4.1.0) color name -> rgb triplet mapping. Htmlfontify has
  134. a copy built in, for use when it cannot contact an X server.
  135. Loads the variable @code{hfy-rgb-txt-color-map}, which is used by
  136. @ref{hfy-fallback-color-values}.
  137. @item htmlfontify-unload-rgb-file
  138. @findex htmlfontify-unload-rgb-file
  139. @anchor{htmlfontify-unload-rgb-file}
  140. @lisp
  141. (htmlfontify-unload-rgb-file)
  142. @end lisp
  143. Unload the currently loaded X11 style rgb.txt file (if any).
  144. @end table
  145. @node Non-interactive
  146. @section Non-interactive
  147. @cindex Noninteractive
  148. @cindex functions (noninteractive)
  149. In addition to the aforementioned interactive methods, Htmlfontify
  150. provides the following non-interactive ones:
  151. @table @code
  152. @comment AUTOGENERATED BLOCK
  153. @item hfy-face-to-style
  154. @findex hfy-face-to-style
  155. @anchor{hfy-face-to-style}
  156. @lisp
  157. (hfy-face-to-style @var{fn})
  158. @end lisp
  159. Take @var{fn}, a font or @code{defface} style font specification,
  160. (as returned by @code{face-attr-construct} or @ref{hfy-face-attr-for-class})
  161. and return a @ref{hfy-style-assoc}.
  162. See also: @ref{hfy-face-to-style-i}, @ref{hfy-flatten-style}.
  163. @item hfy-fallback-color-values
  164. @findex hfy-fallback-color-values
  165. @anchor{hfy-fallback-color-values}
  166. @lisp
  167. (hfy-fallback-color-values @var{color-string})
  168. @end lisp
  169. Use a fallback method for obtaining the rgb values for a color.
  170. If @ref{htmlfontify-load-rgb-file} has been called, it uses the
  171. color map specified, otherwise it uses Htmlfontify's built in map.
  172. @item hfy-combined-face-spec
  173. @findex hfy-combined-face-spec
  174. @anchor{hfy-combined-face-spec}
  175. @lisp
  176. (hfy-combined-face-spec @var{face})
  177. @end lisp
  178. Return a @code{defface} style alist of possible specifications for
  179. @var{face}, with any entries resulting from user customization
  180. (@code{custom-set-faces}) taking precedence.
  181. See also: @ref{hfy-default-face-def}
  182. @item hfy-word-regex
  183. @findex hfy-word-regex
  184. @anchor{hfy-word-regex}
  185. @lisp
  186. (hfy-word-regex @var{string})
  187. @end lisp
  188. Return a regex that matches @var{string} as the first @code{match-string},
  189. with non word characters on either side (vaguely emulating the perl @code{\b}
  190. regex atom).
  191. @item hfy-force-fontification
  192. @findex hfy-force-fontification
  193. @anchor{hfy-force-fontification}
  194. @lisp
  195. (hfy-force-fontification)
  196. @end lisp
  197. Emacs's fontification is designed for interactive use. As such, it sometimes
  198. does things like deferring fontification until a section of the buffer is
  199. exposed and rendered, or until Emacs is idle for a while. Sometimes, in
  200. non-interactive circumstances, or if it can't see X, it doesn't bother
  201. with some of the harder stuff. While this is all great from the perspective
  202. of a user waiting for Emacs to load a 20000 line file and colorize it,
  203. it's a pain from the point of view from non-interactive code. This function
  204. lies, cheats, steals and generally bullies Emacs into fontifying a buffer
  205. from start to finish, with all the extra frills, whether it thinks it needs
  206. to or not. Oh yes: it operates on the current buffer.
  207. @item hfy-link-style-string
  208. @findex hfy-link-style-string
  209. @anchor{hfy-link-style-string}
  210. @lisp
  211. (hfy-link-style-string @var{style-string})
  212. @end lisp
  213. Replace the end of a CSS style declaration @var{style-string} with the contents
  214. of the variable @ref{hfy-src-doc-link-style}, removing text matching the
  215. regex @ref{hfy-src-doc-link-unstyle} first, if necessary.
  216. @item hfy-prepare-index-i
  217. @findex hfy-prepare-index-i
  218. @anchor{hfy-prepare-index-i}
  219. @lisp
  220. (hfy-prepare-index-i @var{srcdir} @var{dstdir} @var{filename} &optional @var{stub} @var{map})
  221. @end lisp
  222. Prepare a tags index buffer for @var{srcdir}.
  223. @ref{hfy-tags-cache} must already have an entry for @var{srcdir} for
  224. this to work. @ref{hfy-page-header}, @ref{hfy-page-footer},
  225. @ref{hfy-link-extn} and @ref{hfy-extn} all play a part here.
  226. If @var{stub} is set, prepare an (appropriately named) index buffer
  227. specifically for entries beginning with @var{stub}.
  228. If @var{map} is set, use that instead of @ref{hfy-tags-cache}.
  229. @item hfy-compile-stylesheet
  230. @findex hfy-compile-stylesheet
  231. @anchor{hfy-compile-stylesheet}
  232. @lisp
  233. (hfy-compile-stylesheet)
  234. @end lisp
  235. Trawl the current buffer, construct and return a @ref{hfy-sheet-assoc}.
  236. @item hfy-css-name
  237. @findex hfy-css-name
  238. @anchor{hfy-css-name}
  239. @lisp
  240. (hfy-css-name @var{fn})
  241. @end lisp
  242. Strip some of the boring bits from a font-name and return a CSS style
  243. name. If @var{fn} is a @code{defface} attribute list, either construct
  244. a name for it, store it in the cache, and return it, or just fetch it
  245. from the cache if it's already there.
  246. @item hfy-make-directory
  247. @findex hfy-make-directory
  248. @anchor{hfy-make-directory}
  249. @lisp
  250. (hfy-make-directory @var{dir})
  251. @end lisp
  252. Approximate equivalent of @code{mkdir -p @var{dir}}.
  253. @item hfy-triplet
  254. @findex hfy-triplet
  255. @anchor{hfy-triplet}
  256. @lisp
  257. (hfy-triplet @var{color})
  258. @end lisp
  259. Takes a color name (string) and return a CSS rgb(R, G, B) triplet string.
  260. Uses the definition of ``white'' to map the numbers to the 0-255 range, so
  261. if you've redefined white, (especially if you've redefined it to have
  262. a triplet member lower than that of the color you are processing,
  263. strange things may happen).
  264. @item hfy-default-footer
  265. @findex hfy-default-footer
  266. @anchor{hfy-default-footer}
  267. @lisp
  268. (hfy-default-footer @var{file})
  269. @end lisp
  270. Default value for @ref{hfy-page-footer}
  271. @item hfy-list-files
  272. @findex hfy-list-files
  273. @anchor{hfy-list-files}
  274. @lisp
  275. (hfy-list-files @var{directory})
  276. @end lisp
  277. Return a list of files under @var{directory}.
  278. Strips any leading @samp{./} from each filename.
  279. @item hfy-color-vals
  280. @findex hfy-color-vals
  281. @anchor{hfy-color-vals}
  282. @lisp
  283. (hfy-color-vals @var{color})
  284. @end lisp
  285. Where @var{color} is a color name or #XXXXXX style triplet, return a list of
  286. 3 (16 bit) rgb values for said color. If a window system is unavailable,
  287. calls @ref{hfy-fallback-color-values}.
  288. @item hfy-href-stub
  289. @findex hfy-href-stub
  290. @anchor{hfy-href-stub}
  291. @lisp
  292. (hfy-href-stub @var{this-file} @var{def-files} @var{tag})
  293. @end lisp
  294. Return an href stub for a tag href: if @var{def-files} (list of files
  295. containing definitions for the tag in question) contains only one entry,
  296. the href should link straight to that file. Otherwise, the link should
  297. be to the index file.
  298. We are not yet concerned with the file extensions/tag line number and
  299. so on at this point.
  300. If @ref{hfy-split-index} is set, and the href will be to an index file
  301. rather than a source file, append a @samp{.X} to @ref{hfy-index-file}, where
  302. @samp{X} is the uppercased first character of @var{tag}.
  303. See also: @ref{hfy-relstub}, @ref{hfy-index-file}.
  304. @item hfy-line-number
  305. @findex hfy-line-number
  306. @anchor{hfy-line-number}
  307. @lisp
  308. (hfy-line-number)
  309. @end lisp
  310. Returns the line number of the point in the current buffer.
  311. @item hfy-merge-adjacent-spans
  312. @findex hfy-merge-adjacent-spans
  313. @anchor{hfy-merge-adjacent-spans}
  314. @lisp
  315. (hfy-merge-adjacent-spans @var{face-map})
  316. @end lisp
  317. Where @var{face-map} is a @ref{hfy-facemap-assoc} for the current buffer,
  318. this function merges adjacent style blocks which are of the same value
  319. and are separated by nothing more interesting than whitespace.
  320. @code{<span class="foo">narf</span> <span class="foo">brain</span>}
  321. (as interpreted from @var{face-map}) would become:
  322. @code{<span class="foo">narf brain</span>}
  323. Returns a modified copy of @var{face-map} (also a @ref{hfy-facemap-assoc}).
  324. @item hfy-mark-tag-names
  325. @findex hfy-mark-tag-names
  326. @anchor{hfy-mark-tag-names}
  327. @lisp
  328. (hfy-mark-tag-names @var{srcdir} @var{file})
  329. @end lisp
  330. Mark tags in @var{file} (lookup @var{srcdir} in @ref{hfy-tags-cache}) with the
  331. @code{hfy-anchor} property, with a value of @samp{tag.line-number}.
  332. @item hfy-weight
  333. @findex hfy-weight
  334. @anchor{hfy-weight}
  335. @lisp
  336. (hfy-weight @var{weight})
  337. @end lisp
  338. Derive a font-weight CSS specifier from an Emacs weight specification symbol.
  339. @item hfy-size
  340. @findex hfy-size
  341. @anchor{hfy-size}
  342. @lisp
  343. (hfy-size @var{height})
  344. @end lisp
  345. Derive a CSS font-size specifier from an Emacs font @code{:height} attribute.
  346. Does not cope with the case where height is a function to be applied to
  347. the height of the underlying font.
  348. @item hfy-default-header
  349. @findex hfy-default-header
  350. @anchor{hfy-default-header}
  351. @lisp
  352. (hfy-default-header @var{file} @var{style})
  353. @end lisp
  354. Default value for @ref{hfy-page-header}
  355. @item hfy-family
  356. @findex hfy-family
  357. @anchor{hfy-family}
  358. @lisp
  359. (hfy-family @var{family})
  360. @end lisp
  361. Derives a CSS font-family specifier from an Emacs @code{:family} attribute.
  362. @item hfy-mark-tag-hrefs
  363. @findex hfy-mark-tag-hrefs
  364. @anchor{hfy-mark-tag-hrefs}
  365. @lisp
  366. (hfy-mark-tag-hrefs @var{srcdir} @var{file})
  367. @end lisp
  368. Mark href start points with the @code{hfy-link} property (value: href string).
  369. Mark href end points with the @code{hfy-endl} property (value @code{t}).
  370. Avoid overlapping links, and mark links in descending length of
  371. tag name in order to prevent subtags from usurping supertags;
  372. e.g., ``term'' for ``terminal'').
  373. @item hfy-box
  374. @findex hfy-box
  375. @anchor{hfy-box}
  376. @lisp
  377. (hfy-box @var{box})
  378. @end lisp
  379. Derive CSS border-* attributes from the Emacs @code{:box} attribute.
  380. @item hfy-box-to-style
  381. @findex hfy-box-to-style
  382. @anchor{hfy-box-to-style}
  383. @lisp
  384. (hfy-box-to-style @var{spec})
  385. @end lisp
  386. Convert a complex @code{:box} Emacs font attribute set to a list of
  387. CSS border-* attributes. Don't call this directly---it is called by
  388. @ref{hfy-box} when necessary.
  389. @item hfy-html-enkludge-buffer
  390. @findex hfy-html-enkludge-buffer
  391. @anchor{hfy-html-enkludge-buffer}
  392. @lisp
  393. (hfy-html-enkludge-buffer)
  394. @end lisp
  395. Mark dangerous @samp{["<>]} characters with the @code{hfy-quoteme} property.
  396. See also @ref{hfy-html-dekludge-buffer}.
  397. @item hfy-buffer
  398. @findex hfy-buffer
  399. @anchor{hfy-buffer}
  400. @lisp
  401. (hfy-buffer)
  402. @end lisp
  403. Generate and return an Htmlfontify html output buffer for the current
  404. buffer. May trample an existing buffer.
  405. @item hfy-fontified-p
  406. @findex hfy-fontified-p
  407. @anchor{hfy-fontified-p}
  408. @lisp
  409. (hfy-fontified-p)
  410. @end lisp
  411. @code{font-lock} doesn't like to say a buffer's been fontified when in
  412. batch mode, but we want to know if we should fontify or raw copy, so in
  413. batch mode we check for non-default face properties. Otherwise we test
  414. @code{font-lock-mode} and @code{font-lock-fontified} for truth.
  415. @item hfy-lookup
  416. @findex hfy-lookup
  417. @anchor{hfy-lookup}
  418. @lisp
  419. (hfy-lookup @var{face} @var{style})
  420. @end lisp
  421. Where @var{style} is a @ref{hfy-sheet-assoc} and @var{face} is an Emacs face,
  422. return the relevant @var{css} style name.
  423. @item hfy-fontify-buffer
  424. @findex hfy-fontify-buffer
  425. @anchor{hfy-fontify-buffer}
  426. @lisp
  427. (hfy-fontify-buffer &optional @var{srcdir} @var{file})
  428. @end lisp
  429. Implement the guts of @ref{htmlfontify-buffer}.
  430. @item hfy-color
  431. @findex hfy-color
  432. @anchor{hfy-color}
  433. @lisp
  434. (hfy-color @var{color})
  435. @end lisp
  436. Convert an Emacs :foreground property to a CSS color property.
  437. @item hfy-flatten-style
  438. @findex hfy-flatten-style
  439. @anchor{hfy-flatten-style}
  440. @lisp
  441. (hfy-flatten-style @var{style})
  442. @end lisp
  443. Take @var{style} (see @ref{hfy-face-to-style-i}, @ref{hfy-face-to-style})
  444. and merge any multiple attributes appropriately. Currently only font-size is
  445. merged down to a single occurrence---others may need special handling, but I
  446. haven't encountered them yet. Returns a @ref{hfy-style-assoc}.
  447. @item hfy-size-to-int
  448. @findex hfy-size-to-int
  449. @anchor{hfy-size-to-int}
  450. @lisp
  451. (hfy-size-to-int @var{spec})
  452. @end lisp
  453. Convert @var{spec}, a CSS font-size specifier, back to an Emacs
  454. @code{:height} attribute value. Used while merging multiple font-size
  455. attributes.
  456. @item hfy-sprintf-stylesheet
  457. @findex hfy-sprintf-stylesheet
  458. @anchor{hfy-sprintf-stylesheet}
  459. @lisp
  460. (hfy-sprintf-stylesheet @var{css} @var{file})
  461. @end lisp
  462. Generates a header, via @ref{hfy-page-header}, for @var{file}, containing the
  463. stylesheet derived from @var{css}, which is a @ref{hfy-sheet-assoc}. Returns a
  464. string containing the same.
  465. @item hfy-relstub
  466. @findex hfy-relstub
  467. @anchor{hfy-relstub}
  468. @lisp
  469. (hfy-relstub @var{file} &optional @var{start})
  470. @end lisp
  471. Return a @samp{../} stub of the appropriate length for the current source
  472. tree depth (as determined from @var{file}). @c iyswim.
  473. @item hfy-compile-face-map
  474. @findex hfy-compile-face-map
  475. @anchor{hfy-compile-face-map}
  476. @lisp
  477. (hfy-compile-face-map)
  478. @end lisp
  479. Compile and return a @ref{hfy-facemap-assoc} for the current buffer.
  480. @item hfy-prepare-index
  481. @findex hfy-prepare-index
  482. @anchor{hfy-prepare-index}
  483. @lisp
  484. (hfy-prepare-index @var{srcdir} @var{dstdir})
  485. @end lisp
  486. Return as list of index buffer(s), as determined by @ref{hfy-split-index}.
  487. Uses @ref{hfy-prepare-index-i} to do this.
  488. @item hfy-prepare-tag-map
  489. @findex hfy-prepare-tag-map
  490. @anchor{hfy-prepare-tag-map}
  491. @lisp
  492. (hfy-prepare-tag-map @var{srcdir} @var{dstdir})
  493. @end lisp
  494. Prepare the counterpart(s) to the index buffer(s)---a list of buffers with
  495. the same structure, but listing (and linking to) instances of tags (as
  496. opposed to their definitions).
  497. See also: @ref{hfy-prepare-index}, @ref{hfy-split-index}
  498. @item hfy-subtract-maps
  499. @findex hfy-subtract-maps
  500. @anchor{hfy-subtract-maps}
  501. @lisp
  502. (hfy-subtract-maps @var{srcdir})
  503. @end lisp
  504. Internal function---strips definitions of tags from the instance map.
  505. See: @ref{hfy-tags-cache} and @ref{hfy-tags-rmap}
  506. @item hfy-face-to-style-i
  507. @findex hfy-face-to-style-i
  508. @anchor{hfy-face-to-style-i}
  509. @lisp
  510. (hfy-face-to-style-i @var{fn})
  511. @end lisp
  512. The guts of @ref{hfy-face-to-style}. @var{fn} should be a @code{defface}
  513. font specification, as returned by @code{face-attr-construct} or
  514. @ref{hfy-face-attr-for-class}. Note that this function does not get
  515. font-sizes right if they are based on inherited modifiers (via the
  516. :inherit) attribute, and any other modifiers that are cumulative if they
  517. appear multiple times need to be merged by the user---@ref{hfy-flatten-style}
  518. should do this.
  519. @item hfy-face-to-css
  520. @findex hfy-face-to-css
  521. @anchor{hfy-face-to-css}
  522. @lisp
  523. (hfy-face-to-css @var{fn})
  524. @end lisp
  525. Take @var{fn}, a font or @code{defface} specification (c.f.
  526. @code{face-attr-construct}) and return a CSS style specification.
  527. See also: @ref{hfy-face-to-style}
  528. @item hfy-html-quote
  529. @findex hfy-html-quote
  530. @anchor{hfy-html-quote}
  531. @lisp
  532. (hfy-html-quote @var{char-string})
  533. @end lisp
  534. Map a string (usually 1 character long) to an html safe string
  535. (entity) if need be.
  536. @item hfy-link-style
  537. @findex hfy-link-style
  538. @anchor{hfy-link-style}
  539. @lisp
  540. (hfy-link-style @var{style-string})
  541. @end lisp
  542. Convert the CSS style spec @var{style-string} to its equivalent
  543. hyperlink style.
  544. See: @ref{hfy-link-style-fun}.
  545. @item hfy-p-to-face
  546. @findex hfy-p-to-face
  547. @anchor{hfy-p-to-face}
  548. @lisp
  549. (hfy-p-to-face @var{props})
  550. @end lisp
  551. Given @var{props}, a list of text-properties, return the value of the
  552. face property, or @code{nil}.
  553. @item hfy-box-to-border-assoc
  554. @findex hfy-box-to-border-assoc
  555. @anchor{hfy-box-to-border-assoc}
  556. @lisp
  557. (hfy-box-to-border-assoc @var{spec})
  558. @end lisp
  559. Helper function for @ref{hfy-box-to-style}.
  560. @item hfy-face-attr-for-class
  561. @findex hfy-face-attr-for-class
  562. @anchor{hfy-face-attr-for-class}
  563. @lisp
  564. (hfy-face-attr-for-class @var{face} &optional @var{class})
  565. @end lisp
  566. Return the face attributes for @var{face}. If @var{class} is set, it
  567. must be a @code{defface} alist key [see below]. Prior to version 0.18,
  568. the first face specification returned by @ref{hfy-combined-face-spec}
  569. which @emph{didn't} clash with @var{class} was returned. In versions
  570. from 0.18 onwards, each font attribute list is scored, and the
  571. non-conflicting list with the highest score is returned. (A specification
  572. with a class of @code{t} is considered to match any class you specify.
  573. This matches Emacs's behavior when deciding on which face attributes to
  574. use, to the best of my understanding ).
  575. If @var{class} is @code{nil}, then you just get get whatever
  576. @code{face-attr-construct} returns; i.e., the current specification in
  577. effect for @var{face}.
  578. See @ref{hfy-display-class} for details of valid values for @var{class}.
  579. @item hfy-face-at
  580. @findex hfy-face-at
  581. @anchor{hfy-face-at}
  582. @lisp
  583. (hfy-face-at P)
  584. @end lisp
  585. Find face in effect at point P@. If overlays are to be considered
  586. (see @ref{hfy-optimizations}) then this may return a @code{defface} style
  587. list of face properties instead of a face symbol.
  588. @item hfy-bgcol
  589. @findex hfy-bgcol
  590. @anchor{hfy-bgcol}
  591. @lisp
  592. (hfy-bgcol @var{color})
  593. @end lisp
  594. As per @ref{hfy-color} but for background colors.
  595. @item hfy-kludge-cperl-mode
  596. @findex hfy-kludge-cperl-mode
  597. @anchor{hfy-kludge-cperl-mode}
  598. @lisp
  599. (hfy-kludge-cperl-mode)
  600. @end lisp
  601. cperl mode does its best to not do some of its fontification when not
  602. in a windowing system---we try to trick it@dots{}
  603. @item hfy-href
  604. @findex hfy-href
  605. @anchor{hfy-href}
  606. @lisp
  607. (hfy-href @var{this-file} @var{def-files} @var{tag} @var{tag-map})
  608. @end lisp
  609. Return a relative href to the tag in question, based on
  610. @var{this-file} @ref{hfy-link-extn} @ref{hfy-extn} @var{def-files} @var{tag} and @var{tag-map}
  611. @var{this-file} is the current source file
  612. @var{def-files} is a list of file containing possible link endpoints for @var{tag}
  613. @var{tag} is the @var{tag} in question
  614. @var{tag-map} is the entry in @ref{hfy-tags-cache}.
  615. @item hfy-shell
  616. @findex hfy-shell
  617. @anchor{hfy-shell}
  618. @lisp
  619. (hfy-shell)
  620. @end lisp
  621. Returns a best guess at a Bourne compatible shell to use: If the current
  622. shell doesn't look promising, fall back to @ref{hfy-shell-file-name}.
  623. @item hfy-load-tags-cache
  624. @findex hfy-load-tags-cache
  625. @anchor{hfy-load-tags-cache}
  626. @lisp
  627. (hfy-load-tags-cache @var{srcdir})
  628. @end lisp
  629. Run @ref{hfy-etags-cmd} on @var{srcdir}: load @ref{hfy-tags-cache} and @ref{hfy-tags-sortl}.
  630. @item hfy-parse-tags-buffer
  631. @findex hfy-parse-tags-buffer
  632. @anchor{hfy-parse-tags-buffer}
  633. @lisp
  634. (hfy-parse-tags-buffer @var{srcdir} @var{buffer})
  635. @end lisp
  636. Parse a @var{buffer} containing etags formatted output, loading the
  637. @ref{hfy-tags-cache} and @ref{hfy-tags-sortl} entries for @var{srcdir}.
  638. @item hfy-interq
  639. @findex hfy-interq
  640. @anchor{hfy-interq}
  641. @lisp
  642. (hfy-interq @var{set-a} @var{set-b})
  643. @end lisp
  644. Return the intersection (using @code{eq}) of 2 lists.
  645. @item hfy-text-p
  646. @findex hfy-text-p
  647. @anchor{hfy-text-p}
  648. @lisp
  649. (hfy-text-p @var{srcdir} @var{file})
  650. @end lisp
  651. Is @var{srcdir}/@var{file} text? Uses @ref{hfy-istext-command} to determine this.
  652. @item hfy-opt
  653. @findex hfy-opt
  654. @anchor{hfy-opt}
  655. @lisp
  656. (hfy-opt @var{symbol})
  657. @end lisp
  658. Is @ref{hfy-optimizations} member @var{symbol} set or not?
  659. @item hfy-dirname
  660. @findex hfy-dirname
  661. @anchor{hfy-dirname}
  662. @lisp
  663. (hfy-dirname @var{file})
  664. @end lisp
  665. Return everything preceding the last @samp{/} from a relative filename,
  666. on the assumption that this will produce a relative directory name. Hardly
  667. bombproof, but good enough in the context in which it is being used.
  668. @item hfy-html-dekludge-buffer
  669. @findex hfy-html-dekludge-buffer
  670. @anchor{hfy-html-dekludge-buffer}
  671. @lisp
  672. (hfy-html-dekludge-buffer)
  673. @end lisp
  674. Transform all dangerous characters marked with the @code{hfy-quoteme} property
  675. using @ref{hfy-html-quote}
  676. See also @ref{hfy-html-enkludge-buffer}.
  677. @item hfy-copy-and-fontify-file
  678. @findex hfy-copy-and-fontify-file
  679. @anchor{hfy-copy-and-fontify-file}
  680. @lisp
  681. (hfy-copy-and-fontify-file @var{srcdir} @var{dstdir} @var{file})
  682. @end lisp
  683. Open @var{file} in @var{srcdir}---if fontified, write a fontified copy to @var{dstdir}
  684. adding an extension of @ref{hfy-extn}. Fontification is actually done by
  685. @ref{htmlfontify-buffer}. If the buffer is not fontified, just copy it.
  686. @item hfy-decor
  687. @findex hfy-decor
  688. @anchor{hfy-decor}
  689. @lisp
  690. (hfy-decor @var{tag} @var{val})
  691. @end lisp
  692. Derive CSS text-decoration specifiers from various Emacs font attributes.
  693. @item hfy-slant
  694. @findex hfy-slant
  695. @anchor{hfy-slant}
  696. @lisp
  697. (hfy-slant @var{slant})
  698. @end lisp
  699. Derive a font-style CSS specifier from the Emacs :slant
  700. attribute---CSS does not define the reverse-* styles, so just maps
  701. those to the regular specifiers.
  702. @item hfy-tags-for-file
  703. @findex hfy-tags-for-file
  704. @anchor{hfy-tags-for-file}
  705. @lisp
  706. (hfy-tags-for-file @var{srcdir} @var{file})
  707. @end lisp
  708. List of etags tags that have definitions in this @var{file}. Looks up
  709. the tags cache in @ref{hfy-tags-cache} using @var{srcdir} as the key.
  710. @item hfy-width
  711. @findex hfy-width
  712. @anchor{hfy-width}
  713. @lisp
  714. (hfy-width @var{width})
  715. @end lisp
  716. Convert an Emacs @code{:width} attribute to a CSS font-stretch attribute.
  717. @comment /AUTOGENERATED BLOCK
  718. @end table
  719. @node Variables
  720. @section Variables
  721. @cindex variables
  722. Important variables that are not customization items:
  723. @table @code
  724. @item hfy-tags-cache
  725. @vindex hfy-tags-cache
  726. @anchor{hfy-tags-cache}
  727. This is an alist of the form:
  728. @example
  729. (("/src/dir/0" . tag-hash0) ("/src/dir/1" tag-hash1) @dots{} )
  730. @end example
  731. Each tag hash entry then contains entries of the form:
  732. @example
  733. "tag_string" => (("file/name.ext" line char) @dots{} )
  734. @end example
  735. i.e., an alist mapping (relative) file paths to line and character offsets.
  736. See @ref{hfy-load-tags-cache}.
  737. @item hfy-tags-rmap
  738. @vindex hfy-tags-rmap
  739. @anchor{hfy-tags-rmap}
  740. @code{hfy-tags-rmap} is an alist of the form:
  741. @lisp
  742. (("/src/dir" . tag-rmap-hash))
  743. @end lisp
  744. Where tag-rmap-hash has entries of the form:
  745. @example
  746. "tag_string" => ( "file/name.ext" line char )
  747. @end example
  748. Unlike @ref{hfy-tags-cache} these are the locations of occurrences of
  749. tagged items, not the locations of their definitions.
  750. @item hfy-tags-sortl
  751. @vindex hfy-tags-sortl
  752. @anchor{hfy-tags-sortl}
  753. @code{hfy-tags-sortl} is an alist of the form:
  754. @example
  755. (("/src/dir" . (tag0 tag1 tag2)) @dots{} )
  756. @end example
  757. Where the tags are stored in descending order of length.
  758. See: @ref{hfy-load-tags-cache}.
  759. @end table
  760. @node Data Structures
  761. @section Data Structures
  762. @cindex Data Structures
  763. Some of the (informal) data structures used in Htmlfontify are detailed here:
  764. @table @code
  765. @item hfy-style-assoc
  766. @cindex hfy-style-assoc
  767. @anchor{hfy-style-assoc}
  768. An assoc representing/describing an Emacs face. Properties may be repeated,
  769. in which case later properties should be treated as if they were inherited
  770. from a ``parent'' font. (For some properties, only the first encountered value
  771. is of any importance, for others the values might be cumulative, and for
  772. others they might be cumulative in a complex way.)
  773. Some examples:
  774. @lisp
  775. (hfy-face-to-style 'default) =>
  776. (("background" . "rgb(0, 0, 0)" )
  777. ("color" . "rgb(255, 255, 255)")
  778. ("font-style" . "normal" )
  779. ("font-weight" . "500" )
  780. ("font-stretch" . "normal" )
  781. ("font-family" . "misc-fixed" )
  782. ("font-size" . "13pt" )
  783. ("text-decoration" . "none" ))
  784. (hfy-face-to-style 'Info-title-3-face) =>
  785. (("font-weight" . "700" )
  786. ("font-family" . "helv" )
  787. ("font-size" . "120%" )
  788. ("text-decoration" . "none") )
  789. @end lisp
  790. @item hfy-sheet-assoc
  791. @cindex hfy-sheet-assoc
  792. @anchor{hfy-sheet-assoc}
  793. An assoc with elements of the form @samp{(face-name style-name . style-string)}.
  794. The actual stylesheet for each page is derived from one of these.
  795. @lisp
  796. ((default "default" . "@{ background: black; color: white@}")
  797. (font-lock-string-face "string" . "@{ color: rgb(64,224,208) @}"))
  798. @end lisp
  799. @item hfy-facemap-assoc
  800. @cindex hfy-facemap-assoc
  801. @anchor{hfy-facemap-assoc}
  802. An assoc of @code{(point . @var{face-symbol})} or
  803. @code{(point . @code{defface} attribute list)} and @code{(point
  804. . end)} elements, in descending order of point value (i.e., from the
  805. file's end to its beginning). The map is in reverse order because
  806. inserting a @samp{<style>} tag (or any other string) at @var{point}
  807. invalidates the map for all entries with a greater value of point. By
  808. traversing the map from greatest to least @var{point}, we still
  809. invalidate the map as we go, but only those points we have already
  810. dealt with (and therefore no longer care about) will be invalid at any
  811. time.
  812. @lisp
  813. ((64820 . end)
  814. (64744 . font-lock-comment-face)
  815. (64736 . end)
  816. (64722 . font-lock-string-face)
  817. (64630 . end)
  818. (64623 . font-lock-string-face)
  819. (64449 . end)
  820. ;; Big similar section elided. You get the idea.
  821. (5459 . end)
  822. (5431 . (:inherit font-lock-keyword-face :background "7e7e7e"))
  823. (5431 . end)
  824. (4285 . font-lock-constant-face)
  825. (4285 . end)
  826. (4221 . font-lock-comment-face)
  827. (4221 . end)
  828. (4197 . font-lock-constant-face)
  829. (4197 . end)
  830. (1 . font-lock-comment-face))
  831. @end lisp
  832. @end table
  833. @node Examples
  834. @section Examples
  835. @cindex Examples
  836. The following is a lump of code I use to fontify source code on my
  837. site, @url{http://rtfm.etla.org/} (which was the reason, incidentally,
  838. that Htmlfontify was written in the first place).
  839. @lisp
  840. (defvar rtfm-section nil)
  841. ;; Constructs an appropriate header string to fit in with rtfm's
  842. ;; templating system, based on the file and the stylesheet string
  843. (defun rtfm-build-page-header (file style)
  844. (format "#define TEMPLATE red+black.html
  845. #define DEBUG 1
  846. #include <build/menu-dirlist|>\n
  847. html-css-url := /css/red+black.css
  848. title := rtfm.etla.org ( %s / src/%s )
  849. bodytag :=
  850. head <=STYLESHEET;\n
  851. %s
  852. STYLESHEET
  853. main-title := rtfm / %s / src/%s\n
  854. main-content <=MAIN_CONTENT;\n" rtfm-section file style rtfm-section file))
  855. ;; the footer:
  856. (defun rtfm-build-page-footer (file) "\nMAIN_CONTENT\n")
  857. (defun rtfm-fontify-buffer (section)
  858. (interactive "s section[eg- emacs / p4-blame]: ")
  859. (require 'htmlfontify)
  860. (let ((hfy-page-header 'rtfm-build-page-header)
  861. (hfy-page-footer 'rtfm-build-page-footer)
  862. (rtfm-section section))
  863. (htmlfontify-buffer)
  864. )
  865. )
  866. ;; Here's the function I actually call---it asks me for a section label,
  867. ;; and source and destination directories, and then binds a couple of
  868. ;; customization variable in a let before calling htmlfontify:
  869. (defun rtfm-build-source-docs (section srcdir destdir)
  870. (interactive
  871. "s section[eg- emacs / p4-blame]:\nD source-dir: \nD output-dir: ")
  872. (require 'htmlfontify)
  873. (hfy-load-tags-cache srcdir)
  874. (let ((hfy-page-header 'rtfm-build-page-header)
  875. (hfy-page-footer 'rtfm-build-page-footer)
  876. (rtfm-section section)
  877. (hfy-index-file "index")
  878. (auto-mode-alist (append auto-mode-alist
  879. '(("dbi\\(shell\\|gtk\\)$" . cperl-mode)
  880. ("\\.xpm$" . c-mode ))))
  881. )
  882. (htmlfontify-run-etags srcdir)
  883. (htmlfontify-copy-and-link-dir srcdir destdir ".src" ".html")))
  884. @end lisp
  885. @node Customization
  886. @chapter Customization
  887. @cindex variables (customization)
  888. Htmlfontify provides the following variable and customization entries:
  889. @table @code
  890. @comment AUTOGENERATED BLOCK
  891. @item hfy-link-style-fun
  892. @vindex hfy-link-style-fun
  893. @anchor{hfy-link-style-fun}
  894. Set this to a function, which will be called with one argument
  895. (a @samp{@{ foo: bar; @dots{}@}} CSS style-string)---it should return a copy of
  896. its argument, altered so as to make any changes you want made for text which
  897. is a hyperlink, in addition to being in the class to which that style would
  898. normally be applied.
  899. @item hfy-html-quote-regex
  900. @vindex hfy-html-quote-regex
  901. @anchor{hfy-html-quote-regex}
  902. @c FIXME: the cross-reference below looks ugly
  903. Regex to match (with a single back-reference per match) strings in HTML
  904. which should be quoted with @ref{hfy-html-quote}
  905. (and @pxref{hfy-html-quote-map}) to make them safe.
  906. @item hfy-page-footer
  907. @vindex hfy-page-footer
  908. @anchor{hfy-page-footer}
  909. As @ref{hfy-page-header}, but generates the output footer
  910. (and takes only 1 argument, the filename).
  911. @item hfy-display-class
  912. @vindex hfy-display-class
  913. @anchor{hfy-display-class}
  914. Display class to use to determine which display class to use when
  915. calculating a face's attributes. This is useful when, for example, you
  916. are running Emacs on a tty or in batch mode, and want Htmlfontify to have
  917. access to the face spec you would use if you were connected to an X display.
  918. Some valid class specification elements are:
  919. @lisp
  920. (class color)
  921. (class grayscale)
  922. (background dark)
  923. (background light)
  924. (type x-toolkit)
  925. (type tty)
  926. (type motif)
  927. (type lucid)
  928. @end lisp
  929. Multiple values for a tag may be combined, to indicate that any one or more
  930. of these values in the specification key constitutes a match. For
  931. example, @code{((class color grayscale) (type tty))} would match any of:
  932. @lisp
  933. ((class color))
  934. ((class grayscale))
  935. ((class color grayscale)))
  936. ((class color foo))
  937. ((type tty))
  938. ((type tty) (class color))
  939. @end lisp
  940. @item hfy-page-header
  941. @vindex hfy-page-header
  942. @anchor{hfy-page-header}
  943. Function called with two arguments (the filename relative to the top
  944. level source directory being etagged and fontified), and a string containing
  945. the @samp{<style>@dots{}</style>} text to embed in the document---the string
  946. returned will be used as the header for the htmlfontified version of
  947. the source file.
  948. See also: @ref{hfy-page-footer}
  949. @item hfy-src-doc-link-style
  950. @vindex hfy-src-doc-link-style
  951. @anchor{hfy-src-doc-link-style}
  952. String to add to the @samp{<style> a} variant of an Htmlfontify CSS class.
  953. @item hfy-split-index
  954. @vindex hfy-split-index
  955. @anchor{hfy-split-index}
  956. Whether or not to split the index @ref{hfy-index-file} alphabetically
  957. on the first letter of each tag. Useful when the index would otherwise
  958. be large and take a long time to render or be difficult to navigate.
  959. @item hfy-find-cmd
  960. @vindex hfy-find-cmd
  961. @anchor{hfy-find-cmd}
  962. The ``find'' command used to harvest a list of files to attempt to fontify.
  963. @item hfy-extn
  964. @vindex hfy-extn
  965. @anchor{hfy-extn}
  966. File extension used for output files.
  967. @item hfy-default-face-def
  968. @vindex hfy-default-face-def
  969. @anchor{hfy-default-face-def}
  970. Fallback @code{defface} specification for the face @code{default}, used
  971. when @ref{hfy-display-class} has been set (the normal Htmlfontify way of
  972. extracting potentially non-current face information doesn't necessarily
  973. work for @code{default}).
  974. For example, I customize this to:
  975. @lisp
  976. ((t :background "black" :foreground "white" :family "misc-fixed"))
  977. @end lisp
  978. @item hfy-init-kludge-hooks
  979. @vindex hfy-init-kludge-hooks
  980. @anchor{hfy-init-kludge-hooks}
  981. List of functions to call when starting htmlfontify-buffer to do any
  982. kludging necessary to get highlighting modes to behave as you want, even
  983. when not running under a window system.
  984. @item hfy-shell-file-name
  985. @vindex hfy-shell-file-name
  986. @anchor{hfy-shell-file-name}
  987. Should be set to a Bourne compatible shell, which will be invoked
  988. for the more complex shell interactions needed by Htmlfontify.
  989. Currently this is only required/used when using GNU etags, see
  990. @ref{hfy-etags-cmd-alist} for details.
  991. @item hfy-optimizations
  992. @vindex hfy-optimizations
  993. @anchor{hfy-optimizations}
  994. Optimizations to turn on. So far, the following have been implemented:
  995. @table @option
  996. @item merge-adjacent-tags
  997. If two (or more) span tags are adjacent, identical and separated by nothing
  998. more than whitespace, they will be merged into one span.
  999. @item zap-comment-links
  1000. Suppress hyperlinking of tags found in comments.
  1001. @item zap-string-links
  1002. Suppress hyperlinking of tags found in strings.
  1003. @item div-wrapper
  1004. Add @samp{<div class="default"> </div>} tags around the fontified body.
  1005. (Some people like this because they cut and paste the html into
  1006. a page with different colors than the fontified code.)
  1007. @item keep-overlays
  1008. Preserve overlay highlighting (cf.@: @code{ediff} or @code{goo-font-lock})
  1009. as well as basic faces. Can result in extremely verbose highlighting
  1010. if there are many overlays (as is the case with @code{goo-font-lock}).
  1011. @end table
  1012. And the following are planned but not yet available:
  1013. @table @option
  1014. @item kill-context-leak
  1015. Suppress hyperlinking between files highlighted by different modes.
  1016. @end table
  1017. Note: like compiler optimizations, these optimize the @emph{output} of
  1018. the code,
  1019. not the processing of the source itself, and are therefore likely to slow
  1020. Htmlfontify down, at least a little. Except for skip-refontification,
  1021. which can never slow you down, but may result in incomplete fontification.
  1022. @item hfy-src-doc-link-unstyle
  1023. @vindex hfy-src-doc-link-unstyle
  1024. @anchor{hfy-src-doc-link-unstyle}
  1025. Regex to remove from the @samp{<style> a} variant of an Htmlfontify CSS class.
  1026. @item hfy-link-extn
  1027. @vindex hfy-link-extn
  1028. @anchor{hfy-link-extn}
  1029. File extension used for href links---useful where the Htmlfontify
  1030. output files are going to be processed again, with a resulting change
  1031. in file extension. If @code{nil}, then any code using this should fall back
  1032. to @ref{hfy-extn}.
  1033. @item hfy-istext-command
  1034. @vindex hfy-istext-command
  1035. @anchor{hfy-istext-command}
  1036. Command to run with the name of a file, to see whether it is a text file
  1037. or not. The command should emit a string containing the word @samp{text} if
  1038. the file is a text file, and a string not containing @samp{text} otherwise.
  1039. @item hfy-etags-cmd-alist
  1040. @vindex hfy-etags-cmd-alist
  1041. @anchor{hfy-etags-cmd-alist}
  1042. An alist of possible shell commands that will generate etags output that
  1043. Htmlfontify can use. @samp{%s} will be replaced by @ref{hfy-etags-bin}.
  1044. @item hfy-etags-bin
  1045. @vindex hfy-etags-bin
  1046. @anchor{hfy-etags-bin}
  1047. The location of the etags binary (we begin by assuming it's in your path).
  1048. Note that if etags is not in your path, you will need to alter the shell
  1049. commands in @ref{hfy-etags-cmd-alist}.
  1050. [As of version 0.17, this requirement has been removed: it should
  1051. all just work(tm).]
  1052. @item hfy-etags-cmd
  1053. @vindex hfy-etags-cmd
  1054. @anchor{hfy-etags-cmd}
  1055. An etags shell command to run in the source directory to generate a tags
  1056. file for the whole source tree from there on down. The command should emit
  1057. the etags output on standard output.
  1058. Two canned commands are provided---they drive Emacs's etags and
  1059. exuberant-ctags's etags respectively.
  1060. @item hfy-etag-regex
  1061. @vindex hfy-etag-regex
  1062. @anchor{hfy-etag-regex}
  1063. Regex used to parse an etags entry: must have 3 subexps, corresponding,
  1064. in order, to:
  1065. @enumerate
  1066. @item
  1067. The tag
  1068. @item
  1069. The line
  1070. @item
  1071. The character (point) at which the tag occurs
  1072. @end enumerate
  1073. @item hfy-index-file
  1074. @vindex hfy-index-file
  1075. @anchor{hfy-index-file}
  1076. Name (sans extension) of the index file produced during
  1077. fontification-and-hyperlinking.
  1078. @item hfy-instance-file
  1079. @vindex hfy-instance-file
  1080. @anchor{hfy-instance-file}
  1081. Name (sans extension) of the tag usage index file produced during
  1082. fontification-and-hyperlinking.
  1083. @item hfy-html-quote-map
  1084. @vindex hfy-html-quote-map
  1085. @anchor{hfy-html-quote-map}
  1086. An alist of character -> entity mappings used to make the text html-safe.
  1087. @comment /AUTOGENERATED BLOCK
  1088. @end table
  1089. @node Requirements
  1090. @chapter Requirements
  1091. @cindex Requirements, Prerequisites
  1092. Htmlfontify has a couple of external requirements:
  1093. @itemize @bullet
  1094. @item
  1095. GNU Emacs 20.7+ or 21.1+
  1096. Other versions may work---these have been used successfully by the
  1097. author. If you intend to use Htmlfontify in batch mode, 21.1+ is
  1098. pretty much required. The author does not know if XEmacs, NTemacs,
  1099. or J.Random Emacs will run Htmlfontify, but reports/patches/bags of
  1100. money are always welcome.
  1101. @item
  1102. A copy of etags (exuberant-ctags or GNU etags). Htmlfontify attempts
  1103. to autodetect the version you have and customize itself accordingly,
  1104. but you should be able to override this.
  1105. See: @ref{Customization}
  1106. @item
  1107. A copy of find (e.g., GNU find) that provides the @code{-path} predicate.
  1108. You may be able to work around this with a suitable clever shell
  1109. command and the customization entry: @ref{hfy-find-cmd}
  1110. @item
  1111. A copy of sed (e.g., GNU sed).
  1112. @item
  1113. A copy of the @code{file} command.
  1114. @end itemize
  1115. @node GNU Free Documentation License
  1116. @appendix GNU Free Documentation License
  1117. @include doclicense.texi
  1118. @node Index
  1119. @unnumbered Index
  1120. @table @var
  1121. @item Concepts
  1122. @printindex cp
  1123. @item Functions
  1124. @printindex fn
  1125. @item Variables & Customization
  1126. @printindex vr
  1127. @end table
  1128. @setchapternewpage odd
  1129. @bye
  1130. @c Local Variables:
  1131. @c coding: utf-8
  1132. @c End: