gsdoc.el 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. ;; gsdoc.el
  2. ;;
  3. ;; GNU emacs (19.34) functions to help working with the HTML form of
  4. ;; Ghostscript documentation.
  5. ;;
  6. ;; Pete Kaiser 8 September 1998 V1.2
  7. ;; 2 December 1999 V1.3 Correct improper "--" to "=="
  8. ;; in HTML marker comments
  9. ;;============================================================
  10. ;; One global key setting, which runs the function to bind some keys
  11. ;; locally -- presumably in a buffer containing HTML code. Plus that
  12. ;; function itself.
  13. (global-set-key [?\C-\S-k] 'gskeys)
  14. (defun gskeys ()
  15. "Set the keys in this buffer to use with Ghostscript HTML docs."
  16. (interactive)
  17. (local-set-key [?\C-\S-b] 'gs-bold)
  18. (local-set-key [?\C-\S-c] 'gs-code)
  19. (local-set-key [?\C-\S-e] 'gs-emphatic)
  20. (local-set-key [?\C-\S-g] 'gs-get-anchor)
  21. (local-set-key [?\C-\S-h] 'gs-href)
  22. (local-set-key [?\C-\S-i] 'gs-italic)
  23. (local-set-key [?\C-\S-m] 'gs-mailto)
  24. (local-set-key [?\C-\S-n] 'gs-name)
  25. (local-set-key [?\C-\S-p] 'gs-put-anchor)
  26. (local-set-key [?\C-\S-q] 'gs-quote)
  27. (local-set-key [?\C-\S-r] 'gs-row-of-table)
  28. (local-set-key [?\C-\S-s] 'gs-selfref)
  29. (local-set-key [?\C-\S-t] 'gs-table)
  30. (local-set-key [?\C-\S-u] 'gs-tag)
  31. (local-set-key [?\C-\S-x] 'gs-example)
  32. )
  33. ;;============================================================
  34. ;; Each of these next few functions just wraps a region in a
  35. ;; <TAG>...</TAG>, or two nested tags. Where there are two, the first one
  36. ;; is inner. See the inner function ~gsregion.
  37. (defun gs-bold () "Make text strong (bold)."
  38. (interactive)
  39. (~gsregion "b"))
  40. (defun gs-code () "Make text strong code (bold TT)."
  41. (interactive)
  42. (~gsregion "tt")
  43. (~gsregion "b"))
  44. (defun gs-emphatic () "Make text emphatic (bold italic)."
  45. (interactive)
  46. (~gsregion "em")
  47. (~gsregion "b"))
  48. (defun gs-italic () "Make text italic."
  49. (interactive)
  50. (~gsregion "em"))
  51. ;;============================================================
  52. (defun gs-quote ()
  53. "Indent a region with BLOCKQUOTE and separate it with empty lines from
  54. surrounding text."
  55. (interactive)
  56. (save-restriction (narrow-to-region (region-beginning) (region-end))
  57. (goto-char (point-min)) (insert "\n\n")
  58. (push-mark (1+ (point-min)) t)
  59. (goto-char (point-max))
  60. (~gsregion "blockquote")
  61. (insert "\n\n")
  62. )
  63. )
  64. ;;============================================================
  65. (defun gs-example ()
  66. "Make an indented literatim example BLOCKQUOTE PRE and separate it with
  67. empty lines from surrounding text."
  68. (interactive)
  69. (save-restriction (narrow-to-region (region-beginning) (region-end))
  70. (goto-char (point-min)) (insert "\n")
  71. (push-mark (point-min) t)
  72. (goto-char (point-max))
  73. (~gsregion "pre")
  74. (~gsregion "blockquote")
  75. (insert "\n")
  76. )
  77. )
  78. ;;============================================================
  79. (defun gs-get-anchor ()
  80. "Beginning at the head of this line, pick up the next anchor name for later
  81. use along with its HTML file name. This is useful when picking up an
  82. anchor name from a file in one buffer and using it in another buffer
  83. containing a different file."
  84. (interactive)
  85. ;; From the beginning of this line find and pick up the next non-empty
  86. ;; anchor, which might, of course not be right here -- though that's how it
  87. ;; ought to be used, to pick up an anchor for immediate use. The regular
  88. ;; expression picks up only the name itself.
  89. (beginning-of-line)
  90. (re-search-forward "<a name=\"?\\([^\">]+\\)\"?></a>" nil t)
  91. (setq gs-anchor (buffer-substring (match-beginning 1) (match-end 1)))
  92. ;; Get the name of this buffer, treating it as the filename.
  93. (setq gs-anchor-file (buffer-name))
  94. )
  95. ;;============================================================
  96. (defun gs-href ()
  97. "Wrap a region in an empty link and leave point in the middle of the
  98. emptiness to write the link. Maybe some day read the URL and put it
  99. there."
  100. (interactive)
  101. (save-restriction
  102. (narrow-to-region (region-beginning) (region-end))
  103. (goto-char (point-min)) (insert "<a href=\"#\">")
  104. (setq HREF (- (point) 2))
  105. (goto-char (point-max)) (insert "</a>")
  106. (goto-char HREF)
  107. )
  108. )
  109. ;;============================================================
  110. (defun gs-mailto ()
  111. "Turn an address into a proper \"mailto:\" visually bracketed with <>."
  112. (interactive)
  113. (save-restriction
  114. (narrow-to-region (region-beginning) (region-end))
  115. (setq gs-address (buffer-substring (point-min) (point-max)))
  116. (goto-char (point-min)) (insert "&lt;<a href=\"mailto:")
  117. (goto-char (point-max)) (insert "\">" gs-address "</a>&gt;")
  118. )
  119. )
  120. ;;============================================================
  121. (defun gs-tag (Tag)
  122. "Bracket a region with some arbitrary tag read from the minibuffer, leaving
  123. point right after the opening word of the opening tag, and the end of the
  124. region at the end of the closing tag. Leaving point there makes it
  125. possible, for instance, to enter additional matter in a <FONT> tag. Get to
  126. the end of a region with ^x-^x."
  127. (interactive "*sTag: ")
  128. (~gsregion Tag)
  129. (exchange-point-and-mark) (forward-word 1)
  130. )
  131. ;;============================================================
  132. (defun gs-toc ()
  133. "[Re]build the table of contents by picking up all the <Hn> lines and
  134. converting them to properly indented <UL> entries, placing the TOC within
  135. the standard TOC markers. Note that several of the original Ghostscript
  136. HTML files have hand-modified TOCs, so it's wise to check before running
  137. this function. It can be run from anywhere within the HTML file.
  138. This function relies on the specific format of the structure comments for
  139. the table of contents, which are set by the g~marker function used in
  140. defvars run when this package is loaded."
  141. (interactive)
  142. (setq g~html-buffer (buffer-name))
  143. (save-restriction (save-excursion
  144. (widen)
  145. ;; Since we're building the TOC, delete any current TOC. Locate the place
  146. ;; for the TOC using the standard markers, deleting everything between the
  147. ;; TOC-beginning and TOC-end markers. The new TOC is built entirely in the
  148. ;; work buffer before being copied into the HTML buffer at that point.
  149. (goto-char (point-min))
  150. (search-forward g~toc-begin nil t)
  151. (next-line 1) (beginning-of-line) (setq g~toc-insert (point))
  152. (search-forward g~toc-end nil t)
  153. (beginning-of-line) (delete-region g~toc-insert (point))
  154. ;; Empty the work buffer by copying nothing into it.
  155. (copy-to-buffer gs-work-buffer 1 1)
  156. ;; Now collect all the following header lines into a buffer to work on
  157. ;; them. The later append-to-buffer needs point to be in the middle of the
  158. ;; empty list, so go there before entering the work buffer.
  159. (save-excursion (while (re-search-forward "^<h[1-6][^>]*>" nil t)
  160. (beginning-of-line) (setq BOH (point))
  161. (re-search-forward "</h[1-6]>\n" nil t)
  162. (append-to-buffer gs-work-buffer BOH (point))
  163. ))
  164. (goto-char g~toc-insert)
  165. ;; All the useful header lines should be in the work buffer now.
  166. (save-excursion
  167. (set-buffer gs-work-buffer)
  168. ;; Formatting as list entries: insert <ul> when the level deepens and </ul>
  169. ;; when it rises.
  170. (goto-char (point-min))
  171. (while (search-forward "</a>" nil t) (replace-match ""))
  172. (goto-char (point-min))
  173. (while (re-search-forward "</h[1-6]>" nil t) (replace-match "</a>"))
  174. (goto-char (point-min))
  175. (while (re-search-forward "<a name=\"" nil t) (replace-match "<a href=\"#"))
  176. ;; Change <h[1-6]> to <li>, inserting <ul>...</ul> as needed. Pick up the
  177. ;; upmost level from the first header, usually <h1>, and save a copy to
  178. ;; use to insert any terminating </ul>.
  179. (goto-char (point-min))
  180. (re-search-forward "^<h\\([1-6]\\)[^>]*>" nil t)
  181. (setq First (string-to-number
  182. (buffer-substring (match-beginning 1) (match-end 1))))
  183. (setq Previous First)
  184. (replace-match "<li>" t t)
  185. ;; Got the first one, now handle the rest.
  186. (while (re-search-forward "^<h\\([1-6]\\)[^>]*>" nil t)
  187. (setq This (string-to-number
  188. (buffer-substring (match-beginning 1) (match-end 1))))
  189. (setq Hold This)
  190. (replace-match "<li>" t t) (beginning-of-line)
  191. ;; No point being too fancy with conditionals: the "while" statements here
  192. ;; make at most one logically unnecessary test.
  193. (while (> This Previous) (insert "<ul>\n") (setq This (1- This)))
  194. (while (< This Previous) (insert "</ul>\n") (setq This (1+ This)))
  195. (setq Previous Hold)
  196. )
  197. ;; Done with the loop. Clean up by inserting at the end any </ul> needed
  198. ;; to get back to the top level.
  199. (goto-char (point-max))
  200. (while (> Previous First) (insert "</ul>\n") (setq Previous (1- Previous)))
  201. ;; Finally add the trailing whitespace and leading whitespace and header line.
  202. (insert "</ul></blockquote>\n\n")
  203. (goto-char (point-min))
  204. (insert "\n<h2>Table of contents</h2>\n\n<blockquote><ul>\n")
  205. ;; The TOC is now entirely built in the work buffer. Move it to where it's
  206. ;; supposed to be in the original buffer.
  207. (append-to-buffer g~html-buffer (point-min) (point-max))
  208. )
  209. ))
  210. )
  211. ;;============================================================
  212. (defun gs-name ()
  213. "Insert a name anchor at point and leave point ready to enter the anchor's
  214. name. Anchors are always empty (that is, <a name=...></a>)."
  215. (interactive)
  216. (insert "<a name=\"\"></a>")
  217. (backward-char 6)
  218. )
  219. ;;============================================================
  220. (defun gs-put-anchor ()
  221. "Insert around the current region the last anchor picked up with
  222. gs-get-anchor. This includes the HTML file name if the href is put in a
  223. file other than the anchor."
  224. (interactive)
  225. (save-restriction
  226. (narrow-to-region (region-beginning) (region-end))
  227. (goto-char (point-min))
  228. (insert (concat
  229. "<a href=\""
  230. ;; Insert the filename (buffer name) picked up by gs-get-anchor only if
  231. ;; this is a different buffer.
  232. (if (string-equal gs-anchor-file (buffer-name)) "" gs-anchor-file)
  233. ;; And finish unconditionally with the specific anchor name.
  234. "#" gs-anchor "\">"))
  235. (goto-char (point-max)) (insert "</a>"))
  236. )
  237. ;;============================================================
  238. (defun gs-row-of-table ()
  239. "Set up a row of a table from the line containing point.
  240. Insert the right things at beginning and end, and in between convert tab
  241. and \"|\" into column breaks with a nonbreaking space in between -- which
  242. means that no entry can contain a tab or \"|\". Format the HTML nicely
  243. for readability.
  244. Between each two substantive columns this function puts a column containing
  245. a single nonbreaking space to provide a visual break. Generally in the
  246. first row of a table those columns should be given enough NBSPs to make
  247. the table look right on screen and when converted to text, but this has to
  248. be done by hand."
  249. (interactive)
  250. (save-restriction
  251. (end-of-line) (setq EOL (point))
  252. (beginning-of-line) (narrow-to-region (point) EOL)
  253. (insert "<tr valign=top>\t<td>")
  254. (while (re-search-forward "[|\t]" nil t)
  255. (replace-match "\n\t<td>&nbsp;\n\t<td>" t t))
  256. (goto-char (point-max))
  257. )
  258. (next-line 1) (beginning-of-line)
  259. )
  260. ;;============================================================
  261. (defun gs-selfref ()
  262. "Wrap an URL to make it its own link. This is useful for links that should
  263. be visible when converted to text."
  264. (interactive)
  265. (save-restriction
  266. (narrow-to-region (region-beginning) (region-end))
  267. (goto-char (point-min))
  268. (if (not (looking-at "http:\\|ftp:")) (insert "http://"))
  269. (setq g~url (buffer-substring (point-min) (point-max)))
  270. (goto-char (point-min))
  271. (insert "<a href=\"")
  272. (goto-char (point-max)) (insert "\">" g~url "</a>")
  273. )
  274. )
  275. ;;============================================================
  276. (defun gs-table ()
  277. "Set up an indented table around this region, leaving plenty of white space
  278. around the table within the HTML. The number of columns in the table is
  279. hardcoded here as 3, so that number must be changed by hand if the table
  280. has more than 3 columns. See gs-row-of-table for how rows are built: a
  281. table with N visible columns generally has 2N-1 HTML columns, including the
  282. columns that provide vertical white space."
  283. (interactive)
  284. (save-restriction
  285. (narrow-to-region (region-beginning) (region-end))
  286. (indent-rigidly (region-beginning) (region-end) -80)
  287. (goto-char (point-min))
  288. (insert (concat
  289. "\n\n<blockquote><table cellpadding=0 cellspacing=0>\n"
  290. "<tr><th colspan=3 bgcolor=\"#CCCC00\"><hr><font size=\"+1\">XXXXXXXXXX</font><hr>\n"
  291. "<tr valign=bottom>\n"
  292. "\t<th align=left>\n"
  293. "\t<td>&nbsp;&nbsp;\n"
  294. "\t<th align=left>\n"
  295. "<tr>\t<td colspan=3><hr>\n"
  296. ))
  297. (goto-char (point-max))
  298. (insert "</table></blockquote>\n")
  299. )
  300. )
  301. ;;============================================================
  302. (defun gs-text-chars ()
  303. "Prepare text for inclusion in HTML by converting \"&\", \"<\", and \">\" into
  304. their HTML special forms. The function acts from point to end-of-region or
  305. end-of-buffer, whichever comes first.
  306. This function is NOT idempotent -- running it twice on the same text will
  307. certainly do the wrong thing, unless at first the text contained none of
  308. those characters."
  309. (interactive)
  310. (setq BEGIN (point))
  311. ;; Replace significant characters: "&", "<", and ">".
  312. (while (search-forward "&" nil t) (replace-match "&amp;" t t))
  313. (goto-char BEGIN)
  314. (while (search-forward "<" nil t) (replace-match "&lt;" t t))
  315. (goto-char BEGIN)
  316. (while (search-forward ">" nil t) (replace-match "&gt;" t t))
  317. (goto-char BEGIN)
  318. )
  319. ;;============================================================
  320. (defun gs-wrap-textfile ()
  321. "Prepare a text file for inclusion between <pre> and </pre>, then put a
  322. header and footer around it. One would generally run this function on a
  323. buffer containing only an original text file; it is how the original
  324. history and news files were first prepared. At this point it's likely to
  325. be most useful in preparing new sections for the news document."
  326. (interactive)
  327. (widen)
  328. ;; First prepare the entire text by replacing special characters.
  329. (goto-char (point-min))
  330. (gs-text-chars)
  331. ;; At the end of the file, end as-is text and add the standard footer.
  332. (goto-char (point-max))
  333. (backward-word 1) (next-line 1) (beginning-of-line)
  334. (delete-region (point) (point-max))
  335. (insert "\n</pre>\n")
  336. (insert-file "Footer.htm")
  337. ;; At the beginning of the file, begin as-is text and delete everything
  338. ;; up to the identity string (if any), saving the identity string.
  339. (goto-char (point-min))
  340. (insert "<pre>\n") (setq g~pre-point (point))
  341. (setq g~ID " [No pre-existing ID] ")
  342. (if (re-search-forward "^\\$Id: gsdoc.el,v 1.1 2000/03/09 08:40:39 lpd Exp $" nil t) (progn
  343. (setq g~ID (buffer-substring (match-beginning 1) (match-end 1)))
  344. (next-line 1) (beginning-of-line) (delete-region g~pre-point (point))
  345. ))
  346. ;; Insert the standard header and fill in the identity string.
  347. (goto-char (point-min)) (insert-file "Header.htm")
  348. (goto-char (point-min)) (search-forward "<!--" nil t)
  349. (delete-horizontal-space) (insert g~ID)
  350. (search-forward "<pre>\n" nil t)
  351. )
  352. ;;============================================================
  353. (defun ~gsregion (Tag)
  354. "Tag a region, leaving point at its end and the region around the whole
  355. thing including the new surrounding tags; thus invoking this function twice
  356. successively makes the first invocation the inner tags and the second the
  357. outer.
  358. Not intended for interactive use; for that use gs-tag, which gives a little
  359. bit of additional service."
  360. (interactive)
  361. (if (not (= 0 (length Tag))) (save-restriction
  362. (narrow-to-region (region-beginning) (region-end))
  363. (goto-char (point-min)) (insert "<" Tag ">")
  364. (goto-char (point-max)) (insert "</" Tag ">")
  365. (push-mark (point-min) t)
  366. (goto-char (point-max))
  367. )
  368. )
  369. )
  370. ;;============================================================
  371. (defun gs-structure ()
  372. "For historical interest only: add structuring commentary to a Ghostscript
  373. HTML file. It's crude, but it did most of the work. Future files will
  374. acquire their structure through plagiarism, like any other code.
  375. Now they've all been structured, and this function was used to do it. The
  376. placement of table-of-contents lines never worked, because most of the
  377. files didn't yet have TOCS. Now all files that should have TOCs have
  378. properly placed markers, but that's history."
  379. (interactive)
  380. (setq g~thisfile (buffer-name))
  381. (widen)
  382. (goto-char (point-min))
  383. ;; Replace the RCS $Id if one can be found in exactly the right format, and
  384. ;; otherwise insert one just after the title, along with a warning message.
  385. (if (re-search-forward "<!-- $Id: gsdoc.el,v 1.1 2000/03/09 08:40:39 lpd Exp $ -->" nil t)
  386. (progn
  387. (setq Original (buffer-substring (match-beginning 1) (match-end 1)))
  388. (replace-match g~thisfile t t nil 1)
  389. )
  390. (progn
  391. (search-forward "</title>" nil t) (end-of-line)
  392. (insert (concat "\n<!-- $Id: gsdoc.el,v 1.1 2000/03/09 08:40:39 lpd Exp $ -->"))
  393. (setq Original "(UNSET by gs-structure)")
  394. )
  395. )
  396. (end-of-line)
  397. (insert (concat "\n<!-- Originally: " Original " -->"))
  398. ;; Place the visible header marker immediately after <BODY>.
  399. (re-search-forward "<body[^>]*>" nil t)
  400. (end-of-line) (forward-char 1)
  401. (insert (concat g~header-begin "\n\n"))
  402. ;; Place the headline marker before the first <table> block.
  403. (search-forward "<table" nil t) (search-backward "\n\n" nil t)
  404. (forward-word 1) (beginning-of-line)
  405. (insert (concat g~headline-begin "\n\n"))
  406. ;; After the first table block place the end-headline marker and both
  407. ;; table-of-contents markers, without worrying where the table of contents
  408. ;; really is. The TOC markers can easily be moved by hand later.
  409. (search-forward "\n\n" nil t)
  410. (backward-word 1) (end-of-line) (forward-char 1)
  411. (insert (concat
  412. "\n"
  413. g~headline-end "\n\n"
  414. g~toc-begin "\n\n"
  415. g~toc-end "\n\n"))
  416. ;; The hints section begins with the first paragraph after where the TOC
  417. ;; markers are placed, and ends with <HR>. This isn't precise, and in fact
  418. ;; fails for several files, but once again only an approximation is needed
  419. ;; because it'll be edited by hand later.
  420. (search-forward "<p>" nil t) (beginning-of-line)
  421. (insert (concat g~hint-begin "\n\n"))
  422. (search-forward "<hr>" nil t) (beginning-of-line)
  423. (insert (concat g~hint-end "\n\n"))
  424. ;; The visible header ends with (and includes) the first <HR>, and the
  425. ;; contents begin immediately thereafter.
  426. (search-forward "<hr>\n" nil t)
  427. (insert (concat "\n" g~header-end "\n\n"))
  428. (forward-word 1) (beginning-of-line)
  429. (insert (concat g~contents-begin "\n\n"))
  430. ;; The contents end before the final <HR> and the trailer begins
  431. ;; immediately thereafter.
  432. (goto-char (point-max)) (search-backward "<hr>" nil t)
  433. (backward-word 1) (end-of-line) (forward-char 1)
  434. (insert (concat
  435. "\n"
  436. g~contents-end "\n\n"
  437. g~trailer-begin "\n\n"))
  438. ;; The trailer ends with </BODY>.
  439. (goto-char (point-max)) (search-backward "</body>" nil t)
  440. (insert (concat "\n" g~trailer-end "\n\n"))
  441. ;; We may have introduced trailing whitespace and extra empty lines.
  442. ;; Remove them.
  443. (goto-char (point-min))
  444. (while (re-search-forward "[ \t\240\r]+$" nil t) (replace-match "" t t))
  445. (goto-char (point-min))
  446. (while (re-search-forward "\n\n\n+" nil t) (replace-match "\n\n" t t))
  447. )
  448. ;;============================================================
  449. ;; When this file is loaded into emacs, define the structure markers for GS
  450. ;; HTML files. These markers have two purposes: first, to make the HTML
  451. ;; more readable, and second, to enable these functions to locate sections
  452. ;; unambiguously (see gs-toc, the table of contents builder). Note that
  453. ;; the markers do not include LF.
  454. (defun g~marker (basic)
  455. "Build a complete Ghostscript HTML file marker from its text-only part.
  456. gs-toc relies entirely on this function, so if it's ever changed, gs-toc
  457. and existing markers would also have to be changed to keep pace.
  458. Intended only for initialization, not interactive use.
  459. All the existing files are now marked up, and since any future ones are
  460. (properly) likely to be created by plagiarism, it's difficult to imagine
  461. why anyone would want to change this unless they want to go to the trouble
  462. of coming up with a much more useful marking scheme."
  463. (interactive)
  464. (setq HEAD (concat "<!-- [" basic "] "))
  465. (concat HEAD
  466. (substring
  467. "====================================================================== -->"
  468. (- (length HEAD) 80)
  469. ))
  470. )
  471. ;;============================================================
  472. ;; Initialization code that must run after functions are defined.
  473. ;;
  474. ;; Look in a Ghostscript HTML file to see how these markers are used,
  475. ;; generally
  476. ;;
  477. ;; begin visible header
  478. ;; begin headline
  479. ;; end headline
  480. ;; begin table of contents
  481. ;; end table of contents
  482. ;; begin hint
  483. ;; end hint
  484. ;; end visible header
  485. ;; begin contents
  486. ;; end contents
  487. ;; begin visible trailer
  488. ;; end visible trailer
  489. ;;
  490. ;; although the TOC is in slightly different positions in a few files.
  491. (defvar g~header-begin (g~marker "1.0 begin visible header")
  492. "Begin the HTML file's visible header material")
  493. (defvar g~header-end (g~marker "1.0 end visible header")
  494. "End the HTML file's visible header")
  495. (defvar g~headline-begin (g~marker "1.1 begin headline")
  496. "Begin the conspicuous headline")
  497. (defvar g~headline-end (g~marker "1.1 end headline")
  498. "End the conspicuous headline")
  499. (defvar g~toc-begin (g~marker "1.2 begin table of contents")
  500. "Begin the table of contents")
  501. (defvar g~toc-end (g~marker "1.2 end table of contents")
  502. "End the table of contents")
  503. (defvar g~hint-begin (g~marker "1.3 begin hint")
  504. "Begin the \"for other information\" section")
  505. (defvar g~hint-end (g~marker "1.3 end hint")
  506. "End the \"for other information\" section")
  507. (defvar g~contents-begin (g~marker "2.0 begin contents")
  508. "Begin the main contents")
  509. (defvar g~contents-end (g~marker "2.0 end contents")
  510. "End the main contents")
  511. (defvar g~trailer-begin (g~marker "3.0 begin visible trailer")
  512. "Begin the visible standard trailer material")
  513. (defvar g~trailer-end (g~marker "3.0 end visible trailer")
  514. "End the visible standard trailer material")
  515. ;;============================================================
  516. ;; Some working variables
  517. (defvar gs-anchor "JUNK" "*Anchor name to insert")
  518. (defvar gs-anchor-file "JUNKFILE" "*Anchor filename to insert")
  519. (defvar gs-work-buffer "*GS work*" "*Ghostscript working buffer")