Regenerate my html, pkgs, and misc init file htmls
[website] / SYinits / 07-html.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <!-- Created by htmlize-1.34 in css mode. -->
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5   <head>
6     <title>07-html.el</title>
7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8     <meta name="author" content="Steve Youngs" />
9     <meta name="owner" content="steve@sxemacs.org" />
10     <style type="text/css">
11     <!--
12       body {
13         color: #ffffff;
14         background-color: #000000;
15       }
16       .comment {
17         /* font-lock-comment-face */
18         color: #87ceeb;
19       }
20       .doc-string {
21         /* font-lock-doc-string-face */
22         color: #32cd32;
23       }
24       .function-name {
25         /* font-lock-function-name-face */
26         color: #ffff00;
27         font-weight: bold;
28       }
29       .keyword {
30         /* font-lock-keyword-face */
31         color: #fa8072;
32       }
33       .reference {
34         /* font-lock-reference-face */
35         color: #40e0d0;
36       }
37       .string {
38         /* font-lock-string-face */
39         color: #00cd00;
40       }
41       .type {
42         /* font-lock-type-face */
43         color: #1e90ff;
44       }
45       .variable-name {
46         /* font-lock-variable-name-face */
47         color: #ffdab9;
48       }
49
50       a {
51         color: #FF0000;
52         background-color: inherit;
53         font: inherit;
54         font-weight: bold;
55         text-decoration: underline;
56       }
57       a:hover {
58         color: #FFFFFF;
59         background-color: #FD00FD;
60         text-decoration: underline;
61       }
62       .img a:hover {
63         background-color: #000000;
64         text-decoration: none;
65       }
66     -->
67     </style>
68   </head>
69   <body>
70     <pre>
71 <span class="comment">;; 07-html-sy.el --- HTML settings
72 </span>
73 <span class="comment">;; Copyright (C) 2007 - 2020 Steve Youngs
74 </span>
75 <span class="comment">;;     Author: Steve Youngs &lt;<a href="mailto:steve&#64;sxemacs.org">steve&#64;sxemacs.org</a>&gt;
76 ;; Maintainer: Steve Youngs &lt;<a href="mailto:steve&#64;sxemacs.org">steve&#64;sxemacs.org</a>&gt;
77 ;;    Created: &lt;2007-12-02&gt;
78 ;; Time-stamp: &lt;Saturday Apr 18, 2020 21:15:50 steve&gt;
79 ;;   Download: &lt;<a href="https://downloads.sxemacs.org/SYinits/">https://downloads.sxemacs.org/SYinits/</a>&gt;
80 ;;   HTMLised: &lt;<a href="https://www.sxemacs.org/SYinits/07-html.html">https://www.sxemacs.org/SYinits/07-html.html</a>&gt;
81 ;;   Git Repo: git clone https://git.sxemacs.org/syinit
82 ;;   Keywords: init, compile
83 </span>
84 <span class="comment">;; This file is part of SYinit
85 </span>
86 <span class="comment">;; Redistribution and use in source and binary forms, with or without
87 ;; modification, are permitted provided that the following conditions
88 ;; are met:
89 ;;
90 ;; 1. Redistributions of source code must retain the above copyright
91 ;;    notice, this list of conditions and the following disclaimer.
92 ;;
93 ;; 2. Redistributions in binary form must reproduce the above copyright
94 ;;    notice, this list of conditions and the following disclaimer in the
95 ;;    documentation and/or other materials provided with the distribution.
96 ;;
97 ;; 3. Neither the name of the author nor the names of any contributors
98 ;;    may be used to endorse or promote products derived from this
99 ;;    software without specific prior written permission.
100 ;;
101 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
102 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
103 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
104 ;; DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
105 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
106 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
107 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
108 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
109 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
110 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
111 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
112 </span>
113 <span class="comment">;;; Commentary:
114 ;;
115 ;;   Sets up things for writing HTML.
116 </span>
117 <span class="comment">;;; Credits:
118 ;;
119 ;;   The HTML version of this file was created with Hrvoje Niksic's
120 ;;   htmlize.el which is part of the XEmacs "text-modes" package.
121 ;;
122 </span>
123 <span class="comment">;;; Todo:
124 ;;
125 ;;     
126 </span>
127 <span class="comment">;;; Code:
128 ;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
129 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> General HTML settings.
130 </span>(setq
131  html-helper-htmldtd-version
132  "<span class="doc-string">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;
133 &lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
134  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"&gt;\n</span>"
135  html-helper-use-expert-menu t
136  hm--html-automatic-create-modified-line t
137  hm--html-automatic-update-modified-line t
138  hm--html-changed-comment-prefix "<span class="doc-string">Changed with SXEmacs, by: </span>"
139  hm--html-created-comment-prefix "<span class="doc-string">Created with SXEmacs, by: </span>"
140  hm--html-expert t
141  hm--html-html-doctype-version
142  "<span class="doc-string">\"-//W3C//DTD XHTML 1.0 Transitional//EN\"
143  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"</span>"
144  hm--html-log-date-format "<span class="doc-string">%y-%m-%d</span>"
145  hm--html-template-dir 
146  (file-name-as-directory 
147   (expand-file-name "<span class="string">templates</span>"
148                     (locate-data-directory "<span class="string">hm--html-menus</span>")))
149  hm--html-frame-template-file 
150  (expand-file-name "<span class="string">frame.html.tmpl</span>" hm--html-template-dir)
151  hm--html-title-date-format "<span class="doc-string">%y-%m-%d</span>"
152  hm--html-username "<span class="doc-string">Steve Youngs</span>"
153  html-sigusr1-signal-value 10)
154
155 <span class="comment">;; SGML stuff.
156 </span>(setq
157  sgml-auto-activate-dtd t
158  sgml-live-element-indicator t
159  sgml-validate-command "<span class="doc-string">onsgmls -s -m  %s %s</span>")
160
161 (<span class="keyword">defvar</span> <span class="variable-name">sy-sgml-dirs</span>
162   (directory-files-recur "<span class="string">/usr/share/sgml</span>" 'full nil nil 'subdir)
163   "<span class="doc-string">List of directories for `</span><span class="doc-string"><span class="reference">sgml-system-path</span></span><span class="doc-string">'.</span>")
164
165 (setq sgml-system-path
166       (append '("<span class="string">.</span>" 
167                 "<span class="string">/usr/share/sxemacs/xemacs-packages/etc/psgml-dtds/</span>")
168               sy-sgml-dirs))
169
170 (<span class="keyword">autoload</span> 'html-mode "<span class="doc-string">psgml-html</span>" "<span class="doc-string">Load psgml-html-mode</span>" t)
171 (<span class="keyword">autoload</span> 'css-mode "<span class="doc-string">css-mode</span>")
172
173 (add-hook 'html-mode-hook #'hm--html-minor-mode)
174 (<span class="keyword">eval-when-compile</span> (defvar ispell-extra-args))
175 (add-hook 'html-mode-hook
176           #'(<span class="keyword">lambda</span> ()
177               (make-local-variable 'ispell-extra-args)
178               (push "<span class="string">-H</span>" ispell-extra-args)))
179 (add-hook 'html-helper-timestamp-hook #'html-helper-default-insert-timestamp)
180
181 <span class="comment">;</span><span class="comment"><span class="reference">:*=======================</span></span><span class="comment">
182 ;</span><span class="comment"><span class="reference">:*</span></span><span class="comment"> Hrvoje Niksic's htmlize
183 ;;
184 ;;  `</span><span class="comment"><span class="reference">htmlize.el</span></span><span class="comment">' comes with the "text-modes" SXEmacs package.
185 ;;
186 ;;  `</span><span class="comment"><span class="reference">htmlize.el</span></span><span class="comment">' is a lovely piece of code for converting Emacs buffers
187 ;;  into HTML.  The default settings should be fine for most people most
188 ;;  of the time in most situations.  But, by now, I'm sure that you've
189 ;;  come to the realisation that I don't fit into that category.  So
190 ;;  lets hack... </span><span class="comment"><span class="reference">:-</span></span><span class="comment">)
191 </span>(<span class="keyword">eval-and-compile</span>
192   (<span class="keyword">require</span> '<span class="reference">htmlize</span>))
193
194 <span class="comment">;; Force XHTML 1.0 Transitional
195 </span>(<span class="keyword">defun</span> <span class="function-name">htmlize-default-doctype</span> ()
196   nil
197   "<span class="doc-string">&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
198  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"&gt;</span>")
199
200 <span class="comment">;; File-local variables can cause problems so this advice simply
201 ;; disables them when htmlize runs.
202 </span>(<span class="keyword">defadvice</span> <span class="function-name">htmlize-buffer</span> (around nolocals (<span class="type">&amp;rest</span> args) activate)
203   "<span class="doc-string">Turn off file local variables during htmlize-buffer.</span>"
204   (<span class="keyword">let</span> ((enable-local-variables nil)
205         buf)
206     (setq buf ad-do-it)
207     (<span class="keyword">when</span> (interactive-p) (switch-to-buffer buf))))
208
209 <span class="comment">;; By default htmlize would turn 'file.el' into 'file.el.html', I
210 ;; prefer that it turned it into 'file.html'.  That's what this advice
211 ;; does.
212 </span>(<span class="keyword">defadvice</span> <span class="function-name">htmlize-make-file-name</span> (before filename activate)
213   "<span class="doc-string">Prefer filenames \"file.ext\" -&gt; \"file.html\".</span>"
214   (setq file (file-name-sans-extension file)))
215
216 <span class="comment">;; This function, run from `</span><span class="comment"><span class="reference">htmlize-after-hook</span></span><span class="comment">' lets me embed HTML
217 ;; comments inside normal source comments and also allows me to set up
218 ;; relative hyperlinks.
219 </span>(<span class="keyword">defun</span> <span class="function-name">sy-htmlize-set-links</span> ()
220   "<span class="doc-string">Function run from `</span><span class="doc-string"><span class="reference">htmlize-after-hook</span></span><span class="doc-string">'.
221
222 It takes care of any relative hyperlinks and also dequotes any HTML
223 comments that were incorrectly quoted.
224
225 Relative hyperlinks need to be prepared in a particular way in the
226 file that is to be converted to HTML.  For example, in an emacs lisp
227 file you might see:
228
229     Get the latest rls=/src/foo.el;rld=version here;rle.
230
231 Which would be converted to:
232
233     Get the latest &lt;a href=\"/src/foo.el\"&gt;version here&lt;/a&gt;.</span>"
234   <span class="comment">;; LOL, we actually need to _NOT_ do it in _this_ file so the doc
235 </span>  <span class="comment">;; string for this function looks right.
236 </span>  (<span class="keyword">unless</span> (string-match "<span class="string">07-html</span>" (buffer-name (declare-boundp htmlbuf)))
237     (<span class="keyword">save-excursion</span>
238       (goto-char (point-min))
239       (mapcar
240        '(<span class="keyword">lambda</span> (x) (<span class="keyword">save-excursion</span> (eval x)))
241        '((replace-string "<span class="string">rls=</span>" "<span class="string">&lt;a href=\"</span>")
242          (replace-string "<span class="string">;rld=</span>" "<span class="string">\"&gt;</span>")
243          (replace-string "<span class="string">;rle</span>" "<span class="string">&lt;/a&gt;</span>")
244          (replace-string "<span class="string">&amp;lt;!--</span>" "<span class="string">&lt;!--</span>")
245          (replace-string "<span class="string">--&amp;gt;</span>" "<span class="string">--&gt;</span>"))))))
246
247 (<span class="keyword">defun</span> <span class="function-name">sy-htmlize-add-xmlns</span> ()
248   "<span class="doc-string">Adds a xmlns property to the html tag.
249
250 Because we are trying to output XHTML we need to add the xmlns to the
251 html tag.  Done via `</span><span class="doc-string"><span class="reference">htmlize-after-hook</span></span><span class="doc-string">'.</span>"
252   (<span class="keyword">save-excursion</span>
253     (goto-char (point-min))
254     (re-search-forward "<span class="string">&lt;html&gt;</span>" nil t)
255     (replace-match
256      "<span class="string">&lt;html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"&gt;</span>")))
257
258 <span class="comment">;; I know that the pages generated by `</span><span class="comment"><span class="reference">htmlize.el</span></span><span class="comment">' are valid HTML and
259 ;; are created by SXEmacs.  So I announce the fact by adding the appropriate
260 ;; logos to the bottom of the page, together with a copyright notice.  This
261 ;; is the raw HTML for that.
262 ;; Used to have valid CSS as well but that is way too much mucking
263 ;; about to get the validator to work from within an iframe.  In case
264 ;; you are wondering, the CSS produced from htmlize is definitely
265 ;; valid.
266 ;; &lt;a href=\"http://jigsaw.w3.org/css-validator/check/referer\" target=\"_blank\"&gt;
267 ;;   &lt;img style=\"padding:0px 0px 0px 5px;border:0;width:88px;height:31px\"
268 ;;     src=\"/Images/vcss.png\"
269 ;;     title=\"Valid CSS!\" alt=\"Valid CSS!\" /&gt;
270 ;; &lt;/a&gt;
271 </span>(<span class="keyword">defvar</span> <span class="variable-name">sy-htmlize-appendix</span>
272   (concat "<span class="string">&lt;!--  SXEmacs Logo --&gt;
273     &lt;div class=\"img\"&gt;
274       &lt;a href=\"https://www.sxemacs.org/\" target=\"_parent\"&gt;
275         &lt;img style=\"padding:0px 5px 0px 0px;border:0;width:88px;height:31px\"
276           src=\"/Images/cbsx.png\"
277           title=\"This page was created entirely in SXEmacs\"
278           alt=\"Created with SXEmacs\" /&gt;
279       &lt;/a&gt;
280 &lt;!--  End SXEmacs Logo --&gt;
281 &lt;!--  Valid XHTML 1.0 --&gt;
282       &lt;a href=\"http://validator.w3.org/check?uri=</span>" "<span class="string">%s</span>" "<span class="string">\" target=\"_blank\"&gt;
283        &lt;img style=\"padding:0px 5px 0px 10px;border:0;width:88px;height:31px\"
284           src=\"/Images/valid-xhtml10.png\"
285           title=\"Valid XHTML 1.0 Transitional!\"
286           alt=\"Valid XHTML 1.0 Transitional!\" /&gt;
287       &lt;/a&gt;
288     &lt;/div&gt;
289 &lt;!--  End Valid XHTML 1.0 --&gt;
290
291     &lt;h6&gt;Copyright &amp;#169; </span>"
292           (format-time-string "<span class="string">%Y</span>") "<span class="string"> Steve Youngs&lt;br /&gt;
293      Verbatim copying and distribution is permitted in any medium,
294     providing this notice is preserved.&lt;br /&gt;
295 &lt;!-- hhmts start --&gt;
296 &lt;!-- hhmts end --&gt;
297    &lt;/h6&gt;
298
299 </span>"
300 ))
301
302 <span class="comment">;; Appends the above to each page.  Run from `</span><span class="comment"><span class="reference">htmlize-after-hook</span></span><span class="comment">'.
303 </span>(<span class="keyword">autoload</span> 'url-hexify-string "<span class="doc-string">url-util</span>")
304 (<span class="keyword">defun</span> <span class="function-name">sy-htmlize-append</span> ()
305   "<span class="doc-string">Append some things to the end of files produced by `</span><span class="doc-string"><span class="reference">htmlize.el</span></span><span class="doc-string">'.</span>"
306   (<span class="keyword">let</span> ((html (url-hexify-string
307                (concat "<span class="string">https://www.sxemacs.org/SYinits/</span>"
308                        (buffer-name)))))
309     (goto-char (point-max))
310     (re-search-backward "<span class="string">&lt;/body&gt;</span>" nil t)
311     (insert (format sy-htmlize-appendix html))))
312
313 <span class="comment">;; Set a couple of basic things.
314 </span>(setq
315  htmlize-html-charset nil
316  htmlize-html-major-mode 'html-mode
317  htmlize-head-tags
318  "<span class="doc-string">&lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /&gt;
319     &lt;meta name=\"author\" content=\"Steve Youngs\" /&gt;
320     &lt;meta name=\"owner\" content=\"steve@sxemacs.org\" /&gt;
321 </span>")
322
323 (setq htmlize-hyperlink-style "<span class="doc-string">
324       a {
325         color: #FF0000;
326         background-color: inherit;
327         font: inherit;
328         font-weight: bold;
329         text-decoration: underline;
330       }
331       a:hover {
332         color: #FFFFFF;
333         background-color: #FD00FD;
334         text-decoration: underline;
335       }
336       .img a:hover {
337         background-color: #000000;
338         text-decoration: none;
339       }
340 </span>")
341
342 <span class="comment">;; Hooks
343 </span>(<span class="keyword">defvar</span> <span class="variable-name">sy-htmlize-this-file</span> nil
344   "<span class="doc-string">The name of the file we htmlize'd.</span>")
345 (<span class="keyword">defun</span> <span class="function-name">sy-htmlize-before-hook</span> ()
346   "<span class="doc-string">Prepares the buffer for htmlising.
347 Turns off howm-mode as it can play havoc with the font-locking, and we
348 force a fontify of the buffer.</span>"
349   (setq sy-htmlize-this-file (buffer-file-name))
350   (and howm-mode (howm-mode 0))
351   (font-lock-fontify-buffer))
352
353 (<span class="keyword">defun</span> <span class="function-name">sy-htmlize-after-hook</span> ()
354   (sy-htmlize-set-links)
355   (sy-htmlize-append)
356   (sy-htmlize-add-xmlns)
357   (<span class="keyword">with-current-buffer</span> (get-file-buffer sy-htmlize-this-file)
358     (normal-mode)) <span class="comment">; Will turn howm-mode back on if it was off
359 </span>  (setq sy-htmlize-this-file nil))
360
361 (add-hook 'htmlize-before-hook #'sy-htmlize-before-hook)
362 (add-hook 'htmlize-after-hook #'sy-htmlize-after-hook)
363 <span class="comment">;</span><span class="comment"><span class="reference">:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*</span></span><span class="comment">
364 </span>(message "<span class="doc-string">HTML settings initialised</span>")
365 </pre>
366   <!--  SXEmacs Logo -->
367     <div class="img">
368       <a href="https://www.sxemacs.org/" target="_parent">
369         <img style="padding:0px 5px 0px 0px;border:0;width:88px;height:31px"
370           src="/Images/cbsx.png"
371           title="This page was created entirely in SXEmacs"
372           alt="Created with SXEmacs" />
373       </a>
374 <!--  End SXEmacs Logo -->
375 <!--  Valid XHTML 1.0 -->
376       <a href="http://validator.w3.org/check?uri=https%3a%2f%2fwww.sxemacs.org%2fSYinits%2f07-html.html" target="_blank">
377        <img style="padding:0px 5px 0px 10px;border:0;width:88px;height:31px"
378           src="/Images/valid-xhtml10.png"
379           title="Valid XHTML 1.0 Transitional!"
380           alt="Valid XHTML 1.0 Transitional!" />
381       </a>
382     </div>
383 <!--  End Valid XHTML 1.0 -->
384
385     <h6>Copyright &#169; 2020 Steve Youngs<br />
386      Verbatim copying and distribution is permitted in any medium,
387     providing this notice is preserved.<br />
388 <!-- hhmts start -->
389 Last modified: Sat Apr 18 21:42:00 AEST 2020
390 <!-- hhmts end -->
391    </h6>
392
393 </body>
394 </html>