22
|
1 ;;; $Id: hm--html.el,v 1.2 1997/02/16 01:29:10 steve Exp $
|
2
|
2 ;;;
|
22
|
3 ;;; Copyright (C) 1993 - 1997 Heiko Muenkel
|
0
|
4 ;;; email: muenkel@tnt.uni-hannover.de
|
|
5 ;;;
|
|
6 ;;; This program is free software; you can redistribute it and/or modify
|
|
7 ;;; it under the terms of the GNU General Public License as published by
|
|
8 ;;; the Free Software Foundation; either version 2, or (at your option)
|
|
9 ;;; any later version.
|
|
10 ;;;
|
|
11 ;;; This program is distributed in the hope that it will be useful,
|
|
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 ;;; GNU General Public License for more details.
|
|
15 ;;;
|
|
16 ;;; You should have received a copy of the GNU General Public License
|
|
17 ;;; along with this program; if not, write to the Free Software
|
|
18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
19 ;;;
|
|
20 ;;;
|
|
21 ;;; Description:
|
|
22 ;;;
|
|
23 ;;; Defines functions for the file hm--html-menu.el.
|
|
24 ;;;
|
|
25 ;;; Installation:
|
|
26 ;;;
|
|
27 ;;; Put this file in one of your load path directories.
|
|
28 ;;;
|
|
29
|
2
|
30 ;(require 'hm--date)
|
|
31 ;(require 'adapt)
|
0
|
32
|
|
33
|
22
|
34 (defun hm--html-set-marker-at-position (&optional position)
|
|
35 "Creates a new marker and set the marker at the POSITION.
|
|
36 If POSITION is nil, then the marker is set at the current point.
|
|
37 The return value is the marker."
|
|
38 (let ((marker (make-marker)))
|
|
39 (if position
|
|
40 (set-marker marker position)
|
|
41 (set-marker marker (point)))))
|
0
|
42
|
|
43 ;;; Functions for adding html commands which consists of a start and a
|
|
44 ;;; end tag and some text between them. (Basicfunctions)
|
|
45
|
|
46 (defun hm--html-add-tags (function-insert-start-tag
|
|
47 start-tag
|
2
|
48 &optional
|
|
49 function-insert-end-tag
|
|
50 end-tag
|
|
51 function-insert-middle-start-tag
|
|
52 middle-start-tag
|
|
53 function-insert-middle-end-tag
|
|
54 middle-end-tag)
|
0
|
55 "Adds the start and the end html tag at point.
|
|
56 The first parameter specifies the funtion which insert the start tag
|
|
57 and the third parameter specifies the function which insert the end tag.
|
|
58 The second parameter is the string for the start tag and the fourth parameter
|
|
59 is the string for the end tag. The third and fourth parameters are optional.
|
|
60 The fifth parameter is optional. If it exists, it specifies a function which
|
22
|
61 inserts the sixth parameter (the middle-start-tag) between the start and the
|
|
62 end tag."
|
0
|
63 (eval (list function-insert-start-tag start-tag))
|
2
|
64 (if function-insert-middle-start-tag
|
|
65 (eval (list function-insert-middle-start-tag middle-start-tag)))
|
22
|
66 (let ((position (hm--html-set-marker-at-position (point))))
|
2
|
67 (if function-insert-middle-end-tag
|
|
68 (eval (list function-insert-middle-end-tag middle-end-tag)))
|
|
69 (if function-insert-end-tag
|
|
70 (eval (list function-insert-end-tag end-tag)))
|
|
71 (goto-char position)))
|
0
|
72
|
|
73
|
|
74 (defun hm--html-add-tags-to-region (function-insert-start-tag
|
|
75 start-tag
|
|
76 function-insert-end-tag
|
|
77 end-tag
|
22
|
78 &optional
|
|
79 function-insert-middle-tag
|
|
80 middle-tag)
|
0
|
81 "Adds the start and the end html tag to the active region.
|
|
82 The first parameter specifies the funtion which insert the start tag
|
|
83 and the third parameter specifies the function which insert the end tag.
|
|
84 The second parameter is the string for the start tag and the fourth parameter
|
|
85 is the string for the end tag.
|
|
86 The fifth parameter is optional. If it exists, it specifies a function which
|
|
87 inserts the sixth parameter (the middle-tag) between the start and the end
|
|
88 tag."
|
|
89 (save-window-excursion
|
22
|
90 (let ((start (hm--html-set-marker-at-position (region-beginning)))
|
0
|
91 (end (region-end)))
|
|
92 (goto-char end)
|
|
93 (eval (list function-insert-end-tag end-tag))
|
|
94 (goto-char start)
|
22
|
95 ; (backward-char (+ (length end-tag) (- end start)))
|
0
|
96 (eval (list function-insert-start-tag start-tag))
|
|
97 (if function-insert-middle-tag
|
|
98 (eval (list function-insert-middle-tag middle-tag)))
|
|
99 )))
|
|
100
|
|
101
|
|
102 (defun hm--html-insert-start-tag (tag)
|
|
103 "Inserts the HTML start tag 'tag' without a Newline.
|
|
104 The parameter must be a string (i.e. \"<B>\")"
|
|
105 (let ((start (point)))
|
|
106 (insert tag)
|
2
|
107 (hm--html-indent-region start (point))))
|
|
108 ; (html-maybe-deemphasize-region start (- (point) 1))))
|
0
|
109
|
|
110
|
|
111 (defun hm--html-insert-end-tag (tag)
|
|
112 "Inserts the HTML end tag 'tag' without a Newline.
|
|
113 The parameter must be a string (i.e. \"</B>\")"
|
|
114 (let ((start (point)))
|
|
115 (insert tag)
|
2
|
116 (hm--html-indent-region start (point))))
|
|
117 ; (html-maybe-deemphasize-region start (- (point) 1))))
|
0
|
118
|
|
119
|
|
120 (defun hm--html-insert-start-tag-with-newline (tag)
|
|
121 "Inserts the HTML start tag 'tag' with a Newline.
|
|
122 The parameter must be a string (i.e. \"<PRE>\")"
|
|
123 (let ((start (point)))
|
|
124 (insert tag)
|
2
|
125 (hm--html-indent-region start (point))
|
|
126 )
|
0
|
127 (insert "\n"))
|
|
128
|
|
129
|
|
130 (defun hm--html-insert-end-tag-with-newline (tag)
|
|
131 "Inserts the HTML end tag 'tag' with a Newline.
|
|
132 The parameter must be a string (i.e. \"</PRE>\")"
|
|
133 (insert "\n")
|
|
134 (let ((start (point)))
|
|
135 (insert tag)
|
2
|
136 (hm--html-indent-region start (point))))
|
0
|
137
|
|
138
|
|
139
|
|
140 ;;; Functions which add simple tags of the form <tag>
|
|
141
|
2
|
142 (defun hm--html-add-list-or-menu-item-separator ()
|
|
143 "Adds a list or menu item. Assume we're at the end of the last item."
|
|
144 (interactive)
|
|
145 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline "<LI> "))
|
|
146
|
|
147 (defun hm--html-add-list-or-menu-item ()
|
|
148 "Adds the tags for a menu item at the point in the current buffer."
|
|
149 (interactive)
|
|
150 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline "<LI> "
|
|
151 'hm--html-insert-end-tag " </LI>"))
|
|
152
|
|
153 (defun hm--html-add-list-or-menu-item-to-region ()
|
|
154 "Adds the tags for a menu item to the region in the current buffer."
|
|
155 (interactive)
|
|
156 (hm--html-add-tags-to-region 'hm--html-insert-start-tag "<LI> "
|
|
157 'hm--html-insert-end-tag " </LI>"))
|
|
158
|
0
|
159 (defun hm--html-add-line-break ()
|
|
160 "Adds the HTML tag for a line break."
|
|
161 (interactive)
|
|
162 (hm--html-add-tags 'hm--html-insert-start-tag "<BR>"))
|
|
163
|
|
164
|
|
165 (defun hm--html-add-horizontal-rule ()
|
|
166 "Adds the HTML tag for a horizontal rule (line)."
|
|
167 (interactive)
|
|
168 (hm--html-add-tags 'hm--html-insert-start-tag "<HR>"))
|
|
169
|
|
170
|
|
171 (defun hm--html-add-paragraph ()
|
|
172 "Adds the HTML tags for a paragraph at the point in the current buffer."
|
|
173 (interactive)
|
|
174 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
175 "<P>"
|
|
176 'hm--html-insert-end-tag-with-newline
|
|
177 "</P>"))
|
|
178
|
|
179
|
|
180 (defun hm--html-add-paragraph-to-region ()
|
|
181 "Adds the HTML tags for a paragraph to the region."
|
|
182 (interactive)
|
|
183 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
184 "<P>"
|
|
185 'hm--html-insert-end-tag-with-newline
|
|
186 "</P>"))
|
|
187
|
|
188
|
|
189 (defun hm--html-add-paragraph-separator ()
|
|
190 "Adds the tag for a paragraph seperator."
|
|
191 (interactive)
|
|
192 (hm--html-add-tags 'hm--html-insert-start-tag "<P>"))
|
|
193
|
|
194
|
|
195
|
|
196 ;;; Functions which include something in HTML- documents
|
|
197
|
|
198 (defvar hm--html-url-history-list nil
|
|
199 "History list for the function 'hm--html-read-url'")
|
|
200
|
|
201
|
|
202 (defun hm--html-read-url-predicate (table-element-list usagesymbol)
|
|
203 "Predicatefunction for hm--html-read-url."
|
|
204 (hm--html-read-url-predicate-1 (cdr table-element-list) usagesymbol))
|
|
205
|
|
206
|
|
207 (defun hm--html-read-url-predicate-1 (table-element-list usagesymbol)
|
|
208 "Internal function of hm--html-read-url-predicate."
|
|
209 (cond ((not table-element-list) nil)
|
|
210 ((eq (car table-element-list) usagesymbol))
|
|
211 (t (hm--html-read-url-predicate-1 (cdr table-element-list)
|
|
212 usagesymbol))))
|
|
213
|
|
214
|
|
215 (defun hm--html-read-url (prompt &optional
|
|
216 table
|
|
217 predicate
|
|
218 require-match
|
|
219 initial-contents)
|
|
220 "Function prompts for a URL string.
|
|
221 TABLE is an alist whose elements' cars are URL's.
|
|
222 PREDICATE limits completion to a subset of TABLE.
|
|
223 If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless
|
|
224 the input is (or completes to) an element of TABLE.
|
|
225 INITIAL-CONTENTS is a string to insert in the minibuffer before reading.
|
|
226 If INITIAL-CONTENTS is nil, the car of the 'hm--html-url-history-list'
|
|
227 is used instead."
|
|
228 (if table
|
|
229 (completing-read prompt
|
|
230 table
|
|
231 predicate
|
|
232 require-match
|
|
233 initial-contents
|
|
234 hm--html-url-history-list)
|
|
235 (read-string prompt
|
|
236 (if initial-contents
|
|
237 initial-contents
|
|
238 (car hm--html-url-history-list))
|
|
239 hm--html-url-history-list)))
|
|
240
|
|
241
|
|
242 (defun hm--html-read-altenate (url)
|
|
243 "Function reads the value for the \"ALT\"- attribute in IMG tags.
|
|
244 URL will be used as the default URL for the external viewer."
|
|
245 (let ((alttype
|
|
246 (string-to-int
|
|
247 (completing-read
|
|
248 ; "0: No ALT atribute, 1: ALT=\"\", 2: ALT=Text, 3: ALT=External Viewer: "
|
|
249 "0: No ALT atribute, 1: ALT=\"\", 2: ALT=Text: "
|
|
250 ; '(("0") ("1") ("2") ("3"))
|
|
251 '(("0") ("1") ("2"))
|
|
252 nil
|
|
253 t
|
|
254 "2"))))
|
|
255 (cond ((= alttype 0) nil)
|
|
256 ((= alttype 1) "")
|
|
257 ((= alttype 2) (read-string
|
|
258 "Text for the ALT attribute: "
|
|
259 (substring (file-name-nondirectory url)
|
|
260 0
|
|
261 (string-match
|
|
262 "\\."
|
|
263 (file-name-nondirectory url)))))
|
|
264 ; ((= alttype 3) (concat "<A HREF=\""
|
|
265 ; url
|
|
266 ; "\">"
|
|
267 ; (file-name-nondirectory url)
|
|
268 ; "</A>"))
|
|
269 )))
|
|
270
|
|
271
|
|
272 (defun hm--html-add-image-bottom (href alt)
|
|
273 "Add an image, bottom aligned."
|
|
274 (interactive (let ((url (hm--html-read-url "Image URL: ")))
|
|
275 (list url (hm--html-read-altenate url))))
|
2
|
276 (hm--html-add-tags
|
|
277 'hm--html-insert-start-tag
|
|
278 (concat "<IMG ALIGN=BOTTOM SRC=\""
|
|
279 href
|
|
280 (when alt
|
|
281 (concat "\" ALT=\"" alt))
|
|
282 "\">")))
|
0
|
283
|
|
284
|
|
285 (defun hm--html-add-image-middle (href alt)
|
|
286 "Add an image, middle aligned."
|
|
287 (interactive (let ((url (hm--html-read-url "Image URL: ")))
|
|
288 (list url (hm--html-read-altenate url))))
|
2
|
289 (hm--html-add-tags
|
|
290 'hm--html-insert-start-tag
|
|
291 (concat "<IMG ALIGN=MIDDLE SRC=\""
|
|
292 href
|
|
293 (when alt
|
|
294 (concat "\" ALT=\"" alt))
|
|
295 "\">")))
|
0
|
296
|
|
297
|
|
298 (defun hm--html-add-image-top (href alt)
|
|
299 "Add an image, top aligned."
|
|
300 (interactive (let ((url (hm--html-read-url "Image URL: ")))
|
|
301 (list url (hm--html-read-altenate url))))
|
2
|
302 (hm--html-add-tags
|
|
303 'hm--html-insert-start-tag
|
|
304 (concat "<IMG ALIGN=TOP SRC=\""
|
|
305 href
|
|
306 (when alt
|
|
307 (concat "\" ALT=\"" alt))
|
|
308 "\">")))
|
|
309
|
|
310
|
|
311 (defun hm--html-add-applet (name code width height)
|
|
312 "Add an applet."
|
|
313 (interactive (let ((name (read-string "Applet Name: " "applet"))
|
|
314 (code (read-file-name "Applet Class File: "))
|
|
315 (width (read-number "Width (i.e.: 100): " t))
|
|
316 (height (read-number "Height (i.e.: 100): " t)))
|
|
317 (list name code width height)))
|
|
318 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
319 (concat "<APPLET "
|
|
320 (if (string= name "")
|
|
321 ""
|
|
322 (concat "NAME=\"" name "\"\n"))
|
|
323 "CODE=\""
|
|
324 code
|
|
325 "\"\n"
|
|
326 "WIDTH=\""
|
|
327 width
|
|
328 "\"\n"
|
|
329 "HEIGHT=\""
|
|
330 height
|
|
331 "\">")
|
|
332 'hm--html-insert-start-tag-with-newline
|
|
333 "</APPLET>"))
|
|
334
|
|
335 (defun hm--html-add-applet-parameter (name value)
|
|
336 "Adds the tag for an applet parameter at the current point.
|
|
337 This tag must be added between <APPLET> and </APPLET>."
|
|
338 (interactive "sParameter Name: \nsParameter Value: ")
|
|
339 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
340 (concat "<PARAM "
|
|
341 "NAME=\""
|
|
342 name
|
|
343 "\" VALUE=\""
|
|
344 value
|
|
345 "\">")))
|
|
346
|
0
|
347
|
|
348 (defun hm--html-add-server-side-include-file (file)
|
|
349 "This function adds a server side include file directive in the buffer.
|
|
350 The directive is only supported by the NCSA http daemon."
|
|
351 (interactive "FInclude File: ")
|
|
352 (let ((start (point)))
|
|
353 (if (string= file "")
|
|
354 (error "ERROR: No filename specified !")
|
2
|
355 (insert "<INC SRV \"" file "\">"))))
|
|
356 ; (html-maybe-deemphasize-region (1+ start) (1- (point))))))
|
0
|
357
|
|
358
|
|
359 (defun hm--html-add-server-side-include-command-with-isindex-parameter
|
|
360 (command)
|
|
361 "This function adds a server side include command directive in the buffer.
|
|
362 The include command uses the \"isindex\"- parameter for the specified command."
|
|
363 (interactive (list
|
|
364 (completing-read "Include Command: "
|
|
365 hm--html-server-side-include-command-alist)))
|
|
366 (hm--html-add-server-side-include-command command t))
|
|
367
|
|
368
|
|
369 (defun hm--html-add-server-side-include-command (command &optional srvurl)
|
|
370 "This function adds a server side include command directive in the buffer.
|
|
371 The directive is only supported by the NCSA http daemon.
|
|
372 If SRVURL is t, then the attribute srvurl instead of srv is used for the
|
|
373 include command. With srvurl, the include command uses the \"isindex\"-
|
|
374 parameter for the specified command."
|
|
375 (interactive (list
|
|
376 (completing-read "Include Command: "
|
|
377 hm--html-server-side-include-command-alist)))
|
|
378 (let ((start (point))
|
|
379 (attribute (if srvurl "SRVURL" "SRV")))
|
|
380 (if (string= command "")
|
|
381 (error "ERROR: No command specified !")
|
|
382 (if (= ?| (string-to-char command))
|
|
383 (insert "<INC " attribute" \"" command "\">")
|
2
|
384 (insert "<INC " attribute " \"|" command "\">")))))
|
|
385 ; (html-maybe-deemphasize-region (1+ start) (1- (point)))))))
|
0
|
386
|
|
387
|
|
388 ;(defun hm--html-add-server-side-include-command-with-parameter (command
|
|
389 ; parameter)
|
|
390 ; "This function adds a server side include command directive in the buffer.
|
|
391 ;The directive is only supported by the NCSA http daemon."
|
|
392 ; (interactive (list
|
|
393 ; (completing-read
|
|
394 ; "Include Command: "
|
|
395 ; hm--html-server-side-include-command-with-parameter-alist)
|
|
396 ; (read-string "Parameterlist sepearted by '?': ")))
|
|
397 ; (let ((start (point)))
|
|
398 ; (if (string= command "")
|
|
399 ; (error "ERROR: No command specified !")
|
|
400 ; (if (string= parameter "")
|
|
401 ; (error "ERROR: No parameter specified !")
|
|
402 ; (if (= ?| (string-to-char command))
|
|
403 ; (if (= ?? (string-to-char parameter))
|
|
404 ; (insert "<INC SRVURL \"" command parameter "\">")
|
|
405 ; (insert "<INC SRVURL \"" command "?" parameter "\">"))
|
|
406 ; (if (= ?? (string-to-char parameter))
|
|
407 ; (insert "<INC SRVURL \"|" command parameter "\">")
|
|
408 ; (insert "<INC SRVURL \"|" command "?" parameter "\">")))
|
|
409 ; (html-maybe-deemphasize-region (1+ start) (1- (point)))))))
|
|
410
|
|
411
|
|
412
|
|
413 ;;; Functions, which adds tags of the form <starttag> ... </endtag>
|
|
414
|
2
|
415 (defun hm--html-add-big ()
|
|
416 "Adds the HTML tags for Big at the point in the current buffer."
|
|
417 (interactive)
|
|
418 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
419 "<BIG>"
|
|
420 'hm--html-insert-end-tag
|
|
421 "</BIG>"))
|
|
422
|
|
423
|
|
424 (defun hm--html-add-big-to-region ()
|
|
425 "Adds the HTML tags for Big to the region."
|
|
426 (interactive)
|
|
427 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
428 "<BIG>"
|
|
429 'hm--html-insert-end-tag
|
|
430 "</BIG>"))
|
|
431
|
|
432
|
|
433 (defun hm--html-add-small ()
|
|
434 "Adds the HTML tags for Small at the point in the current buffer."
|
|
435 (interactive)
|
|
436 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
437 "<SMALL>"
|
|
438 'hm--html-insert-end-tag
|
|
439 "</SMALL>"))
|
|
440
|
|
441
|
|
442 (defun hm--html-add-small-to-region ()
|
|
443 "Adds the HTML tags for Small to the region."
|
|
444 (interactive)
|
|
445 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
446 "<SMALL>"
|
|
447 'hm--html-insert-end-tag
|
|
448 "</SMALL>"))
|
|
449
|
|
450
|
0
|
451 (defun hm--html-add-bold ()
|
|
452 "Adds the HTML tags for Bold at the point in the current buffer."
|
|
453 (interactive)
|
|
454 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
455 "<B>"
|
|
456 'hm--html-insert-end-tag
|
|
457 "</B>"))
|
|
458
|
|
459
|
|
460 (defun hm--html-add-bold-to-region ()
|
|
461 "Adds the HTML tags for Bold to the region."
|
|
462 (interactive)
|
|
463 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
464 "<B>"
|
|
465 'hm--html-insert-end-tag
|
|
466 "</B>"))
|
|
467
|
|
468
|
|
469 (defun hm--html-add-italic ()
|
|
470 "Adds the HTML tags for Italic at the point in the current buffer."
|
|
471 (interactive)
|
|
472 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
473 "<I>"
|
|
474 'hm--html-insert-end-tag
|
|
475 "</I>"))
|
|
476
|
|
477
|
|
478 (defun hm--html-add-italic-to-region ()
|
|
479 "Adds the HTML tags for Italic to the region."
|
|
480 (interactive)
|
|
481 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
482 "<I>"
|
|
483 'hm--html-insert-end-tag
|
|
484 "</I>"))
|
|
485
|
|
486
|
|
487 (defun hm--html-add-underline ()
|
|
488 "Adds the HTML tags for Underline at the point in the current buffer."
|
|
489 (interactive)
|
|
490 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
491 "<U>"
|
|
492 'hm--html-insert-end-tag
|
|
493 "</U>"))
|
|
494
|
|
495
|
|
496 (defun hm--html-add-underline-to-region ()
|
|
497 "Adds the HTML tags for Underline to the region."
|
|
498 (interactive)
|
|
499 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
500 "<U>"
|
|
501 'hm--html-insert-end-tag
|
|
502 "</U>"))
|
|
503
|
|
504
|
|
505 (defun hm--html-add-definition ()
|
|
506 "Adds the HTML tags for Definition at the point in the current buffer."
|
|
507 (interactive)
|
|
508 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
509 "<DFN>"
|
|
510 'hm--html-insert-end-tag
|
|
511 "</DFN>"))
|
|
512
|
|
513
|
|
514 (defun hm--html-add-definition-to-region ()
|
|
515 "Adds the HTML tags for Definition to the region."
|
|
516 (interactive)
|
|
517 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
518 "<DFN>"
|
|
519 'hm--html-insert-end-tag
|
|
520 "</DFN>"))
|
|
521
|
|
522
|
|
523 (defun hm--html-add-code ()
|
|
524 "Adds the HTML tags for Code at the point in the current buffer."
|
|
525 (interactive)
|
|
526 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
527 "<CODE>"
|
|
528 'hm--html-insert-end-tag
|
|
529 "</CODE>"))
|
|
530
|
|
531
|
|
532 (defun hm--html-add-code-to-region ()
|
|
533 "Adds the HTML tags for Code to the region."
|
|
534 (interactive)
|
|
535 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
536 "<CODE>"
|
|
537 'hm--html-insert-end-tag
|
|
538 "</CODE>"))
|
|
539
|
|
540
|
2
|
541 (defun hm--html-add-citation ()
|
|
542 "Adds the HTML tags for Citation."
|
|
543 (interactive)
|
|
544 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
545 "<CITE>"
|
|
546 'hm--html-insert-end-tag
|
|
547 "</CITE>"))
|
|
548
|
0
|
549 (defun hm--html-add-citation-to-region ()
|
|
550 "Adds the HTML tags for Citation to the region."
|
|
551 (interactive)
|
|
552 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
553 "<CITE>"
|
|
554 'hm--html-insert-end-tag
|
|
555 "</CITE>"))
|
|
556
|
|
557
|
2
|
558 (defun hm--html-add-emphasized ()
|
|
559 "Adds the HTML tags for Emphasized."
|
|
560 (interactive)
|
|
561 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
562 "<EM>"
|
|
563 'hm--html-insert-end-tag
|
|
564 "</EM>"))
|
|
565
|
|
566
|
0
|
567 (defun hm--html-add-emphasized-to-region ()
|
|
568 "Adds the HTML tags for Emphasized to the region."
|
|
569 (interactive)
|
|
570 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
571 "<EM>"
|
|
572 'hm--html-insert-end-tag
|
|
573 "</EM>"))
|
|
574
|
|
575
|
2
|
576 (defun hm--html-add-fixed ()
|
|
577 "Adds the HTML tags for Fixed."
|
|
578 (interactive)
|
|
579 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
580 "<TT>"
|
|
581 'hm--html-insert-end-tag
|
|
582 "</TT>"))
|
|
583
|
|
584
|
0
|
585 (defun hm--html-add-fixed-to-region ()
|
|
586 "Adds the HTML tags for Fixed to the region."
|
|
587 (interactive)
|
|
588 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
589 "<TT>"
|
|
590 'hm--html-insert-end-tag
|
|
591 "</TT>"))
|
|
592
|
|
593
|
2
|
594 (defun hm--html-add-keyboard ()
|
|
595 "Adds the HTML tags for Keyboard."
|
|
596 (interactive)
|
|
597 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
598 "<KBD>"
|
|
599 'hm--html-insert-end-tag
|
|
600 "</KBD>"))
|
|
601
|
|
602
|
0
|
603 (defun hm--html-add-keyboard-to-region ()
|
|
604 "Adds the HTML tags for Keyboard to the region."
|
|
605 (interactive)
|
|
606 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
607 "<KBD>"
|
|
608 'hm--html-insert-end-tag
|
|
609 "</KBD>"))
|
|
610
|
|
611
|
2
|
612 (defun hm--html-add-sample ()
|
|
613 "Adds the HTML tags for Sample."
|
|
614 (interactive)
|
|
615 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
616 "<SAMP>"
|
|
617 'hm--html-insert-end-tag
|
|
618 "</SAMP>"))
|
|
619
|
0
|
620 (defun hm--html-add-sample-to-region ()
|
|
621 "Adds the HTML tags for Sample to the region."
|
|
622 (interactive)
|
|
623 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
624 "<SAMP>"
|
|
625 'hm--html-insert-end-tag
|
|
626 "</SAMP>"))
|
|
627
|
|
628
|
2
|
629 (defun hm--html-add-strong ()
|
|
630 "Adds the HTML tags for Strong."
|
|
631 (interactive)
|
|
632 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
633 "<STRONG>"
|
|
634 'hm--html-insert-end-tag
|
|
635 "</STRONG>"))
|
|
636
|
|
637
|
0
|
638 (defun hm--html-add-strong-to-region ()
|
|
639 "Adds the HTML tags for Strong to the region."
|
|
640 (interactive)
|
|
641 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
642 "<STRONG>"
|
|
643 'hm--html-insert-end-tag
|
|
644 "</STRONG>"))
|
|
645
|
|
646
|
2
|
647 (defun hm--html-add-variable ()
|
|
648 "Adds the HTML tags for Variable."
|
|
649 (interactive)
|
|
650 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
651 "<VAR>"
|
|
652 'hm--html-insert-end-tag
|
|
653 "</VAR>"))
|
|
654
|
0
|
655 (defun hm--html-add-variable-to-region ()
|
|
656 "Adds the HTML tags for Variable to the region."
|
|
657 (interactive)
|
|
658 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
659 "<VAR>"
|
|
660 'hm--html-insert-end-tag
|
|
661 "</VAR>"))
|
|
662
|
|
663
|
|
664 (defun hm--html-add-comment ()
|
|
665 "Adds the HTML tags for Comment at the point in the current buffer."
|
|
666 (interactive)
|
|
667 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
668 "<!-- "
|
|
669 'hm--html-insert-end-tag
|
|
670 " -->"))
|
|
671
|
|
672
|
|
673 (defun hm--html-add-comment-to-region ()
|
|
674 "Adds the HTML tags for Comment to the region."
|
|
675 (interactive)
|
|
676 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
677 "<!-- "
|
|
678 'hm--html-insert-end-tag
|
|
679 " -->"))
|
|
680
|
|
681
|
|
682
|
|
683 (defun hm--html-add-preformated ()
|
|
684 "Adds the HTML tags for preformated text at the point in the current buffer."
|
|
685 (interactive)
|
|
686 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
687 "<PRE>"
|
|
688 'hm--html-insert-end-tag-with-newline
|
|
689 "</PRE>"))
|
|
690
|
|
691
|
|
692 (defun hm--html-add-preformated-to-region ()
|
|
693 "Adds the HTML tags for preformated text to the region."
|
|
694 (interactive)
|
|
695 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
696 "<PRE>"
|
|
697 'hm--html-insert-end-tag-with-newline
|
|
698 "</PRE>"))
|
|
699
|
|
700
|
2
|
701 (defun hm--html-add-plaintext ()
|
|
702 "Adds the HTML tags for plaintext."
|
|
703 (interactive)
|
|
704 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
705 "<XMP>"
|
|
706 'hm--html-insert-end-tag-with-newline
|
|
707 "</XMP>"))
|
|
708
|
|
709
|
0
|
710 (defun hm--html-add-plaintext-to-region ()
|
|
711 "Adds the HTML tags for plaintext to the region."
|
|
712 (interactive)
|
|
713 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
714 "<XMP>"
|
|
715 'hm--html-insert-end-tag-with-newline
|
|
716 "</XMP>"))
|
|
717
|
|
718
|
2
|
719 (defun hm--html-add-blockquote ()
|
|
720 "Adds the HTML tags for blockquote."
|
|
721 (interactive)
|
|
722 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
723 "<BLOCKQUOTE>"
|
|
724 'hm--html-insert-end-tag-with-newline
|
|
725 "</BLOCKQUOTE>"))
|
|
726
|
|
727
|
0
|
728 (defun hm--html-add-blockquote-to-region ()
|
|
729 "Adds the HTML tags for blockquote to the region."
|
|
730 (interactive)
|
|
731 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
732 "<BLOCKQUOTE>"
|
|
733 'hm--html-insert-end-tag-with-newline
|
|
734 "</BLOCKQUOTE>"))
|
|
735
|
|
736 (defun hm--html-add-abstract ()
|
|
737 "Adds the HTML tags for abstract text at the point in the current buffer."
|
|
738 (interactive)
|
|
739 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
740 "<ABSTRACT>"
|
|
741 'hm--html-insert-end-tag-with-newline
|
|
742 "</ABSTRACT>"))
|
|
743
|
|
744
|
|
745 (defun hm--html-add-abstract-to-region ()
|
|
746 "Adds the HTML tags for abstract text to the region."
|
|
747 (interactive)
|
|
748 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
749 "<ABSTRACT>"
|
|
750 'hm--html-insert-end-tag-with-newline
|
|
751 "</ABSTRACT>"))
|
|
752
|
|
753
|
|
754
|
|
755 (defun hm--html-add-strikethru ()
|
|
756 "Adds the HTML tags for Strikethru at the point in the current buffer."
|
|
757 (interactive)
|
|
758 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
759 "<S>"
|
|
760 'hm--html-insert-end-tag
|
|
761 "</S>"))
|
|
762
|
|
763
|
|
764 (defun hm--html-add-strikethru-to-region ()
|
|
765 "Adds the HTML tags for Strikethru to the region."
|
|
766 (interactive)
|
|
767 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
768 "<S>"
|
|
769 'hm--html-insert-end-tag
|
|
770 "</S>"))
|
|
771
|
|
772
|
|
773 (defun hm--html-add-superscript ()
|
|
774 "Adds the HTML tags for Superscript at the point in the current buffer."
|
|
775 (interactive)
|
|
776 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
777 "<SUP>"
|
|
778 'hm--html-insert-end-tag
|
|
779 "</SUP>"))
|
|
780
|
|
781
|
|
782 (defun hm--html-add-superscript-to-region ()
|
|
783 "Adds the HTML tags for Superscript to the region."
|
|
784 (interactive)
|
|
785 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
786 "<SUP>"
|
|
787 'hm--html-insert-end-tag
|
|
788 "</SUP>"))
|
|
789
|
|
790
|
|
791 (defun hm--html-add-subscript ()
|
|
792 "Adds the HTML tags for Subscript at the point in the current buffer."
|
|
793 (interactive)
|
|
794 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
795 "<SUB>"
|
|
796 'hm--html-insert-end-tag
|
|
797 "</SUB>"))
|
|
798
|
|
799
|
|
800 (defun hm--html-add-subscript-to-region ()
|
|
801 "Adds the HTML tags for Subscript to the region."
|
|
802 (interactive)
|
|
803 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
804 "<SUB>"
|
|
805 'hm--html-insert-end-tag
|
|
806 "</SUB>"))
|
|
807
|
|
808
|
|
809 (defun hm--html-add-quote ()
|
|
810 "Adds the HTML tags for Quote at the point in the current buffer."
|
|
811 (interactive)
|
|
812 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
813 "<Q>"
|
|
814 'hm--html-insert-end-tag
|
|
815 "</Q>"))
|
|
816
|
|
817
|
|
818 (defun hm--html-add-quote-to-region ()
|
|
819 "Adds the HTML tags for Quote to the region."
|
|
820 (interactive)
|
|
821 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
822 "<Q>"
|
|
823 'hm--html-insert-end-tag
|
|
824 "</Q>"))
|
|
825
|
|
826
|
|
827 (defun hm--html-add-person ()
|
|
828 "Adds the HTML tags for Person at the point in the current buffer."
|
|
829 (interactive)
|
|
830 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
831 "<PERSON>"
|
|
832 'hm--html-insert-end-tag
|
|
833 "</PERSON>"))
|
|
834
|
|
835
|
|
836 (defun hm--html-add-person-to-region ()
|
|
837 "Adds the HTML tags for Person to the region."
|
|
838 (interactive)
|
|
839 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
840 "<PERSON>"
|
|
841 'hm--html-insert-end-tag
|
|
842 "</PERSON>"))
|
|
843
|
|
844
|
|
845 (defun hm--html-add-instance ()
|
|
846 "Adds the HTML tags for Instance at the point in the current buffer."
|
|
847 (interactive)
|
|
848 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
849 "<INS>"
|
|
850 'hm--html-insert-end-tag
|
|
851 "</INS>"))
|
|
852
|
|
853
|
|
854 (defun hm--html-add-instance-to-region ()
|
|
855 "Adds the HTML tags for Instance to the region."
|
|
856 (interactive)
|
|
857 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
858 "<INS>"
|
|
859 'hm--html-insert-end-tag
|
|
860 "</INS>"))
|
|
861
|
|
862
|
|
863 (defun hm--html-add-option ()
|
|
864 "Adds the HTML tags for Option at the point in the current buffer."
|
|
865 (interactive)
|
|
866 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
867 "<OPT>"
|
|
868 'hm--html-insert-end-tag
|
|
869 "</OPT>"))
|
|
870
|
|
871
|
|
872 (defun hm--html-add-option-to-region ()
|
|
873 "Adds the HTML tags for Option to the region."
|
|
874 (interactive)
|
|
875 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
876 "<OPT>"
|
|
877 'hm--html-insert-end-tag
|
|
878 "</OPT>"))
|
|
879
|
|
880
|
|
881 (defun hm--html-add-publication ()
|
|
882 "Adds the HTML tags for Publication at the point in the current buffer."
|
|
883 (interactive)
|
|
884 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
885 "<PUB>"
|
|
886 'hm--html-insert-end-tag
|
|
887 "</PUB>"))
|
|
888
|
|
889
|
|
890 (defun hm--html-add-publication-to-region ()
|
|
891 "Adds the HTML tags for Publication to the region."
|
|
892 (interactive)
|
|
893 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
894 "<PUB>"
|
|
895 'hm--html-insert-end-tag
|
|
896 "</PUB>"))
|
|
897
|
|
898
|
|
899 (defun hm--html-add-author ()
|
|
900 "Adds the HTML tags for Author at the point in the current buffer."
|
|
901 (interactive)
|
|
902 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
903 "<AUTHOR>"
|
|
904 'hm--html-insert-end-tag
|
|
905 "</AUTHOR>"))
|
|
906
|
|
907
|
|
908 (defun hm--html-add-author-to-region ()
|
|
909 "Adds the HTML tags for Author to the region."
|
|
910 (interactive)
|
|
911 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
912 "<AUTHOR>"
|
|
913 'hm--html-insert-end-tag
|
|
914 "</AUTHOR>"))
|
|
915
|
|
916
|
|
917 (defun hm--html-add-editor ()
|
|
918 "Adds the HTML tags for Editor at the point in the current buffer."
|
|
919 (interactive)
|
|
920 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
921 "<EDITOR>"
|
|
922 'hm--html-insert-end-tag
|
|
923 "</EDITOR>"))
|
|
924
|
|
925
|
|
926 (defun hm--html-add-editor-to-region ()
|
|
927 "Adds the HTML tags for Editor to the region."
|
|
928 (interactive)
|
|
929 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
930 "<EDITOR>"
|
|
931 'hm--html-insert-end-tag
|
|
932 "</EDITOR>"))
|
|
933
|
|
934
|
|
935 (defun hm--html-add-credits ()
|
|
936 "Adds the HTML tags for Credits at the point in the current buffer."
|
|
937 (interactive)
|
|
938 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
939 "<CREDITS>"
|
|
940 'hm--html-insert-end-tag
|
|
941 "</CREDITS>"))
|
|
942
|
|
943
|
|
944 (defun hm--html-add-credits-to-region ()
|
|
945 "Adds the HTML tags for Credits to the region."
|
|
946 (interactive)
|
|
947 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
948 "<CREDITS>"
|
|
949 'hm--html-insert-end-tag
|
|
950 "</CREDITS>"))
|
|
951
|
|
952
|
|
953 (defun hm--html-add-copyright ()
|
|
954 "Adds the HTML tags for Copyright at the point in the current buffer."
|
|
955 (interactive)
|
|
956 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
957 "<COPYRIGHT>"
|
|
958 'hm--html-insert-end-tag
|
|
959 "</COPYRIGHT>"))
|
|
960
|
|
961
|
|
962 (defun hm--html-add-copyright-to-region ()
|
|
963 "Adds the HTML tags for Copyright to the region."
|
|
964 (interactive)
|
|
965 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
966 "<COPYRIGHT>"
|
|
967 'hm--html-insert-end-tag
|
|
968 "</COPYRIGHT>"))
|
|
969
|
|
970
|
|
971 (defun hm--html-add-isbn ()
|
|
972 "Adds the HTML tags for ISBN at the point in the current buffer."
|
|
973 (interactive)
|
|
974 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
975 "<ISBN>"
|
|
976 'hm--html-insert-end-tag
|
|
977 "</ISBN>"))
|
|
978
|
|
979
|
|
980 (defun hm--html-add-isbn-to-region ()
|
|
981 "Adds the HTML tags for ISBN to the region."
|
|
982 (interactive)
|
|
983 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
984 "<ISBN>"
|
|
985 'hm--html-insert-end-tag
|
|
986 "</ISBN>"))
|
|
987
|
|
988
|
|
989 (defun hm--html-add-acronym ()
|
|
990 "Adds the HTML tags for Acronym at the point in the current buffer."
|
|
991 (interactive)
|
|
992 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
993 "<ACRONYM>"
|
|
994 'hm--html-insert-end-tag
|
|
995 "</ACRONYM>"))
|
|
996
|
|
997
|
|
998 (defun hm--html-add-acronym-to-region ()
|
|
999 "Adds the HTML tags for Acronym to the region."
|
|
1000 (interactive)
|
|
1001 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1002 "<ACRONYM>"
|
|
1003 'hm--html-insert-end-tag
|
|
1004 "</ACRONYM>"))
|
|
1005
|
|
1006
|
|
1007 (defun hm--html-add-abbrevation ()
|
|
1008 "Adds the HTML tags for Abbrevation at the point in the current buffer."
|
|
1009 (interactive)
|
|
1010 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1011 "<ABBREV>"
|
|
1012 'hm--html-insert-end-tag
|
|
1013 "</ABBREV>"))
|
|
1014
|
|
1015
|
|
1016 (defun hm--html-add-abbrev-to-region ()
|
|
1017 "Adds the HTML tags for Abbrev to the region."
|
|
1018 (interactive)
|
|
1019 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1020 "<ABBREV>"
|
|
1021 'hm--html-insert-end-tag
|
|
1022 "</ABBREV>"))
|
|
1023
|
|
1024
|
|
1025 (defun hm--html-add-command ()
|
|
1026 "Adds the HTML tags for Command at the point in the current buffer."
|
|
1027 (interactive)
|
|
1028 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1029 "<CMD>"
|
|
1030 'hm--html-insert-end-tag
|
|
1031 "</CMD>"))
|
|
1032
|
|
1033
|
|
1034 (defun hm--html-add-command-to-region ()
|
|
1035 "Adds the HTML tags for Command to the region."
|
|
1036 (interactive)
|
|
1037 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1038 "<CMD>"
|
|
1039 'hm--html-insert-end-tag
|
|
1040 "</CMD>"))
|
|
1041
|
|
1042
|
|
1043 (defun hm--html-add-argument ()
|
|
1044 "Adds the HTML tags for Argument at the point in the current buffer."
|
|
1045 (interactive)
|
|
1046 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1047 "<ARG>"
|
|
1048 'hm--html-insert-end-tag
|
|
1049 "</ARG>"))
|
|
1050
|
|
1051
|
|
1052 (defun hm--html-add-argument-to-region ()
|
|
1053 "Adds the HTML tags for Argument to the region."
|
|
1054 (interactive)
|
|
1055 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1056 "<ARG>"
|
|
1057 'hm--html-insert-end-tag
|
|
1058 "</ARG>"))
|
|
1059
|
|
1060
|
|
1061 (defun hm--html-add-literature ()
|
|
1062 "Adds the HTML tags for Literature at the point in the current buffer."
|
|
1063 (interactive)
|
|
1064 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1065 "<LIT>"
|
|
1066 'hm--html-insert-end-tag
|
|
1067 "</LIT>"))
|
|
1068
|
|
1069
|
|
1070 (defun hm--html-add-literature-to-region ()
|
|
1071 "Adds the HTML tags for Literature to the region."
|
|
1072 (interactive)
|
|
1073 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1074 "<LIT>"
|
|
1075 'hm--html-insert-end-tag
|
|
1076 "</LIT>"))
|
|
1077
|
|
1078
|
|
1079 (defun hm--html-add-footnote ()
|
|
1080 "Adds the HTML tags for Footnote at the point in the current buffer."
|
|
1081 (interactive)
|
|
1082 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1083 "<FOOTNOTE>"
|
|
1084 'hm--html-insert-end-tag
|
|
1085 "</FOOTNOTE>"))
|
|
1086
|
|
1087
|
|
1088 (defun hm--html-add-footnote-to-region ()
|
|
1089 "Adds the HTML tags for Footnote to the region."
|
|
1090 (interactive)
|
|
1091 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1092 "<FOOTNOTE>"
|
|
1093 'hm--html-insert-end-tag
|
|
1094 "</FOOTNOTE>"))
|
|
1095
|
|
1096
|
|
1097 (defun hm--html-add-margin ()
|
|
1098 "Adds the HTML tags for Margin at the point in the current buffer."
|
|
1099 (interactive)
|
|
1100 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1101 "<MARGIN>"
|
|
1102 'hm--html-insert-end-tag
|
|
1103 "</MARGIN>"))
|
|
1104
|
|
1105
|
|
1106 (defun hm--html-add-margin-to-region ()
|
|
1107 "Adds the HTML tags for Margin to the region."
|
|
1108 (interactive)
|
|
1109 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1110 "<MARGIN>"
|
|
1111 'hm--html-insert-end-tag
|
|
1112 "</MARGIN>"))
|
|
1113
|
|
1114
|
|
1115
|
|
1116
|
|
1117
|
|
1118 ;;; Lists
|
|
1119
|
|
1120
|
2
|
1121 (defun hm--html-add-listing ()
|
|
1122 "Adds the HTML tags for listing."
|
|
1123 (interactive)
|
|
1124 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1125 "<LISTING>"
|
|
1126 'hm--html-insert-end-tag-with-newline
|
|
1127 "</LISTING>"))
|
|
1128
|
|
1129
|
0
|
1130 (defun hm--html-add-listing-to-region ()
|
|
1131 "Adds the HTML tags for listing to the region."
|
|
1132 (interactive)
|
|
1133 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1134 "<LISTING>"
|
|
1135 'hm--html-insert-end-tag-with-newline
|
|
1136 "</LISTING>"))
|
|
1137
|
2
|
1138 (defun hm--html-add-center ()
|
|
1139 "Adds the HTML tags for center at the current point."
|
|
1140 (interactive)
|
|
1141 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1142 "<CENTER>"
|
|
1143 'hm--html-insert-end-tag-with-newline
|
|
1144 "</CENTER>"))
|
|
1145
|
|
1146 (defun hm--html-add-center-to-region ()
|
|
1147 "Adds the HTML tags for center to the region."
|
|
1148 (interactive)
|
|
1149 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1150 "<CENTER>"
|
|
1151 'hm--html-insert-end-tag-with-newline
|
|
1152 "</CENTER>"))
|
0
|
1153
|
|
1154 (defun hm--html-add-numberlist ()
|
|
1155 "Adds the HTML tags for a numbered list at the point in the current buffer."
|
|
1156 (interactive)
|
|
1157 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1158 "<OL>"
|
|
1159 'hm--html-insert-end-tag-with-newline
|
|
1160 "</OL>"
|
|
1161 'hm--html-insert-start-tag
|
22
|
1162 "<LI> "
|
|
1163 'hm--html-insert-end-tag
|
|
1164 " </LI>"))
|
0
|
1165
|
|
1166 (defun hm--html-add-numberlist-to-region ()
|
|
1167 "Adds the HTML tags for a numbered list to the region."
|
|
1168 (interactive)
|
|
1169 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1170 "<OL>"
|
|
1171 'hm--html-insert-end-tag-with-newline
|
22
|
1172 "</OL>"))
|
|
1173 ; 'hm--html-insert-start-tag
|
|
1174 ; "<LI> "))
|
0
|
1175
|
|
1176
|
|
1177 (defun hm--html-add-directory-list ()
|
|
1178 "Adds the HTML tags for a directory list at the point in the current buffer."
|
|
1179 (interactive)
|
|
1180 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1181 "<DIR>"
|
|
1182 'hm--html-insert-end-tag-with-newline
|
|
1183 "</DIR>"
|
|
1184 'hm--html-insert-start-tag
|
22
|
1185 "<LI> "
|
|
1186 'hm--html-insert-end-tag
|
|
1187 " </LI>"))
|
0
|
1188
|
|
1189 (defun hm--html-add-directorylist-to-region ()
|
|
1190 "Adds the HTML tags for a directory list to the region."
|
|
1191 (interactive)
|
|
1192 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1193 "<DIR>"
|
|
1194 'hm--html-insert-end-tag-with-newline
|
22
|
1195 "</DIR>"))
|
|
1196 ; 'hm--html-insert-start-tag
|
|
1197 ; "<LI> "))
|
0
|
1198
|
|
1199
|
2
|
1200 (defun hm--html-add-list ()
|
|
1201 "Adds the HTML tags for a (unnumbered) list to the region."
|
|
1202 (interactive)
|
|
1203 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1204 "<UL>"
|
|
1205 'hm--html-insert-end-tag-with-newline
|
|
1206 "</UL>"
|
|
1207 'hm--html-insert-start-tag
|
22
|
1208 "<LI> "
|
|
1209 'hm--html-insert-end-tag
|
|
1210 " </LI>"))
|
2
|
1211
|
|
1212
|
0
|
1213 (defun hm--html-add-list-to-region ()
|
|
1214 "Adds the HTML tags for a (unnumbered) list to the region."
|
|
1215 (interactive)
|
|
1216 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1217 "<UL>"
|
|
1218 'hm--html-insert-end-tag-with-newline
|
22
|
1219 "</UL>"))
|
|
1220 ; 'hm--html-insert-start-tag
|
|
1221 ; "<LI> "))
|
|
1222
|
|
1223
|
|
1224 ;(defun hm--html-add-menu ()
|
|
1225 ; "Adds the HTML tags for a menu."
|
|
1226 ; (interactive)
|
|
1227 ; (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1228 ; "<MENU>"
|
|
1229 ; 'hm--html-insert-end-tag-with-newline
|
|
1230 ; "</MENU>"
|
|
1231 ; 'hm--html-insert-start-tag
|
|
1232 ; "<LI> "))
|
2
|
1233
|
|
1234
|
|
1235 (defun hm--html-add-menu ()
|
|
1236 "Adds the HTML tags for a menu."
|
|
1237 (interactive)
|
|
1238 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1239 "<MENU>"
|
|
1240 'hm--html-insert-end-tag-with-newline
|
|
1241 "</MENU>"
|
|
1242 'hm--html-insert-start-tag
|
|
1243 "<LI> "
|
|
1244 'hm--html-insert-end-tag
|
|
1245 " </LI>"))
|
|
1246
|
|
1247
|
0
|
1248 (defun hm--html-add-menu-to-region ()
|
|
1249 "Adds the HTML tags for a menu to the region."
|
|
1250 (interactive)
|
|
1251 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1252 "<MENU>"
|
|
1253 'hm--html-insert-end-tag-with-newline
|
2
|
1254 "</MENU>"))
|
|
1255
|
|
1256 ; 'hm--html-insert-start-tag
|
|
1257 ; "<LI> "))
|
|
1258
|
|
1259
|
|
1260 (defun hm--html-add-description-title-and-entry ()
|
|
1261 "Adds a definition title and entry.
|
|
1262 Assumes we're at the end of a previous entry."
|
|
1263 (interactive)
|
|
1264 (hm--html-add-description-title)
|
22
|
1265 (let ((position (point))
|
|
1266 (case-fold-search t))
|
|
1267 (search-forward "</dt>")
|
|
1268 (hm--html-add-description-entry)
|
2
|
1269 (goto-char position)))
|
|
1270
|
|
1271
|
|
1272 (defun hm--html-add-description-list ()
|
|
1273 "Adds the HTML tags for a description list.
|
|
1274 It also inserts a tag for the description title."
|
|
1275 (interactive)
|
|
1276 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1277 "<DL>"
|
|
1278 'hm--html-insert-end-tag-with-newline
|
|
1279 "</DL>"
|
|
1280 'hm--html-insert-start-tag
|
|
1281 "<DT> "
|
|
1282 'hm--html-insert-end-tag
|
|
1283 " </DT>"))
|
|
1284
|
0
|
1285
|
|
1286 (defun hm--html-add-description-list-to-region ()
|
|
1287 "Adds the HTML tags for a description list to a region.
|
|
1288 It also inserts a tag for the description title."
|
|
1289 (interactive)
|
|
1290 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1291 "<DL>"
|
|
1292 'hm--html-insert-end-tag-with-newline
|
2
|
1293 "</DL>"))
|
|
1294
|
|
1295 ; 'hm--html-insert-start-tag
|
|
1296 ; "<DT> "))
|
0
|
1297
|
|
1298
|
|
1299 (defun hm--html-add-description-title ()
|
2
|
1300 "Adds the HTML tags for a description title at current point in the buffer."
|
|
1301 (interactive)
|
|
1302 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline
|
|
1303 "<DT> "
|
|
1304 'hm--html-insert-end-tag
|
|
1305 " </DT>"))
|
|
1306
|
|
1307
|
|
1308 (defun hm--html-add-description-title-to-region ()
|
|
1309 "Adds the HTML tags for a description title to the region in the buffer."
|
|
1310 (interactive)
|
|
1311 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1312 "<DT> "
|
|
1313 'hm--html-insert-end-tag
|
|
1314 " </DT>"))
|
|
1315
|
|
1316
|
|
1317 (defun hm--html-add-description-entry ()
|
|
1318 "Adds the HTML tags for a description entry at current point in the buffer."
|
0
|
1319 (interactive)
|
|
1320 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline
|
2
|
1321 "<DD> "
|
|
1322 'hm--html-insert-end-tag
|
|
1323 " </DD>"))
|
|
1324
|
|
1325
|
|
1326 (defun hm--html-add-description-entry-to-region ()
|
|
1327 "Adds the HTML tags for a description entry to the region in the buffer."
|
0
|
1328 (interactive)
|
2
|
1329 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1330 "<DD> "
|
|
1331 'hm--html-insert-end-tag
|
|
1332 " </DD>"))
|
|
1333
|
|
1334
|
|
1335 (defun hm--html-add-address ()
|
|
1336 "Adds the HTML tags for an address."
|
|
1337 (interactive)
|
|
1338 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1339 "<ADDRESS>"
|
|
1340 'hm--html-insert-end-tag
|
|
1341 "</ADDRESS>"))
|
0
|
1342
|
|
1343 (defun hm--html-add-address-to-region ()
|
|
1344 "Adds the HTML tags for an address to the region"
|
|
1345 (interactive)
|
|
1346 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
2
|
1347 "<ADDRESS>"
|
0
|
1348 'hm--html-insert-end-tag
|
2
|
1349 "</ADDRESS>"))
|
0
|
1350
|
|
1351
|
|
1352 (defvar hm--html-signature-reference-name "Signature"
|
|
1353 "The signature reference name.")
|
|
1354
|
|
1355
|
|
1356 (defun hm--html-make-signature-link-string (signature-file-name)
|
|
1357 "Returns a string which is a link to a signature file."
|
|
1358 (concat
|
|
1359 "<A Name="
|
|
1360 hm--html-signature-reference-name
|
|
1361 " HREF=\""
|
|
1362 signature-file-name
|
|
1363 "\">"))
|
|
1364
|
|
1365
|
|
1366 (defun hm--html-delete-old-signature ()
|
|
1367 "Searches for the old signature and deletes it, if the user want it"
|
|
1368 (save-excursion
|
|
1369 (goto-char (point-min))
|
22
|
1370 (let ((case-fold-search t))
|
|
1371 (if (search-forward (concat "<address> "
|
|
1372 "<a name="
|
|
1373 hm--html-signature-reference-name
|
|
1374 " href=\"")
|
|
1375 nil
|
|
1376 t)
|
|
1377 (let ((signature-start (match-beginning 0))
|
|
1378 (signature-end (progn
|
|
1379 (search-forward "</address>" nil t)
|
|
1380 (point))))
|
|
1381 (if (yes-or-no-p "Delete the old signature (yes or no) ?")
|
|
1382 (delete-region signature-start signature-end)))))))
|
0
|
1383
|
|
1384
|
|
1385 (defun hm--html-set-point-for-signature ()
|
|
1386 "Searches and sets the point for inserting the signature.
|
|
1387 It searches from the end to the beginning of the file. At first it
|
|
1388 tries to use the point before the </body> tag then the point before
|
|
1389 the </html> tag and the the end of the file."
|
|
1390 (goto-char (point-max))
|
22
|
1391 (let ((case-fold-search t))
|
|
1392 (cond ((search-backward "</body>" nil t)
|
|
1393 (end-of-line 0)
|
|
1394 (if (> (current-column) 0)
|
|
1395 (newline 2)))
|
|
1396 ((search-backward "</html>" nil t)
|
|
1397 (end-of-line 0)
|
|
1398 (if (> (current-column) 0)
|
|
1399 (newline 2)))
|
|
1400 ((> (current-column) 0)
|
|
1401 (newline 2))
|
|
1402 (t))))
|
0
|
1403
|
|
1404
|
|
1405 (defun hm--html-add-signature ()
|
|
1406 "Adds the owner's signature at the end of the buffer."
|
|
1407 (interactive)
|
|
1408 (if hm--html-signature-file
|
|
1409 (progn
|
|
1410 (if (not hm--html-username)
|
|
1411 (setq hm--html-username (user-full-name)))
|
|
1412 (save-excursion
|
|
1413 (hm--html-delete-old-signature)
|
|
1414 (hm--html-set-point-for-signature)
|
|
1415 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1416 "<ADDRESS> "
|
|
1417 'hm--html-insert-end-tag
|
|
1418 "</A></ADDRESS>"
|
|
1419 'hm--html-insert-start-tag
|
|
1420 (hm--html-make-signature-link-string
|
|
1421 hm--html-signature-file)
|
|
1422 )
|
|
1423 (insert hm--html-username)))
|
|
1424 (error "ERROR: Define your hm--html-signature-file first !")))
|
|
1425
|
|
1426
|
|
1427 (defun hm--html-add-header (size &optional header)
|
|
1428 "Adds the HTML tags for a header at the point in the current buffer."
|
|
1429 (interactive "nSize (1 .. 6; 1 biggest): ")
|
|
1430 (if (or (< size 1) (> size 6))
|
|
1431 (message "The size must be a number from 1 to 6 !")
|
|
1432 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1433 (format "<H%d>" size)
|
|
1434 'hm--html-insert-start-tag-with-newline
|
|
1435 (format "</H%d>" size))
|
|
1436 (if header
|
|
1437 (insert header))))
|
|
1438
|
|
1439
|
|
1440 (defun hm--html-add-header-to-region (size)
|
|
1441 "Adds the HTML tags for a header to the region.
|
|
1442 The parameter 'size' specifies the size of the header."
|
|
1443 (interactive "nSize (1 .. 6; 1 biggest): ")
|
|
1444 (if (or (< size 1) (> size 6))
|
|
1445 (message "The size must be a number from 1 to 6 !")
|
|
1446 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1447 (format "<H%d>" size)
|
|
1448 'hm--html-insert-end-tag
|
|
1449 (format "</H%d>" size))))
|
|
1450
|
|
1451
|
|
1452 (defun hm--html-set-point-for-title ()
|
|
1453 "Searches and sets the point for inserting the HTML element title.
|
|
1454 The functions start at the beginning of the file and searches first
|
|
1455 for the HTML tag <ISINDEX>. If such a tag exists, the point is set to the
|
|
1456 position after the tag. If not, the function next searches for the
|
|
1457 tag <HEAD> and sets the point after the tag, if it exists, or searches for
|
|
1458 the tag <HTML>. If this tag exists, the point is set to the position after
|
|
1459 this tag or the beginning of the file otherwise."
|
|
1460 (goto-char (point-min))
|
22
|
1461 (let ((case-fold-search t))
|
|
1462 (cond ((search-forward-regexp "<isindex>" nil t) (newline))
|
|
1463 ((search-forward-regexp "<head>" nil t) (newline))
|
|
1464 ((search-forward-regexp "<html>" nil t) (newline))
|
|
1465 (t))))
|
0
|
1466
|
|
1467
|
|
1468 (defun hm--html-add-title (title)
|
|
1469 "Adds the HTML tags for a title at the beginning of the buffer."
|
|
1470 (interactive "sTitle: ")
|
|
1471 (save-excursion
|
|
1472 (goto-char (point-min))
|
22
|
1473 (let ((case-fold-search t))
|
|
1474 (if (search-forward "<title>" nil t)
|
|
1475 (let ((point-after-start-tag (point)))
|
|
1476 (if (not (search-forward "</title>" nil t))
|
|
1477 nil
|
|
1478 (goto-char (- (point) 8))
|
|
1479 (delete-backward-char (- (point) point-after-start-tag))
|
|
1480 (let ((start (point)))
|
|
1481 (insert title " (" (hm--date) ")")
|
|
1482 (goto-char start))))
|
|
1483 ;; Noch kein <TITLE> im Buffer vorhanden
|
|
1484 (hm--html-set-point-for-title)
|
|
1485 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1486 "<TITLE>"
|
|
1487 'hm--html-insert-end-tag
|
|
1488 "</TITLE>"
|
|
1489 'insert
|
|
1490 (concat title " (" (hm--date) ")"))
|
|
1491 (forward-char 8)
|
|
1492 (newline 1)
|
|
1493 ))))
|
0
|
1494
|
|
1495
|
|
1496 (defun hm--html-add-title-to-region ()
|
|
1497 "Adds the HTML tags for a title to the region."
|
|
1498 (interactive)
|
22
|
1499 (let ((title (buffer-substring (region-beginning) (region-end)))
|
|
1500 (case-fold-search t))
|
0
|
1501 (save-excursion
|
|
1502 (goto-char (point-min))
|
|
1503 (if (search-forward "<title>" nil t)
|
|
1504 (let ((point-after-start-tag (point)))
|
|
1505 (if (not (search-forward "</title>" nil t))
|
|
1506 nil
|
|
1507 (goto-char (- (point) 8))
|
|
1508 (delete-backward-char (- (point) point-after-start-tag))
|
|
1509 (insert title " (" (hm--date) ")")))
|
|
1510 ;; Noch kein <TITLE> im Buffer vorhanden
|
|
1511 (hm--html-set-point-for-title)
|
|
1512 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1513 "<TITLE>"
|
|
1514 'hm--html-insert-end-tag
|
|
1515 "</TITLE>"
|
|
1516 'insert
|
|
1517 (concat title " (" (hm--date) ")"))
|
|
1518 (forward-char 8)
|
|
1519 ;(newline 1)
|
|
1520 ))))
|
|
1521
|
|
1522
|
|
1523 (defun hm--html-add-html ()
|
|
1524 "Adds the HTML tags <HTML> and </HTML> in the buffer.
|
|
1525 The tag <HTML> will be inserted at the beginning and </HTML> at the
|
|
1526 end of the file."
|
|
1527 (interactive)
|
22
|
1528 (let ((new-cursor-position nil)
|
|
1529 (case-fold-search t))
|
0
|
1530 (save-excursion
|
|
1531 (goto-char (point-min))
|
|
1532 (if (search-forward "<html>" nil t)
|
|
1533 (error "There is an old tag <HTML> in the current buffer !")
|
|
1534 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline "<HTML>")
|
|
1535 ; (newline 1)
|
|
1536 )
|
|
1537 (setq new-cursor-position (point))
|
|
1538 (goto-char (point-max))
|
|
1539 (if (search-backward "</html>" nil t)
|
|
1540 (error "There is an old tag </HTML> in the current buffer !")
|
|
1541 (newline 1)
|
|
1542 (hm--html-add-tags 'hm--html-insert-end-tag "</HTML>")))
|
|
1543 (goto-char new-cursor-position)))
|
|
1544
|
|
1545
|
|
1546 (defun hm--html-add-head ()
|
|
1547 "Adds the HTML tags <HEAD> and </HEAD> in the buffer.
|
|
1548 The tags will be inserted after <HTML> or at the beginning of the file.
|
|
1549 The function also looks for the tags <BODY> and </TITLE>."
|
|
1550 (interactive)
|
22
|
1551 (let ((case-fold-search t))
|
0
|
1552 (goto-char (point-min))
|
|
1553 (if (search-forward "<html>" nil t)
|
|
1554 (if (search-forward "<head>" nil t)
|
|
1555 (error "There is an old tag <HEAD> in the current buffer !")
|
|
1556 (if (search-forward "</head>" nil t)
|
|
1557 (error "There is an old tag </HEAD> in the current buffer !")
|
|
1558 (newline 1))))
|
|
1559 (let ((start-tag-position (point)))
|
|
1560 (if (search-forward "<body>" nil t)
|
|
1561 (progn
|
|
1562 (forward-line 0)
|
|
1563 (forward-char -1)
|
|
1564 (if (= (point) (point-min))
|
|
1565 (progn
|
|
1566 (newline)
|
|
1567 (forward-line -1)))
|
|
1568 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline
|
|
1569 "</HEAD>")
|
|
1570 (goto-char start-tag-position)
|
|
1571 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1572 "<HEAD>")
|
|
1573 )
|
|
1574 (if (search-forward "</title>" nil t)
|
|
1575 (progn
|
|
1576 (newline 1)
|
|
1577 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline
|
|
1578 "</HEAD>")
|
|
1579 (goto-char start-tag-position)
|
|
1580 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1581 "<HEAD>"))
|
|
1582 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1583 "<HEAD>"
|
|
1584 'hm--html-insert-end-tag-with-newline
|
22
|
1585 "</HEAD>"))))))
|
0
|
1586
|
|
1587
|
|
1588 (defun hm--html-add-head-to-region ()
|
|
1589 "Adds the HTML tags <HEAD> and </HEAD> to the region."
|
|
1590 (interactive)
|
|
1591 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1592 "<HEAD>"
|
|
1593 'hm--html-insert-end-tag-with-newline
|
|
1594 "</HEAD>"))
|
|
1595
|
|
1596
|
|
1597 (defun hm--html-add-body ()
|
|
1598 "Adds the HTML tags <BODY> and </BODY> in the buffer.
|
|
1599 The tags will be inserted before </HTML> or at the end of the file."
|
|
1600 (interactive)
|
22
|
1601 (let ((case-fold-search t))
|
0
|
1602 (goto-char (point-max))
|
|
1603 (if (search-backward "</html>" nil t)
|
|
1604 (progn
|
|
1605 (if (search-backward "</body>" nil t)
|
|
1606 (error "There is an old tag </BODY> in the current buffer !")
|
|
1607 (if (search-backward "<body>" nil t)
|
|
1608 (error "There is an old tag <BODY> in the current buffer !")))
|
|
1609 (forward-char -1)))
|
|
1610 (let ((end-tag-position (point)))
|
|
1611 (if (search-backward "</head>" nil t)
|
|
1612 (progn
|
|
1613 (forward-char 7)
|
|
1614 (newline 1)
|
|
1615 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
1616 "<BODY>")
|
|
1617 (let ((cursor-position (point)))
|
|
1618 (goto-char (+ end-tag-position 8))
|
|
1619 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline
|
|
1620 "</BODY>")
|
|
1621 (goto-char cursor-position)
|
|
1622 ))
|
|
1623 (if (not (= (current-column) 0))
|
|
1624 (newline))
|
|
1625 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline "<BODY>"
|
22
|
1626 'hm--html-insert-end-tag-with-newline "</BODY>")))))
|
0
|
1627
|
|
1628
|
|
1629 (defun hm--html-add-body-to-region ()
|
|
1630 "Adds the HTML tags <BODY> and </BODY> to the region."
|
|
1631 (interactive)
|
|
1632 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
1633 "<BODY>"
|
|
1634 'hm--html-insert-end-tag-with-newline
|
|
1635 "</BODY>"))
|
|
1636
|
|
1637
|
|
1638 (defun hm--html-add-title-and-header (title)
|
|
1639 "Adds the HTML tags for a title and a header in the current buffer."
|
|
1640 ; (interactive "sTitle and Header String: \nnHeader Size (1 .. 6): ")
|
|
1641 ; (if (> size 6)
|
|
1642 ; (message "The size must be a number from 1 to 6 !")
|
|
1643 (interactive "sTitle and Header String: ")
|
22
|
1644 (let ((case-fold-search t))
|
|
1645 (hm--html-add-title title)
|
|
1646 (save-excursion
|
|
1647 (goto-char (point-min))
|
|
1648 (search-forward "</title>" nil t)
|
|
1649 (if (search-forward "</head>" nil t)
|
|
1650 (progn
|
|
1651 (search-forward "<body>" nil t)
|
|
1652 (newline 1))
|
|
1653 (if (search-forward "<body>" nil t)
|
|
1654 (newline 1)
|
|
1655 (if (string= (what-line) "Line 1")
|
|
1656 (progn
|
|
1657 (end-of-line)
|
|
1658 (newline 1)))))
|
|
1659 (hm--html-add-header 1 title))))
|
0
|
1660
|
|
1661
|
|
1662 (defun hm--html-add-title-and-header-to-region ()
|
|
1663 "Adds the HTML tags for a title and a header to the region."
|
|
1664 ;The parameter 'size' spezifies the size of the header.";"
|
|
1665 ; (interactive "nSize (1 .. 6): ")
|
|
1666 ; (if (> size 6)
|
|
1667 ; (message "The size must be a number from 1 to 6 !")
|
|
1668 (interactive)
|
|
1669 (let ((title (buffer-substring (region-beginning) (region-end))))
|
|
1670 (hm--html-add-header-to-region 1)
|
|
1671 (hm--html-add-title title)))
|
|
1672
|
|
1673
|
|
1674 (defun hm--html-add-full-html-frame (title)
|
|
1675 "Adds a full HTML frame to the current buffer.
|
|
1676 The frame consists of the elements html, head, body, title,
|
|
1677 header and the signature. The parameter TITLE specifies the
|
|
1678 title and the header of the document."
|
|
1679 (interactive "sTitle and Header String: ")
|
22
|
1680 (let ((case-fold-search t))
|
|
1681 (hm--html-add-html)
|
|
1682 (hm--html-add-head)
|
|
1683 (hm--html-add-body)
|
|
1684 (hm--html-add-title-and-header title)
|
|
1685 (if hm--html-signature-file
|
|
1686 (hm--html-add-signature))
|
|
1687 (goto-char (point-min))
|
|
1688 (search-forward "</h1>" nil t)
|
|
1689 (forward-line 1)
|
|
1690 (if hm--html-automatic-created-comment
|
|
1691 (hm--html-insert-created-comment))))
|
0
|
1692
|
|
1693
|
|
1694 (defun hm--html-add-full-html-frame-with-region ()
|
|
1695 "Adds a full HTML frame to the current buffer with the use of a region.
|
|
1696 The frame consists of the elements html, head, body, title,
|
|
1697 header and the signature. The function uses the region as
|
|
1698 the string for the title and the header of the document."
|
|
1699 (interactive)
|
|
1700 (hm--html-add-title-and-header-to-region)
|
|
1701 (hm--html-add-html)
|
|
1702 (hm--html-add-head)
|
|
1703 (hm--html-add-body)
|
|
1704 (hm--html-add-signature)
|
|
1705 (if hm--html-automatic-created-comment
|
|
1706 (hm--html-insert-created-comment)))
|
|
1707
|
|
1708
|
2
|
1709 (defun hm--html-add-link-target-to-region (name)
|
|
1710 "Adds the HTML tags for a link target to the region."
|
|
1711 (interactive "sName: ")
|
|
1712 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
1713 (concat "<A NAME=\"" name "\">")
|
|
1714 'hm--html-insert-end-tag
|
|
1715 "</A>"))
|
|
1716
|
0
|
1717 (defun hm--html-add-link-target (name)
|
|
1718 "Adds the HTML tags for a link target at point in the current buffer."
|
|
1719 ; (interactive "sName (or RET for numeric): ")
|
|
1720 (interactive "sName: ")
|
|
1721 ; (and (string= name "")
|
|
1722 ; (progn
|
|
1723 ; (setq html-link-counter (1+ html-link-counter))
|
|
1724 ; (setq name (format "%d" html-link-counter))))
|
|
1725 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
1726 (concat "<A NAME=\"" name "\">")
|
|
1727 'hm--html-insert-end-tag
|
|
1728 "</A>"))
|
|
1729
|
|
1730
|
|
1731 ;;; Functions which add links
|
|
1732
|
|
1733 (defun hm--html-mark-example (parameter-list)
|
|
1734 "Marks the example of the parameterlist in the current buffer.
|
|
1735 It returns the example extent."
|
22
|
1736 (let ((case-fold-search t))
|
|
1737 (if (hm--html-get-example-from-parameter-list parameter-list)
|
|
1738 (progn
|
|
1739 (search-forward (hm--html-get-example-from-parameter-list
|
|
1740 parameter-list))
|
|
1741 (let ((extent (make-extent (match-beginning 0)
|
|
1742 (match-end 0))))
|
|
1743 (set-extent-face extent 'hm--html-help-face)
|
|
1744 extent)))))
|
0
|
1745
|
|
1746
|
|
1747 (defun hm--html-unmark-example (extent)
|
|
1748 "Unmarks the example for the current question."
|
|
1749 (if extent
|
|
1750 (delete-extent extent)))
|
|
1751
|
|
1752 ; )
|
|
1753 ; ;; For the Emacs 19
|
|
1754 ; (defun hm--html-mark-example (parameter-list)
|
|
1755 ; "Marks the example of the parameterlist in the current buffer.
|
|
1756 ;It returns the example extent."
|
|
1757 ; (if (hm--html-get-example-from-parameter-list parameter-list)
|
|
1758 ; (progn
|
|
1759 ; (search-forward (hm--html-get-example-from-parameter-list
|
|
1760 ; parameter-list))
|
|
1761 ; (put-text-property (match-beginning 0)
|
|
1762 ; (match-end 0)
|
|
1763 ; 'face
|
|
1764 ; 'hm--html-help-face))))
|
|
1765 ;
|
|
1766 ;
|
|
1767 ; (defun hm--html-unmark-example (extent)
|
|
1768 ; "Unmarks the example for the current question."
|
|
1769 ; t))
|
|
1770
|
|
1771
|
|
1772 (defun hm--html-write-alist-in-buffer (alist)
|
|
1773 "The function writes the contents of the ALIST in the currentbuffer."
|
|
1774 (cond ((car alist)
|
|
1775 (insert (int-to-string (car (car alist))) ":\t" (cdr (car alist)))
|
|
1776 (newline)
|
|
1777 (hm--html-write-alist-in-buffer (cdr alist)))))
|
|
1778
|
|
1779
|
|
1780 (defun hm--html-select-directory (alist default)
|
|
1781 "The function selects one of the directories of the ALIST,
|
|
1782 or the DEFAULT or the 'default-directory' by number. See also the
|
|
1783 documentation of the function hm--html-read-filename."
|
|
1784 (if (or (string= default "") (not default))
|
|
1785 (setq default default-directory))
|
|
1786 (if alist
|
|
1787 (save-window-excursion
|
|
1788 (let ((buffername (generate-new-buffer "*html-directories*")))
|
|
1789 (set-buffer buffername)
|
|
1790 (insert "Select one of the following directories by number !")
|
|
1791 (newline)
|
|
1792 (insert "===================================================")
|
|
1793 (newline)
|
|
1794 (insert "0:\t" default)
|
|
1795 (newline)
|
|
1796 (hm--html-write-alist-in-buffer alist)
|
|
1797 (goto-char (point-min))
|
|
1798 (pop-to-buffer buffername))
|
|
1799 (let ((dirnumber (read-number
|
|
1800 "Select directory prefix by number: "
|
|
1801 t)))
|
|
1802 (kill-buffer "*html-directories*")
|
|
1803 (expand-file-name (or (cdr (assoc dirnumber alist)) default))))
|
|
1804 (expand-file-name default))
|
|
1805 )
|
|
1806
|
|
1807
|
|
1808 (defun hm--html-delete-wrong-path-prefix-1 (filename prefix-list)
|
|
1809 "The function deletes wrong path prefixes."
|
|
1810 (cond (prefix-list (if (string-match (car prefix-list) filename)
|
|
1811 (substring filename (match-end 0))
|
|
1812 (hm--html-delete-wrong-path-prefix-1 filename
|
|
1813 (cdr prefix-list)
|
|
1814 )))
|
|
1815 (t filename)))
|
|
1816
|
|
1817
|
|
1818 (defun hm--html-delete-wrong-path-prefix (filename)
|
|
1819 "The function deletes wrong path prefixes.
|
|
1820 The path prefixes are specified by the variable
|
|
1821 `hm--html-delete-wrong-path-prefix'."
|
|
1822 (if (not hm--html-delete-wrong-path-prefix)
|
|
1823 filename
|
|
1824 (if (listp hm--html-delete-wrong-path-prefix)
|
|
1825 (hm--html-delete-wrong-path-prefix-1 filename
|
|
1826 hm--html-delete-wrong-path-prefix)
|
|
1827 (hm--html-delete-wrong-path-prefix-1 filename
|
|
1828 (list
|
|
1829 hm--html-delete-wrong-path-prefix))
|
|
1830 )))
|
|
1831
|
|
1832
|
|
1833 (defun hm--html-read-filename (parameter-list)
|
|
1834 "The function reads a filename with its directory path,
|
|
1835 if PARAMETER-LIST is not nil. If the PARAMETER-LIST is nil, only an empty
|
|
1836 string will be returned.
|
|
1837 The PARAMETER-LIST consists of the following elements:
|
|
1838 PROMPT, ALIST, DEFAULT, REQUIRE-MATCH, EXAMPLE.
|
|
1839 If the ALIST is nil and DEFAULT is nil, then the function only reads
|
|
1840 a filename (without path). These precede the following.
|
|
1841 If the ALIST isn't nil, the function lists the contents of the ALIST
|
|
1842 in a buffer and reads a number from the minbuffer, which selects one
|
|
1843 of the directories (lines) of the buffer. Therefore the ALIST must look
|
|
1844 like the following alist:
|
|
1845 ((1 . \"/appl/gnu/\") (2 . \"/\"))
|
|
1846 If only ALIST is nil, or if you type a number which is not in the ALIST,
|
|
1847 the DEFAULT directory is selected. If the DEFAULT is nil or \"\" the
|
|
1848 'default-directory' is selected.
|
|
1849 After that the function reads the name of the file from the minibuffer.
|
|
1850 Therefore the PROMPT is printed in the minibuffer and the selected directory
|
|
1851 is taken as the start of the path of the file.
|
|
1852 If REQUIRE-MATCH is t, the filename with path must match an existing file."
|
|
1853 (if parameter-list
|
|
1854 (let ((marked-object (hm--html-mark-example parameter-list))
|
|
1855 (prompt (hm--html-get-prompt-from-parameter-list parameter-list))
|
|
1856 (alist (hm--html-get-alist-from-parameter-list parameter-list))
|
|
1857 (default (hm--html-get-default-from-parameter-list parameter-list))
|
|
1858 (require-match (hm--html-get-require-match-from-parameter-list
|
|
1859 parameter-list))
|
|
1860 (filename nil))
|
|
1861 (if (or alist default)
|
|
1862 (let ((directory (hm--html-select-directory alist default)))
|
|
1863 (setq filename (read-file-name prompt
|
|
1864 directory
|
|
1865 directory
|
|
1866 require-match
|
|
1867 nil)))
|
|
1868 (setq filename (read-file-name prompt
|
|
1869 ""
|
|
1870 ""
|
|
1871 require-match
|
|
1872 nil)))
|
|
1873 (hm--html-unmark-example marked-object)
|
|
1874 (hm--html-delete-wrong-path-prefix filename))
|
|
1875 ; (if (not hm--html-delete-wrong-path-prefix)
|
|
1876 ; filename
|
|
1877 ; (if (string-match hm--html-delete-wrong-path-prefix filename)
|
|
1878 ; (substring filename (match-end 0))
|
|
1879 ; filename)))
|
|
1880 ""))
|
|
1881
|
|
1882
|
|
1883 (defun hm--html-completing-read (parameter-list)
|
|
1884 "Reads a string with completing-read, if alist is non nil.
|
|
1885 The PARAMETER-LIST consists of the following elements:
|
|
1886 PROMPT, ALIST, DEFAULT, REQUIRE-MATCH, EXAMPLE.
|
|
1887 If ALIST is nil, it returns the DEFAULT, or if the DEFAULT is
|
|
1888 also nil it returns an empty string."
|
|
1889 (let ((marked-object (hm--html-mark-example parameter-list))
|
|
1890 (string
|
|
1891 (if (hm--html-get-alist-from-parameter-list parameter-list)
|
|
1892 (completing-read
|
|
1893 (hm--html-get-prompt-from-parameter-list parameter-list)
|
|
1894 (hm--html-get-alist-from-parameter-list parameter-list)
|
|
1895 nil
|
|
1896 (hm--html-get-require-match-from-parameter-list
|
|
1897 parameter-list)
|
|
1898 (hm--html-get-default-from-parameter-list
|
|
1899 parameter-list))
|
|
1900 (if (hm--html-get-default-from-parameter-list parameter-list)
|
|
1901 (hm--html-get-default-from-parameter-list parameter-list)
|
|
1902 ""))))
|
|
1903 (hm--html-unmark-example marked-object)
|
|
1904 string))
|
|
1905
|
|
1906
|
|
1907 (defvar hm--html-faces-exist nil)
|
|
1908
|
|
1909
|
|
1910 (defun hm--html-generate-help-buffer-faces ()
|
|
1911 "Generates faces for the add-link-help-buffer."
|
|
1912 (if (not (facep 'hm--html-help-face))
|
|
1913 ; (if (not hm--html-faces-exist)
|
|
1914 (progn
|
|
1915 (setq hm--html-faces-exist t)
|
|
1916 (make-face 'hm--html-help-face)
|
2
|
1917 (if hm--html-help-foreground
|
|
1918 (set-face-foreground 'hm--html-help-face hm--html-help-foreground))
|
|
1919 (if hm--html-help-background
|
|
1920 (set-face-background 'hm--html-help-face hm--html-help-background))
|
|
1921 (set-face-font 'hm--html-help-face hm--html-help-font)
|
0
|
1922 )))
|
|
1923
|
|
1924
|
|
1925 (defun hm--html-get-prompt-from-parameter-list (parameter-list)
|
|
1926 "Returns the prompt from the PARAMETER-LIST."
|
|
1927 (car parameter-list))
|
|
1928
|
|
1929
|
|
1930 (defun hm--html-get-alist-from-parameter-list (parameter-list)
|
|
1931 "Returns the alist from the PARAMETER-LIST."
|
|
1932 (car (cdr parameter-list)))
|
|
1933
|
|
1934
|
|
1935 (defun hm--html-get-default-from-parameter-list (parameter-list)
|
|
1936 "Returns the default from the PARAMETER-LIST."
|
|
1937 (car (cdr (cdr parameter-list))))
|
|
1938
|
|
1939
|
|
1940 (defun hm--html-get-require-match-from-parameter-list (parameter-list)
|
|
1941 "Returns the require-match from the PARAMETER-LIST."
|
|
1942 (car (cdr (cdr (cdr parameter-list)))))
|
|
1943
|
|
1944
|
|
1945 (defun hm--html-get-example-from-parameter-list (parameter-list)
|
|
1946 "Returns the example from the PARAMETER-LIST."
|
|
1947 (car (cdr (cdr (cdr (cdr parameter-list))))))
|
|
1948
|
|
1949
|
|
1950 (defun hm--html-get-anchor-seperator-from-parameter-list (parameter-list)
|
|
1951 "Returns the anchor-seperator from the PARAMETER-LIST."
|
|
1952 (car (cdr (cdr (cdr (cdr (cdr parameter-list)))))))
|
|
1953
|
|
1954
|
|
1955 (defun hm--html-generate-add-link-help-buffer (scheme-parameter-list
|
|
1956 host-name:port-parameter-list
|
|
1957 servername:port-parameter-list
|
|
1958 path+file-parameter-list
|
|
1959 anchor-parameter-list)
|
|
1960 "Generates and displays a help buffer with an example for adding a link."
|
|
1961 (let ((buffername (generate-new-buffer "*Link-Example*")))
|
|
1962 (pop-to-buffer buffername)
|
|
1963 (shrink-window (- (window-height) 5))
|
|
1964 (insert "Example:")
|
|
1965 (newline 2)
|
|
1966 (if (hm--html-get-example-from-parameter-list scheme-parameter-list)
|
|
1967 (progn
|
|
1968 (insert (hm--html-get-example-from-parameter-list
|
|
1969 scheme-parameter-list))
|
|
1970 (if (hm--html-get-example-from-parameter-list
|
|
1971 scheme-parameter-list)
|
|
1972 (progn
|
|
1973 (insert ":")
|
|
1974 (if (hm--html-get-example-from-parameter-list
|
|
1975 host-name:port-parameter-list)
|
|
1976 (insert "//"))))))
|
|
1977 (if (hm--html-get-example-from-parameter-list
|
|
1978 host-name:port-parameter-list)
|
|
1979 (progn
|
|
1980 (insert (hm--html-get-example-from-parameter-list
|
|
1981 host-name:port-parameter-list))
|
|
1982 (if (and (hm--html-get-example-from-parameter-list
|
|
1983 servername:port-parameter-list)
|
|
1984 (not (string= "/"
|
|
1985 (substring
|
|
1986 (hm--html-get-example-from-parameter-list
|
|
1987 servername:port-parameter-list)
|
|
1988 0
|
|
1989 1))))
|
|
1990 (insert "/"))))
|
|
1991 (if (hm--html-get-example-from-parameter-list
|
|
1992 servername:port-parameter-list)
|
|
1993 (progn
|
|
1994 (insert (hm--html-get-example-from-parameter-list
|
|
1995 servername:port-parameter-list))
|
|
1996 (if (hm--html-get-example-from-parameter-list
|
|
1997 path+file-parameter-list)
|
|
1998 (insert "/"))))
|
|
1999 (if (hm--html-get-example-from-parameter-list path+file-parameter-list)
|
|
2000 (progn
|
|
2001 (insert (hm--html-get-example-from-parameter-list
|
|
2002 path+file-parameter-list))))
|
|
2003 (if (hm--html-get-example-from-parameter-list anchor-parameter-list)
|
|
2004 (progn
|
|
2005 (insert (hm--html-get-anchor-seperator-from-parameter-list
|
|
2006 anchor-parameter-list))
|
|
2007 (insert (hm--html-get-example-from-parameter-list
|
|
2008 anchor-parameter-list))))
|
|
2009 (goto-char (point-min))
|
|
2010 buffername
|
|
2011 ))
|
|
2012
|
|
2013
|
|
2014 (defun hm--html-add-link (function-add-tags
|
|
2015 scheme-parameter-list
|
|
2016 host-name:port-parameter-list
|
|
2017 servername:port-parameter-list
|
|
2018 path+file-parameter-list
|
|
2019 anchor-parameter-list)
|
|
2020 "The function adds a link in the current buffer.
|
|
2021 The parameter FUNCTION-ADD-TAGS determines the function which adds the tag
|
|
2022 in the buffer (for example: 'hm--html-add-tags or
|
|
2023 'hm--html-add-tags-to-region).
|
|
2024 The parameters SCHEME-PARAMETER-LIST, HOST-NAME:PORT-PARAMETER-LIST,
|
|
2025 SERVERNAME:PORT-PARAMETER-LIST, PATH+FILE-PARAMETER-LIST and
|
|
2026 ANCHOR-PARAMETER-LIST are lists with a prompt string, an alist, a default
|
|
2027 value and an example string. The ANCHOR-PARAMETER-LIST has as an additional
|
|
2028 element an anchor seperator string. All these elements are used to read and
|
|
2029 construct the link."
|
|
2030 (let ((point nil))
|
|
2031 (save-window-excursion
|
|
2032 (let ((html-buffer (current-buffer))
|
|
2033 (html-help-buffer (hm--html-generate-add-link-help-buffer
|
|
2034 scheme-parameter-list
|
|
2035 host-name:port-parameter-list
|
|
2036 servername:port-parameter-list
|
|
2037 path+file-parameter-list
|
|
2038 anchor-parameter-list))
|
|
2039 (scheme (hm--html-completing-read scheme-parameter-list))
|
|
2040 (hostname:port (hm--html-completing-read
|
|
2041 host-name:port-parameter-list))
|
|
2042 (servername:port (hm--html-completing-read
|
|
2043 servername:port-parameter-list))
|
|
2044 (path+file (hm--html-read-filename path+file-parameter-list))
|
|
2045 (anchor (hm--html-completing-read anchor-parameter-list))
|
|
2046 ; (hrefname (setq html-link-counter (1+ html-link-counter)))
|
|
2047 (anchor-seperator
|
|
2048 (hm--html-get-anchor-seperator-from-parameter-list
|
|
2049 anchor-parameter-list)))
|
|
2050 (if (not (string= scheme ""))
|
|
2051 (if (string= hostname:port "")
|
|
2052 (setq scheme (concat scheme ":"))
|
|
2053 (setq scheme (concat scheme "://"))))
|
|
2054 (if (and (not (string= hostname:port ""))
|
|
2055 (not (string= servername:port ""))
|
|
2056 (not (string= (substring servername:port 0 1) "/")))
|
|
2057 (setq servername:port (concat "/" servername:port)))
|
|
2058 (if (and (not (string= path+file ""))
|
|
2059 (not (string= "/" (substring path+file 0 1))))
|
|
2060 (setq path+file (concat "/" path+file)))
|
|
2061 (if (not (string= anchor ""))
|
|
2062 (setq anchor (concat anchor-seperator anchor)))
|
|
2063 (kill-buffer html-help-buffer)
|
|
2064 (pop-to-buffer html-buffer)
|
|
2065 (eval (list function-add-tags
|
|
2066 ''hm--html-insert-start-tag
|
|
2067 (concat "<A"
|
|
2068 ; "<A Name="
|
|
2069 ; hrefname
|
|
2070 " HREF=\""
|
|
2071 scheme
|
|
2072 hostname:port
|
|
2073 servername:port
|
|
2074 path+file
|
|
2075 anchor
|
|
2076 "\">")
|
|
2077 ''hm--html-insert-end-tag
|
|
2078 "</A>")))
|
|
2079 (setq point (point))))
|
|
2080 (goto-char (point)))
|
|
2081
|
|
2082
|
|
2083 (defun hm--html-add-info-link-1 (function-add-tags)
|
|
2084 "Internal function. Adds the HTML tags for a link on a GNU Info file."
|
|
2085 (hm--html-add-link function-add-tags
|
|
2086 (list ; scheme
|
|
2087 ""
|
|
2088 nil
|
|
2089 "http"
|
|
2090 t
|
|
2091 "http")
|
|
2092 (list ; hostname:port
|
|
2093 "Gateway and Port: "
|
|
2094 hm--html-info-hostname:port-alist
|
|
2095 hm--html-info-hostname:port-default
|
|
2096 nil
|
|
2097 "www.tnt.uni-hannover.de:8005")
|
|
2098 (list ; servername:port
|
|
2099 ""
|
|
2100 nil
|
|
2101 ""
|
|
2102 t
|
|
2103 nil)
|
|
2104 (list ; path/file
|
|
2105 "Path/File: "
|
|
2106 hm--html-info-path-alist
|
|
2107 nil
|
|
2108 nil
|
|
2109 "/appl/lemacs/Global/info/dir")
|
|
2110 (list ; anchor
|
|
2111 "Node: "
|
|
2112 '((""))
|
|
2113 nil
|
|
2114 nil
|
|
2115 "emacs"
|
|
2116 ",")))
|
|
2117
|
|
2118
|
|
2119 (defun hm--html-add-info-link ()
|
|
2120 "Adds the HTML tags for a link on a GNU Info file."
|
|
2121 (interactive)
|
|
2122 (hm--html-add-info-link-1 'hm--html-add-tags))
|
|
2123
|
|
2124
|
|
2125 (defun hm--html-add-info-link-to-region ()
|
|
2126 "Adds the HTML tags for a link on a GNU Info file to the region."
|
|
2127 (interactive)
|
|
2128 (hm--html-add-info-link-1 'hm--html-add-tags-to-region))
|
|
2129
|
|
2130
|
|
2131 (defun hm--html-add-wais-link-1 (function-add-tags)
|
|
2132 "Internal function. Adds the HTML tags for a link to a WAIS server."
|
|
2133 (hm--html-add-link function-add-tags
|
|
2134 (list ; scheme
|
|
2135 ""
|
|
2136 nil
|
|
2137 "http"
|
|
2138 t
|
|
2139 "http")
|
|
2140 (list ; hostname:port
|
|
2141 "Gateway and Port: "
|
|
2142 hm--html-wais-hostname:port-alist
|
|
2143 hm--html-wais-hostname:port-default
|
|
2144 nil
|
|
2145 "www.tnt.uni-hannover.de:8001")
|
|
2146 (list ; servername:port
|
|
2147 "Wais Servername and Port: "
|
|
2148 hm--html-wais-servername:port-alist
|
|
2149 hm--html-wais-servername:port-default
|
|
2150 nil
|
|
2151 "quake.think.com:210")
|
|
2152 (list ; path/file
|
|
2153 "Database: "
|
|
2154 hm--html-wais-path-alist
|
|
2155 nil
|
|
2156 nil
|
|
2157 "database")
|
|
2158 (list ; anchor
|
|
2159 "Searchstring: "
|
|
2160 '((""))
|
|
2161 nil
|
|
2162 nil
|
|
2163 "searchstring"
|
|
2164 "?")))
|
|
2165
|
|
2166
|
|
2167 (defun hm--html-add-wais-link ()
|
|
2168 "Adds the HTML tags for a link to a WAIS server."
|
|
2169 (interactive)
|
|
2170 (hm--html-add-wais-link-1 'hm--html-add-tags))
|
|
2171
|
|
2172
|
|
2173 (defun hm--html-add-wais-link-to-region ()
|
|
2174 "Adds the HTML tags for a link to a WAIS server to the region."
|
|
2175 (interactive)
|
|
2176 (hm--html-add-wais-link-1 'hm--html-add-tags-to-region))
|
|
2177
|
|
2178
|
|
2179 (defun hm--html-add-direct-wais-link-1 (function-add-tags)
|
|
2180 "Internal function. Adds the HTML tags for a direct link to a WAIS server.
|
|
2181 This function uses the new direct WAIS support instead of a WAIS gateway."
|
|
2182 (hm--html-add-link function-add-tags
|
|
2183 (list ; scheme
|
|
2184 ""
|
|
2185 nil
|
|
2186 "wais"
|
|
2187 t
|
|
2188 "wais")
|
|
2189 (list ; hostname:port
|
|
2190 "Wais Servername and Port: "
|
|
2191 hm--html-wais-servername:port-alist
|
|
2192 hm--html-wais-servername:port-default
|
|
2193 nil
|
|
2194 "quake.think.com:210")
|
|
2195 (list ; servername:port
|
|
2196 ""
|
|
2197 nil
|
|
2198 ""
|
|
2199 t
|
|
2200 nil)
|
|
2201 (list ; path/file
|
|
2202 "Database: "
|
|
2203 hm--html-wais-path-alist
|
|
2204 nil
|
|
2205 nil
|
|
2206 "database")
|
|
2207 (list ; anchor
|
|
2208 "Searchstring: "
|
|
2209 '((""))
|
|
2210 nil
|
|
2211 nil
|
|
2212 "searchstring"
|
|
2213 "?")))
|
|
2214
|
|
2215
|
|
2216 (defun hm--html-add-direct-wais-link ()
|
|
2217 "Adds the HTML tags for a direct link to a WAIS server.
|
|
2218 This function uses the new direct WAIS support instead of a WAIS gateway."
|
|
2219 (interactive)
|
|
2220 (hm--html-add-direct-wais-link-1 'hm--html-add-tags))
|
|
2221
|
|
2222
|
|
2223 (defun hm--html-add-direct-wais-link-to-region ()
|
|
2224 "Adds the HTML tags for a direct link to a WAIS server to the region.
|
|
2225 This function uses the new direct WAIS support instead of a WAIS gateway."
|
|
2226 (interactive)
|
|
2227 (hm--html-add-direct-wais-link-1 'hm--html-add-tags-to-region))
|
|
2228
|
|
2229
|
|
2230 (defun hm--html-add-html-link-1 (function-add-tags)
|
|
2231 "Internal function. Adds the HTML tags for a link to an HTML page."
|
|
2232 (hm--html-add-link function-add-tags
|
|
2233 (list ; scheme
|
|
2234 ""
|
|
2235 nil
|
|
2236 "http"
|
|
2237 t
|
|
2238 "http")
|
|
2239 (list ; hostname:port
|
|
2240 "Servername and Port: "
|
|
2241 hm--html-html-hostname:port-alist
|
|
2242 hm--html-html-hostname:port-default
|
|
2243 nil
|
|
2244 "www.tnt.uni-hannover.de:80")
|
|
2245 (list ; servername:port
|
|
2246 ""
|
|
2247 nil
|
|
2248 ""
|
|
2249 t
|
|
2250 nil)
|
|
2251 (list ; path/file
|
|
2252 "Path/File: "
|
|
2253 hm--html-html-path-alist
|
|
2254 nil
|
|
2255 nil
|
|
2256 "/data/info/www/tnt/overview.html")
|
|
2257 (list ; anchor
|
|
2258 "Anchor: "
|
|
2259 '((""))
|
|
2260 nil
|
|
2261 nil
|
|
2262 "1"
|
|
2263 "#")))
|
|
2264
|
|
2265
|
|
2266 (defun hm--html-add-html-link ()
|
|
2267 "Adds the HTML tags for a link to an HTML file."
|
|
2268 (interactive)
|
|
2269 (hm--html-add-html-link-1 'hm--html-add-tags))
|
|
2270
|
|
2271
|
|
2272 (defun hm--html-add-html-link-to-region ()
|
|
2273 "Adds the HTML tags for a link to an HTML file to the region."
|
|
2274 (interactive)
|
|
2275 (hm--html-add-html-link-1 'hm--html-add-tags-to-region))
|
|
2276
|
|
2277
|
|
2278 (defun hm--html-add-file-link-1 (function-add-tags)
|
|
2279 "Internal function. Adds the HTML tags for a filegateway link."
|
|
2280 (hm--html-add-link function-add-tags
|
|
2281 (list ; scheme
|
|
2282 ""
|
|
2283 nil
|
|
2284 "file"
|
|
2285 t
|
|
2286 "file")
|
|
2287 (list ; hostname:port
|
|
2288 ""
|
|
2289 nil
|
|
2290 ""
|
|
2291 t
|
|
2292 nil)
|
|
2293 (list ; servername:port
|
|
2294 ""
|
|
2295 nil
|
|
2296 ""
|
|
2297 t
|
|
2298 nil)
|
|
2299 (list ; path/file
|
|
2300 "Path/File: "
|
|
2301 hm--html-file-path-alist
|
|
2302 nil
|
|
2303 nil
|
|
2304 "/data/info/www/tnt/overview.html")
|
|
2305 (list ; anchor
|
|
2306 "Anchor: "
|
|
2307 '((""))
|
|
2308 nil
|
|
2309 nil
|
|
2310 "1"
|
|
2311 "#")))
|
|
2312
|
|
2313
|
|
2314 (defun hm--html-add-file-link ()
|
|
2315 "Adds the HTML tags for a for a filegateway link."
|
|
2316 (interactive)
|
|
2317 (hm--html-add-file-link-1 'hm--html-add-tags))
|
|
2318
|
|
2319
|
|
2320 (defun hm--html-add-file-link-to-region ()
|
|
2321 "Adds the HTML tags for a for a filegateway link to the region."
|
|
2322 (interactive)
|
|
2323 (hm--html-add-file-link-1 'hm--html-add-tags-to-region))
|
|
2324
|
|
2325
|
|
2326 (defun hm--html-add-ftp-link-1 (function-add-tags)
|
|
2327 "Internal function. Adds the HTML tags for a link to an FTP server."
|
|
2328 (hm--html-add-link function-add-tags
|
|
2329 (list ; scheme
|
|
2330 ""
|
|
2331 nil
|
|
2332 "ftp"
|
|
2333 t
|
|
2334 "ftp")
|
|
2335 (list ; hostname:port
|
|
2336 "FTP Servername: "
|
|
2337 hm--html-ftp-hostname:port-alist
|
|
2338 hm--html-ftp-hostname:port-default
|
|
2339 nil
|
|
2340 "ftp.rrzn.uni-hannover.de")
|
|
2341 (list ; servername:port
|
|
2342 ""
|
|
2343 nil
|
|
2344 ""
|
|
2345 t
|
|
2346 nil)
|
|
2347 (list ; path/file
|
|
2348 "Path/File: "
|
|
2349 hm--html-ftp-path-alist
|
|
2350 nil
|
|
2351 nil
|
|
2352 "/pub/gnu/gcc-2.4.5.tar.gz")
|
|
2353 (list ; anchor
|
|
2354 ""
|
|
2355 nil
|
|
2356 ""
|
|
2357 t
|
|
2358 nil
|
|
2359 nil)))
|
|
2360
|
|
2361
|
|
2362 (defun hm--html-add-ftp-link ()
|
|
2363 "Adds the HTML tags for a link to an FTP server."
|
|
2364 (interactive)
|
|
2365 (hm--html-add-ftp-link-1 'hm--html-add-tags))
|
|
2366
|
|
2367
|
|
2368 (defun hm--html-add-ftp-link-to-region ()
|
|
2369 "Adds the HTML tags for a link to an FTP server to the region."
|
|
2370 (interactive)
|
|
2371 (hm--html-add-ftp-link-1 'hm--html-add-tags-to-region))
|
|
2372
|
|
2373
|
|
2374 (defun hm--html-add-gopher-link-1 (function-add-tags)
|
|
2375 "Internal function. Adds the HTML tags for a link to a gopher server."
|
|
2376 (hm--html-add-link function-add-tags
|
|
2377 (list ; scheme
|
|
2378 ""
|
|
2379 nil
|
|
2380 "gopher"
|
|
2381 t
|
|
2382 "gopher")
|
|
2383 (list ; hostname:port
|
|
2384 "Gopher Servername: "
|
|
2385 hm--html-gopher-hostname:port-alist
|
|
2386 hm--html-gopher-hostname:port-default
|
|
2387 nil
|
|
2388 "newsserver.rrzn.uni-hannover.de:70")
|
|
2389 (list ; servername:port
|
|
2390 "Documenttype: "
|
|
2391 hm--html-gopher-doctype-alist
|
|
2392 hm--html-gopher-doctype-default
|
|
2393 nil
|
|
2394 "/1")
|
|
2395 nil ; path/file
|
|
2396 (list ; anchor
|
|
2397 "Entrypoint: "
|
|
2398 hm--html-gopher-anchor-alist
|
|
2399 nil
|
|
2400 nil
|
|
2401 "Subject%20Tree"
|
|
2402 "/")))
|
|
2403
|
|
2404
|
|
2405 (defun hm--html-add-gopher-link ()
|
|
2406 "Adds the HTML tags for a link to a gopher server."
|
|
2407 (interactive)
|
|
2408 (hm--html-add-gopher-link-1 'hm--html-add-tags))
|
|
2409
|
|
2410
|
|
2411 (defun hm--html-add-gopher-link-to-region ()
|
|
2412 "Adds the HTML tags for a link to a gopher server to the region."
|
|
2413 (interactive)
|
|
2414 (hm--html-add-gopher-link-1 'hm--html-add-tags-to-region))
|
|
2415
|
|
2416
|
|
2417 (defun hm--html-make-proggate-alist (proggate-allowed-file)
|
|
2418 "Makes a proggate-alist from the PROGGATE-ALLOWED-FILE."
|
|
2419 (if (and (stringp proggate-allowed-file)
|
|
2420 (file-exists-p proggate-allowed-file))
|
|
2421 (save-window-excursion
|
|
2422 (let ((alist nil)
|
22
|
2423 (buffername (find-file-noselect proggate-allowed-file))
|
|
2424 (case-fold-search t))
|
0
|
2425 (set-buffer buffername)
|
|
2426 (toggle-read-only)
|
|
2427 (goto-char (point-min))
|
|
2428 (while (search-forward-regexp "[^ \t\n]+" nil t)
|
|
2429 (setq alist (append (list (list (buffer-substring
|
|
2430 (match-beginning 0)
|
|
2431 (match-end 0))))
|
|
2432 alist)))
|
|
2433 (kill-buffer buffername)
|
|
2434 alist))
|
|
2435 (error "ERROR: Can't find the 'hm--html-progate-allowed-file !")))
|
|
2436
|
|
2437
|
|
2438 (defun hm--html-add-proggate-link-1 (function-add-tags)
|
|
2439 "Internal function. Adds the HTML tags for a link to a program.
|
|
2440 The program is called via the program gateway.
|
|
2441 Email to muenkel@tnt.uni-hannover.de for information over
|
|
2442 this gateway."
|
|
2443 (let ((progname-alist (hm--html-make-proggate-alist
|
|
2444 hm--html-proggate-allowed-file)))
|
|
2445 (hm--html-add-link function-add-tags
|
|
2446 (list ; scheme
|
|
2447 ""
|
|
2448 nil
|
|
2449 "http"
|
|
2450 t
|
|
2451 "http")
|
|
2452 (list ; hostname:port
|
|
2453 "Servername and Port: "
|
|
2454 hm--html-proggate-hostname:port-alist
|
|
2455 hm--html-proggate-hostname:port-default
|
|
2456 nil
|
|
2457 "www.tnt.uni-hannover.de:8007")
|
|
2458 (list ; program
|
|
2459 "Programname: "
|
|
2460 progname-alist
|
|
2461 nil
|
|
2462 nil
|
|
2463 "/usr/ucb/man")
|
|
2464 nil ; path/file
|
|
2465 (list ; Program Parameter
|
|
2466 "Programparameter: "
|
|
2467 '((""))
|
|
2468 nil
|
|
2469 nil
|
|
2470 "8+lpd"
|
|
2471 "+"))))
|
|
2472
|
|
2473
|
|
2474 (defun hm--html-add-proggate-link ()
|
|
2475 "Adds the HTML tags for a link to a program.
|
|
2476 The program is called via the program gateway.
|
|
2477 Email to muenkel@tnt.uni-hannover.de for information over
|
|
2478 this gateway."
|
|
2479 (interactive)
|
|
2480 (hm--html-add-proggate-link-1 'hm--html-add-tags))
|
|
2481
|
|
2482
|
|
2483 (defun hm--html-add-proggate-link-to-region ()
|
|
2484 "Adds the HTML tags for a link to a program to the region.
|
|
2485 The program is called via the program gateway.
|
|
2486 Email to muenkel@tnt.uni-hannover.de for information over
|
|
2487 this gateway."
|
|
2488 (interactive)
|
|
2489 (hm--html-add-proggate-link-1 'hm--html-add-tags-to-region))
|
|
2490
|
|
2491
|
|
2492 (defun hm--html-add-local-proggate-link-1 (function-add-tags)
|
|
2493 "Internal function. Adds the HTML tags for a link to a program.
|
|
2494 The program is called via the local program gateway.
|
|
2495 Email to muenkel@tnt.uni-hannover.de for information over
|
|
2496 this gateway."
|
|
2497 (hm--html-add-link function-add-tags
|
|
2498 (list ; scheme
|
|
2499 ""
|
|
2500 nil
|
|
2501 ""
|
|
2502 t
|
|
2503 nil)
|
|
2504 (list ; hostname:port
|
|
2505 ""
|
|
2506 nil
|
|
2507 ""
|
|
2508 t
|
|
2509 nil)
|
|
2510 (list ; servername:port
|
|
2511 ""
|
|
2512 nil
|
|
2513 ""
|
|
2514 t
|
|
2515 nil)
|
|
2516 (list ; path/file
|
|
2517 "Path/file: "
|
|
2518 hm--html-local-proggate-path-alist
|
|
2519 nil
|
|
2520 nil
|
|
2521 "/data/info/programs/lemacs.evlm")
|
|
2522 (list ; anchor
|
|
2523 ""
|
|
2524 nil
|
|
2525 ""
|
|
2526 t
|
|
2527 nil)))
|
|
2528
|
|
2529
|
|
2530 (defun hm--html-add-local-proggate-link ()
|
|
2531 "Adds the HTML tags for a link to a program.
|
|
2532 The program is called via the local program gateway.
|
|
2533 Email to muenkel@tnt.uni-hannover.de for information over
|
|
2534 this gateway."
|
|
2535 (interactive)
|
|
2536 (hm--html-add-local-proggate-link-1 'hm--html-add-tags))
|
|
2537
|
|
2538
|
|
2539 (defun hm--html-add-local-proggate-link-to-region ()
|
|
2540 "Adds the HTML tags for a link to a program to the region.
|
|
2541 The program is called via the local program gateway.
|
|
2542 Email to muenkel@tnt.uni-hannover.de for information over
|
|
2543 this gateway."
|
|
2544 (interactive)
|
|
2545 (hm--html-add-local-proggate-link-1 'hm--html-add-tags-to-region))
|
|
2546
|
|
2547
|
|
2548 (defvar hm--html-newsgroup-alist nil
|
|
2549 "Alist with newsgroups for the newsgateway.")
|
|
2550
|
|
2551
|
|
2552 (defvar gnus-newsrc-assoc nil)
|
|
2553
|
|
2554
|
|
2555 (defun hm--html-make-newsgroup-alist ()
|
|
2556 "Makes a hm--html-make-newsgroup-alist from a .newsrc.el file.
|
|
2557 The function looks at the environment variable NNTPSERVER.
|
|
2558 If this variable exists, it trys to open the file with the Name
|
|
2559 ~/$NNTPSERVER.el. If this file exists, the alist of the file is
|
|
2560 returned as the newsgroup-alist. If the file doesn't exist, it
|
|
2561 tries to use the file ~/$NNTPSERVER to make the alist. The function
|
|
2562 returns '((\"\"))"
|
|
2563 (if hm--html-newsgroup-alist
|
|
2564 hm--html-newsgroup-alist
|
|
2565 (if gnus-newsrc-assoc
|
|
2566 (setq hm--html-newsgroup-alist gnus-newsrc-assoc)
|
|
2567 (if (not (getenv "NNTPSERVER"))
|
|
2568 '((""))
|
|
2569 (let ((newsrc-file (expand-file-name (concat "~/.newsrc-"
|
|
2570 (getenv "NNTPSERVER")))))
|
|
2571 (if (file-exists-p (concat newsrc-file ".el"))
|
|
2572 (progn
|
|
2573 (load-file (concat newsrc-file ".el"))
|
|
2574 (setq hm--html-newsgroup-alist gnus-newsrc-assoc))
|
|
2575 (if (not (file-exists-p newsrc-file))
|
|
2576 '((""))
|
|
2577 (save-window-excursion
|
|
2578 (let ((alist nil)
|
22
|
2579 (buffername (find-file-noselect newsrc-file))
|
|
2580 (case-fold-search t))
|
0
|
2581 (set-buffer buffername)
|
|
2582 (toggle-read-only)
|
|
2583 (goto-char (point-min))
|
|
2584 (while (search-forward-regexp "[^:!]+" nil t)
|
|
2585 (setq alist (append (list (list (buffer-substring
|
|
2586 (match-beginning 0)
|
|
2587 (match-end 0))))
|
|
2588 alist))
|
|
2589 (search-forward-regexp "\n"))
|
|
2590 (kill-buffer buffername)
|
|
2591 (setq hm--html-newsgroup-alist alist))))))))))
|
|
2592
|
|
2593
|
|
2594
|
|
2595 (defun hm--html-add-news-link-1 (function-add-tags)
|
|
2596 "Internal function. Adds the HTML tags for a link to a news group."
|
|
2597 (let ((newsgroup-alist (hm--html-make-newsgroup-alist)))
|
|
2598 (hm--html-add-link function-add-tags
|
|
2599 (list ; scheme
|
|
2600 ""
|
|
2601 nil
|
|
2602 "news"
|
|
2603 t
|
|
2604 "news")
|
|
2605 (list ; hostname:port
|
|
2606 ""
|
|
2607 nil
|
|
2608 ""
|
|
2609 t
|
|
2610 nil)
|
|
2611 (list ; servername:port
|
|
2612 "NEWS Group: "
|
|
2613 newsgroup-alist
|
|
2614 nil
|
|
2615 nil
|
|
2616 "comp.emacs.xemacs")
|
|
2617 nil ; path/file
|
|
2618 (list ; anchor
|
|
2619 ""
|
|
2620 nil
|
|
2621 ""
|
|
2622 t
|
|
2623 nil
|
|
2624 nil))))
|
|
2625
|
|
2626
|
|
2627 (defun hm--html-add-news-link ()
|
|
2628 "Adds the HTML tags for a link to a news group."
|
|
2629 (interactive)
|
|
2630 (hm--html-add-news-link-1 'hm--html-add-tags))
|
|
2631
|
|
2632
|
|
2633 (defun hm--html-add-news-link-to-region ()
|
|
2634 "Adds the HTML tags for a link to a news group to the region."
|
|
2635 (interactive)
|
|
2636 (hm--html-add-news-link-1 'hm--html-add-tags-to-region))
|
|
2637
|
|
2638
|
|
2639 (defun hm--html-add-mail-box-link-1 (function-add-tags)
|
|
2640 "Internal function. Adds the HTML tags for a link to a mail box."
|
|
2641 (hm--html-add-link function-add-tags
|
|
2642 (list ; scheme
|
|
2643 ""
|
|
2644 nil
|
|
2645 "http"
|
|
2646 t
|
|
2647 "http")
|
|
2648 (list ; hostname:port
|
|
2649 "Hostname and Port: "
|
|
2650 hm--html-mail-hostname:port-alist
|
|
2651 hm--html-mail-hostname:port-default
|
|
2652 nil
|
|
2653 "www.tnt.uni-hannover.de:8003")
|
|
2654 (list ; servername:port
|
|
2655 ""
|
|
2656 nil
|
|
2657 ""
|
|
2658 t
|
|
2659 nil)
|
|
2660 (list ; path/file
|
|
2661 "Path/File: "
|
|
2662 hm--html-mail-path-alist
|
|
2663 nil
|
|
2664 nil
|
|
2665 "/data/info/mail/mailbox")
|
|
2666 (list ; anchor
|
|
2667 ""
|
|
2668 nil
|
|
2669 ""
|
|
2670 t
|
|
2671 nil
|
|
2672 nil)))
|
|
2673
|
|
2674
|
|
2675 (defun hm--html-add-mail-box-link ()
|
|
2676 "Adds the HTML tags for a link to a mail box."
|
|
2677 (interactive)
|
|
2678 (hm--html-add-mail-link-1 'hm--html-add-tags))
|
|
2679
|
|
2680
|
|
2681 (defun hm--html-add-mail-box-link-to-region ()
|
|
2682 "Adds the HTML tags for a link to a mail box to the region."
|
|
2683 (interactive)
|
|
2684 (hm--html-add-mail-link-1 'hm--html-add-tags-to-region))
|
|
2685
|
|
2686
|
|
2687 (defun hm--html-add-mailto-link-1 (function-add-tags)
|
|
2688 "Internal function. Adds the HTML tags for a mailto link."
|
|
2689 (let ((mailto-alist (if (and (boundp 'user-mail-address)
|
|
2690 user-mail-address)
|
|
2691 (cons (list user-mail-address)
|
|
2692 hm--html-mailto-alist)
|
|
2693 hm--html-mailto-alist)))
|
|
2694 (hm--html-add-link function-add-tags
|
|
2695 (list ; scheme
|
|
2696 ""
|
|
2697 nil
|
|
2698 "mailto"
|
|
2699 t
|
|
2700 "mailto")
|
|
2701 (list ; hostname:port
|
|
2702 ""
|
|
2703 nil
|
|
2704 ""
|
|
2705 t
|
|
2706 nil)
|
|
2707 (list ; servername:port
|
2
|
2708 "Mailaddress: "
|
0
|
2709 mailto-alist
|
|
2710 nil
|
|
2711 nil
|
|
2712 "muenkel@tnt.uni-hannover.de")
|
|
2713 nil ; path/file
|
|
2714 (list ; anchor
|
|
2715 ""
|
|
2716 nil
|
|
2717 ""
|
|
2718 t
|
|
2719 nil
|
|
2720 nil))))
|
|
2721
|
|
2722 (defun hm--html-add-mailto-link ()
|
|
2723 "Adds the HTML tags for a mailto link."
|
|
2724 (interactive)
|
|
2725 (hm--html-add-mailto-link-1 'hm--html-add-tags))
|
|
2726
|
|
2727
|
|
2728 (defun hm--html-add-mailto-link-to-region ()
|
|
2729 "Adds the HTML tags for a mailto link to the region."
|
|
2730 (interactive)
|
|
2731 (hm--html-add-mailto-link-1 'hm--html-add-tags-to-region))
|
|
2732
|
2
|
2733 (defun hm--html-add-relative-link (relative-file-path)
|
|
2734 "Adds the HTML tags for a relative link at the current point."
|
22
|
2735 (interactive (list (file-relative-name
|
|
2736 (read-file-name "Relative Filename: "
|
|
2737 nil
|
|
2738 nil
|
|
2739 nil
|
|
2740 "")
|
|
2741 default-directory)
|
|
2742 ))
|
2
|
2743 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
2744 (concat "<A HREF=\""
|
|
2745 relative-file-path
|
|
2746 "\">")
|
|
2747 'hm--html-insert-end-tag
|
|
2748 "</A>"))
|
|
2749
|
|
2750 (defun hm--html-add-relative-link-to-region (relative-file-path)
|
|
2751 "Adds the HTML tags for a relative link to the region."
|
22
|
2752 (interactive (list (file-relative-name
|
|
2753 (read-file-name "Relative Filename: "
|
|
2754 nil
|
|
2755 nil
|
|
2756 nil
|
|
2757 ""))))
|
0
|
2758 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
2759 (concat "<A HREF=\""
|
2
|
2760 relative-file-path
|
|
2761 "\">")
|
|
2762 'hm--html-insert-end-tag
|
|
2763 "</A>"))
|
|
2764
|
|
2765 (defun hm--html-add-normal-link (link-object)
|
|
2766 "Adds the HTML tags for a normal general link.
|
|
2767 Single argument LINK-OBJECT is value of HREF in the new anchor.
|
|
2768 Mark is set after anchor."
|
|
2769 (interactive "sNode Link to: ")
|
|
2770 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
2771 (concat "<A HREF=\""
|
|
2772 link-object
|
|
2773 "\">")
|
|
2774 'hm--html-insert-end-tag
|
|
2775 "</A>"))
|
|
2776
|
|
2777 (defun hm--html-add-normal-link-to-region (link-object)
|
|
2778 "Adds the HTML tags for a normal general link to region.
|
|
2779 Single argument LINK-OBJECT is value of HREF in the new anchor.
|
|
2780 Mark is set after anchor."
|
|
2781 (interactive "sNode Link to: ")
|
|
2782 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
2783 (concat "<A HREF=\""
|
|
2784 ; (read-string "Link to: ")
|
|
2785 link-object
|
0
|
2786 "\">")
|
|
2787 'hm--html-insert-end-tag
|
|
2788 "</A>"))
|
|
2789
|
|
2790
|
|
2791 (defun hm--html-add-normal-node-link ()
|
|
2792 "Adds the HTML tags for a normal node link (<LINK...>) at the point."
|
|
2793 (interactive)
|
|
2794 (hm--html-insert-start-tag (concat "<LINK HREF=\""
|
|
2795 (read-string "Node Link to: ")
|
|
2796 "\">")
|
|
2797 ))
|
|
2798
|
|
2799 ;;; Functions to update the date and the changelog entries
|
|
2800
|
|
2801
|
|
2802 (defun hm--html-maybe-new-date-and-changed-comment ()
|
|
2803 "Hook function which updates the date in the title line, if
|
|
2804 'hm--html-automatic-new-date' is t and which inserts a
|
|
2805 \"changed comment\" line, if 'hm--html-automatic-changed-comment' is t."
|
|
2806 (if hm--html-automatic-new-date
|
|
2807 (hm--html-new-date))
|
|
2808 (if hm--html-automatic-changed-comment
|
|
2809 (hm--html-insert-changed-comment t)))
|
|
2810
|
|
2811
|
|
2812 (defun hm--html-new-date ()
|
|
2813 "The function sets the date in the title line up."
|
|
2814 (interactive)
|
|
2815 (save-excursion
|
|
2816 (goto-char (point-min))
|
|
2817 (let ((case-fold-search t)
|
|
2818 (end-of-head (if (search-forward "</head>" nil t)
|
|
2819 (point)
|
|
2820 (if (search-forward "<body>" nil t)
|
|
2821 (point)
|
|
2822 (point-max)))))
|
|
2823 (goto-char (point-min))
|
|
2824 (if (re-search-forward
|
|
2825 (concat
|
|
2826 "\\((\\)"
|
|
2827 "\\([ \t]*[0-3]?[0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9][0-9][ \t]*\\)"
|
|
2828 "\\()[ \t\n]*</title>\\)")
|
|
2829 end-of-head
|
|
2830 t)
|
|
2831 (progn
|
|
2832 (delete-region (match-beginning 2) (match-end 2))
|
|
2833 (goto-char (match-beginning 2))
|
|
2834 (insert (hm--date)))))))
|
|
2835
|
|
2836
|
|
2837 (defun hm--html-insert-created-comment (&optional noerror)
|
|
2838 "The function inserts a \"created comment\".
|
|
2839 The comment looks like <!-- Created by: Heiko Münkel, 10-Dec-1993 -->.
|
|
2840 The comment will be inserted after the title line.
|
|
2841 An error message is printed, if there is no title line and if
|
|
2842 noerror is nil."
|
|
2843 (interactive)
|
|
2844 (save-excursion
|
|
2845 (goto-char (point-min))
|
|
2846 (let ((case-fold-search t)
|
|
2847 (end-of-head (if (search-forward "</head>" nil t)
|
|
2848 (point)
|
|
2849 (if (search-forward "<body>" nil t)
|
|
2850 (point)
|
|
2851 (point-max)))))
|
|
2852 (goto-char (point-min))
|
|
2853 (if (not (search-forward "</title>" end-of-head t))
|
|
2854 (if (not noerror)
|
|
2855 (error "ERROR: Please insert a title in the document !"))
|
|
2856 (let ((end-of-title-position (point)))
|
|
2857 (if (search-forward "<!-- Created by: " end-of-head t)
|
|
2858 (if (yes-or-no-p
|
|
2859 "Replace the old comment \"<!-- Created by: \" ")
|
|
2860 (progn
|
|
2861 (goto-char (match-beginning 0))
|
|
2862 (kill-line)
|
|
2863 (hm--html-add-comment)
|
|
2864 (insert "Created by: "
|
|
2865 (or hm--html-username (user-full-name))
|
|
2866 ", "
|
|
2867 (hm--date))))
|
|
2868 (newline)
|
|
2869 (hm--html-add-comment)
|
|
2870 (insert "Created by: "
|
|
2871 (or hm--html-username (user-full-name))
|
|
2872 ", "
|
|
2873 (hm--date)
|
|
2874 )))))))
|
|
2875
|
|
2876
|
|
2877 (defun hm--html-insert-changed-comment-1 (newline username)
|
|
2878 "Internal function of 'hm--html-insert-changed-comment'.
|
|
2879 Inserts a newline if NEWLINE is t, before the comment is inserted.
|
|
2880 USERNAME is the name to be inserted in the comment."
|
|
2881 (if newline
|
|
2882 (progn
|
|
2883 ; (end-of-line)
|
|
2884 (newline)))
|
|
2885 (hm--html-add-comment)
|
|
2886 (insert "Changed by: " username ", " (hm--date)))
|
|
2887
|
|
2888 (defun hm--html-insert-changed-comment (&optional noerror)
|
|
2889 "The function inserts a \"changed comment\".
|
|
2890 The comment looks like <!-- Changed by: Heiko Münkel, 10-Dec-1993 -->.
|
|
2891 The comment will be inserted after the last \"changed comment\" line, or,
|
|
2892 if there isn't such a line, after the \"created comment\" line, or,
|
|
2893 after the title line. If there is no title and NOERROR is nil, an error
|
|
2894 message is generated. The line is not inserted after the end of the head
|
|
2895 or the beginning of the body.
|
|
2896 If the last \"changed line\" is from the same author, it is only replaced
|
|
2897 by the new one.
|
|
2898
|
|
2899 Attention: Don't change the format of the lines and don't write anything
|
|
2900 else in such a line !"
|
|
2901 (interactive)
|
|
2902 (save-excursion
|
|
2903 (goto-char (point-min))
|
|
2904 (let ((case-fold-search t)
|
|
2905 (end-of-head (if (search-forward "</head>" nil t)
|
|
2906 (point)
|
|
2907 (if (search-forward "<body>" nil t)
|
|
2908 (point)
|
|
2909 (point-max))))
|
|
2910 (username (or hm--html-username (user-full-name))))
|
|
2911 (goto-char end-of-head)
|
|
2912 (if (search-backward "<!-- Changed by: " nil t)
|
|
2913 (if (string-match username
|
|
2914 (buffer-substring (point)
|
|
2915 (progn
|
|
2916 (end-of-line)
|
|
2917 (point))))
|
|
2918 ;; exchange the comment line
|
|
2919 (progn
|
|
2920 (beginning-of-line)
|
|
2921 (delete-region (point) (progn
|
|
2922 (end-of-line)
|
|
2923 (point)))
|
|
2924 (hm--html-insert-changed-comment-1 nil username))
|
|
2925 ;; new comment line
|
|
2926 (end-of-line)
|
|
2927 (hm--html-insert-changed-comment-1 t username))
|
|
2928 (if (search-backward "<!-- Created by: " nil t)
|
|
2929 (progn
|
|
2930 (end-of-line)
|
|
2931 (hm--html-insert-changed-comment-1 t username))
|
|
2932 (if (search-backward "</title>" nil t)
|
|
2933 (progn
|
|
2934 (goto-char (match-end 0))
|
|
2935 (if (not (looking-at "\n"))
|
|
2936 (progn
|
|
2937 (newline)
|
|
2938 (forward-char -1)))
|
|
2939 (hm--html-insert-changed-comment-1 t username))
|
|
2940 (if (not noerror)
|
|
2941 (error
|
|
2942 "ERROR: Insert at first a title in the document !"))))))))
|
|
2943
|
|
2944
|
|
2945
|
|
2946 ;;; Functions to insert templates
|
|
2947
|
|
2948 (defvar hm--html-template-file-history nil
|
22
|
2949 "Historyvariable for the template files in the `hm--html-mode'.")
|
0
|
2950
|
|
2951 (defun hm--html-insert-template (filename)
|
22
|
2952 "Inserts a templatefile.
|
|
2953 It uses `tmpl-insert-template-file' to insert
|
|
2954 the templates. The variables `tmpl-template-dir-list',
|
|
2955 `tmpl-automatic-expand' and `tmpl-history-variable-name' are
|
|
2956 overwritten by `hm--html-template-dir',
|
|
2957 `hm--html-automatic-expand-templates' and `hm--html-template-file-history'."
|
|
2958 (interactive (list nil))
|
|
2959 (let ((tmpl-template-dir-list (if (listp hm--html-template-dir)
|
|
2960 hm--html-template-dir
|
|
2961 (list hm--html-template-dir)))
|
|
2962 (tmpl-automatic-expand hm--html-automatic-expand-templates)
|
|
2963 (tmpl-history-variable-name 'hm--html-template-file-history))
|
|
2964 (if filename
|
|
2965 (tmpl-insert-template-file filename)
|
|
2966 (call-interactively 'tmpl-insert-template-file))
|
|
2967 ; (if hm--html-automatic-created-comment ; better in the template files
|
|
2968 ; (hm--html-insert-created-comment t)
|
|
2969 ))
|
|
2970
|
|
2971 (defun hm--html-insert-template-from-fixed-dirs (filename)
|
|
2972 "Inserts a templatefile.
|
|
2973 It uses `tmpl-insert-template-file-from-fixed-dirs' to insert
|
|
2974 the templates. The variables `tmpl-template-dir-list',
|
|
2975 `tmpl-automatic-expand', `tmpl-filter-regexp' and
|
|
2976 `tmpl-history-variable-name' are overwritten by
|
|
2977 `hm--html-template-dir', `hm--html-automatic-expand-templates',
|
|
2978 `hm--html-template-filter-regexp' and `hm--html-template-file-history'."
|
|
2979 (interactive (list nil))
|
|
2980 (let ((tmpl-template-dir-list (if (listp hm--html-template-dir)
|
|
2981 hm--html-template-dir
|
|
2982 (list hm--html-template-dir)))
|
|
2983 (tmpl-automatic-expand hm--html-automatic-expand-templates)
|
|
2984 (tmpl-filter-regexp hm--html-template-filter-regexp)
|
|
2985 (tmpl-history-variable-name 'hm--html-template-file-history))
|
|
2986 (if filename
|
|
2987 (tmpl-insert-template-file-from-fixed-dirs filename)
|
|
2988 (call-interactively 'tmpl-insert-template-file-from-fixed-dirs))
|
|
2989 ; (if hm--html-automatic-created-comment ; better in the template files
|
|
2990 ; (hm--html-insert-created-comment t)
|
|
2991 ))
|
|
2992
|
|
2993 ;(defun hm--html-insert-template (filename)
|
|
2994 ; "Inserts a templatefile."
|
|
2995 ; (interactive
|
|
2996 ; (list (tmpl-read-template-filename hm--html-template-dir
|
|
2997 ; hm--html-automatic-expand-templates
|
|
2998 ; hm--html-template-filter-regexp
|
|
2999 ; 'hm--html-template-file-history)))
|
|
3000 ; (interactive (list
|
|
3001 ; (let ((file-name-history hm--html-template-file-history))
|
|
3002 ; (read-file-name "Templatefile: "
|
|
3003 ; hm--html-template-dir
|
|
3004 ; nil
|
|
3005 ; t
|
|
3006 ; nil))))
|
|
3007 ;; 'hm--html-template-file-history)))
|
|
3008 ; (insert-file (expand-file-name filename))
|
|
3009 ; (if hm--html-automatic-expand-templates
|
|
3010 ; (tmpl-expand-templates-in-buffer))
|
|
3011 ; (if hm--html-automatic-created-comment
|
|
3012 ; (hm--html-insert-created-comment t)))
|
0
|
3013
|
|
3014
|
|
3015
|
|
3016 ;;; Functions for highlighting
|
|
3017
|
|
3018 ;(defun hm--html-toggle-use-highlighting ()
|
|
3019 ; "Toggles the variable html-use-highlighting."
|
|
3020 ; (interactive)
|
|
3021 ; (if html-use-highlighting
|
|
3022 ; (setq html-use-highlighting nil)
|
|
3023 ; (setq html-use-highlighting t)))
|
|
3024
|
|
3025
|
|
3026 ;;; Functions for font lock mode
|
|
3027
|
2
|
3028 (if (adapt-emacs19p)
|
0
|
3029 (progn
|
|
3030 (make-face 'font-lock-comment-face)
|
|
3031 (make-face 'font-lock-doc-string-face)
|
|
3032 (make-face 'font-lock-string-face)
|
|
3033 (or (face-differs-from-default-p 'font-lock-doc-string-face)
|
|
3034 (copy-face 'font-lock-comment-face 'font-lock-doc-string-face))
|
|
3035 (or (face-differs-from-default-p 'font-lock-comment-face)
|
|
3036 (copy-face 'italic 'font-lock-comment-face))
|
|
3037 (or (face-differs-from-default-p 'font-lock-string-face)
|
|
3038 (progn
|
|
3039 (copy-face 'font-lock-doc-string-face 'font-lock-string-face)
|
|
3040 (set-face-underline-p 'font-lock-string-face t)))
|
|
3041 (setq font-lock-comment-face 'font-lock-comment-face)
|
|
3042 ;; (setq font-lock-doc-string-face 'font-lock-doc-string-face)
|
|
3043 (setq font-lock-string-face 'font-lock-string-face)))
|
|
3044
|
|
3045
|
|
3046 ;(defun hm--html-set-font-lock-color ()
|
|
3047 ; "Sets the color for the font lock mode in HTML mode.
|
|
3048 ;This color is used to highlight HTML expressions."
|
|
3049 ; (interactive)
|
|
3050 ; (setq hm--html-font-lock-color
|
|
3051 ; (completing-read "Color: "
|
|
3052 ; '(("grey80")
|
|
3053 ; ("black")
|
|
3054 ; ("red")
|
|
3055 ; ("yellow")
|
|
3056 ; ("blue"))
|
|
3057 ; nil
|
|
3058 ; nil
|
|
3059 ; "black"))
|
|
3060 ; (set-face-foreground 'font-lock-comment-face hm--html-font-lock-color)
|
|
3061 ; (set-face-foreground 'font-lock-string-face hm--html-font-lock-color))
|
|
3062
|
|
3063
|
|
3064 ;;; Functions which determine if an active region exists
|
|
3065
|
|
3066 ;(defvar hm--region-active nil
|
|
3067 ; "t : Region is active.
|
|
3068 ;nil: Region is inactive.")
|
|
3069 ;
|
|
3070 ;
|
|
3071 ;(defun hm--set-hm--region-active ()
|
|
3072 ; (setq hm--region-active t))
|
|
3073 ;
|
|
3074 ;
|
|
3075 ;(defun hm--unset-hm--region-active ()
|
|
3076 ; (setq hm--region-active nil))
|
|
3077
|
|
3078
|
|
3079
|
|
3080 ;;; Functions to insert forms
|
|
3081
|
|
3082 (defun hm--html-form-read-method ()
|
|
3083 "Reads the method for a form."
|
|
3084 (completing-read "Method of the form: "
|
|
3085 '(("POST") ("GET"))
|
|
3086 nil
|
|
3087 t
|
|
3088 "POST"))
|
|
3089
|
|
3090
|
|
3091 (defun hm--html-form-read-action (method)
|
|
3092 "Reads the URL for the action attribute of a form.
|
|
3093 It returns nil if no action attribute is wanted.
|
|
3094 METHOD is the method of the form."
|
|
3095 (if (y-or-n-p "Current document URL as action attribute ? ")
|
|
3096 nil
|
|
3097 (hm--html-read-url "Query server URL: "
|
|
3098 hm--html-url-alist
|
|
3099 (function
|
|
3100 (lambda (table-element-list)
|
|
3101 (hm--html-read-url-predicate table-element-list
|
|
3102 (car
|
|
3103 (read-from-string
|
|
3104 method)))))
|
|
3105 nil
|
|
3106 nil)))
|
|
3107
|
|
3108
|
|
3109 (defun hm--html-add-form (&optional method)
|
|
3110 "Adds the HTML tags for a form.
|
|
3111 The function asks only for a method, if METHOD is nil, otherwise
|
|
3112 the METHOD must have one of the values \"GET\" or \"POST\"."
|
|
3113 (interactive)
|
|
3114 (let* ((method (or method (hm--html-form-read-method)))
|
|
3115 (action (hm--html-form-read-action method)))
|
|
3116 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
3117 (concat "<FORM METHOD=\""
|
|
3118 method
|
|
3119 "\""
|
|
3120 (if action
|
|
3121 (concat " ACTION=\""
|
|
3122 action
|
|
3123 "\"")
|
|
3124 "")
|
|
3125 ">")
|
|
3126 'hm--html-insert-end-tag-with-newline
|
|
3127 "</FORM>")))
|
|
3128
|
|
3129
|
|
3130 (defun hm--html-add-form-to-region (&optional method)
|
|
3131 "Adds the HTML tags for a form to a region.
|
|
3132 The function asks only for a method, if METHOD is nil, otherwise
|
|
3133 the METHOD must have one of the values \"GET\" or \"POST\"."
|
|
3134 (interactive)
|
|
3135 (let* ((method (or method (hm--html-form-read-method)))
|
|
3136 (action (hm--html-form-read-action method)))
|
|
3137 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
3138 (concat "<FORM METHOD=\""
|
|
3139 method
|
|
3140 "\""
|
|
3141 (if action
|
|
3142 (concat " ACTION=\""
|
|
3143 action
|
|
3144 "\"")
|
|
3145 "")
|
|
3146 ">")
|
|
3147 'hm--html-insert-end-tag-with-newline
|
|
3148 "</FORM>")))
|
|
3149
|
|
3150
|
|
3151 (defun hm--html-form-read-name (&optional last-name)
|
|
3152 "Reads the name for an input tag."
|
|
3153 (read-string "Symbolic name: " last-name))
|
|
3154
|
|
3155
|
|
3156 (defun hm--html-form-read-value (prompt &optional initial-contents)
|
|
3157 "Reads the value for an input tag."
|
|
3158 (read-string prompt initial-contents))
|
|
3159
|
|
3160
|
|
3161 (defun hm--html-form-read-checked ()
|
|
3162 "Reads whether a button is checked by default or not."
|
|
3163 (y-or-n-p "Should the button be checked by default ? "))
|
|
3164
|
|
3165
|
|
3166 (defun hm--html-form-read-size ()
|
|
3167 "Reads the size of text entry fields of input tags."
|
|
3168 (if (y-or-n-p "Defaultsize of the Inputfield ? ")
|
|
3169 nil
|
|
3170 (format "%d,%d"
|
|
3171 (read-number "Width of the input field: " t)
|
|
3172 (read-number "Height of the input field: " t))))
|
|
3173
|
|
3174
|
|
3175 (defun hm--html-form-read-maxlength ()
|
|
3176 "Reads the maxlength of text entry fields of input tags."
|
|
3177 (let ((maxlength (read-number "Maximum number of chars (0 = unlimited): "
|
|
3178 t)))
|
|
3179 (if (<= maxlength 0)
|
|
3180 nil
|
|
3181 (int-to-string maxlength))))
|
|
3182
|
|
3183
|
|
3184 (defun hm--html-form-read-src (prompt &optional initial-contents)
|
|
3185 "Reads the src for an input tag."
|
|
3186 (read-string prompt initial-contents))
|
|
3187
|
|
3188
|
|
3189 (defun hm--html-form-add-input (type
|
|
3190 name
|
|
3191 value
|
|
3192 checked
|
|
3193 size
|
|
3194 maxlength
|
|
3195 &optional src)
|
|
3196 "Adds the HTML tags for an input tag to the buffer."
|
|
3197 (hm--html-insert-start-tag (concat "<INPUT TYPE=\""
|
|
3198 type
|
|
3199 "\""
|
|
3200 (if (and name (not (string= name "")))
|
|
3201 (concat " NAME=\"" name "\""))
|
|
3202 (if (and value (not (string= value "")))
|
|
3203 (concat " VALUE=\"" value "\""))
|
|
3204 (if checked " CHECKED")
|
|
3205 (if (and size (not (string= size "")))
|
|
3206 (concat " SIZE=" size))
|
|
3207 (if (and maxlength
|
|
3208 (not (string= maxlength "")))
|
|
3209 (concat " MAXLENGTH="
|
|
3210 maxlength
|
|
3211 ))
|
|
3212 (if (and src
|
|
3213 (not (string= src "")))
|
|
3214 (concat " SRC=\""
|
|
3215 src
|
|
3216 "\""))
|
|
3217 ">")))
|
|
3218
|
|
3219
|
|
3220 (defun hm--html-form-add-input-text (name value size maxlength)
|
|
3221 "Adds the HTML tags for a text input field."
|
|
3222 (interactive (list (hm--html-form-read-name)
|
|
3223 (hm--html-form-read-value "Defaultvalue: ")
|
|
3224 (hm--html-form-read-size)
|
|
3225 (hm--html-form-read-maxlength)))
|
|
3226 (hm--html-form-add-input "text" name value nil size maxlength))
|
|
3227
|
|
3228
|
|
3229 (defun hm--html-form-add-input-password (name value size maxlength)
|
|
3230 "Adds the HTML tags for a password input field."
|
|
3231 (interactive (list (hm--html-form-read-name)
|
|
3232 (hm--html-form-read-value "Defaultvalue: ")
|
|
3233 (hm--html-form-read-size)
|
|
3234 (hm--html-form-read-maxlength)))
|
|
3235 (hm--html-form-add-input "password" name value nil size maxlength))
|
|
3236
|
|
3237
|
|
3238 (defun hm--html-form-add-input-integer (name value size maxlength)
|
|
3239 "Adds the HTML tags for a integer input field."
|
|
3240 (interactive (list (hm--html-form-read-name)
|
|
3241 (hm--html-form-read-value "Defaultvalue: ")
|
|
3242 (hm--html-form-read-size)
|
|
3243 (hm--html-form-read-maxlength)))
|
|
3244 (hm--html-form-add-input "int" name value nil size maxlength))
|
|
3245
|
|
3246
|
|
3247 (defun hm--html-form-add-input-float (name value size maxlength)
|
|
3248 "Adds the HTML tags for a float input field."
|
|
3249 (interactive (list (hm--html-form-read-name)
|
|
3250 (hm--html-form-read-value "Defaultvalue: ")
|
|
3251 (hm--html-form-read-size)
|
|
3252 (hm--html-form-read-maxlength)))
|
|
3253 (hm--html-form-add-input "float" name value nil size maxlength))
|
|
3254
|
|
3255
|
|
3256 (defun hm--html-form-add-input-date (name value size maxlength)
|
|
3257 "Adds the HTML tags for a date input field."
|
|
3258 (interactive (list (hm--html-form-read-name)
|
|
3259 (hm--html-form-read-value "Defaultvalue: ")
|
|
3260 (hm--html-form-read-size)
|
|
3261 (hm--html-form-read-maxlength)))
|
|
3262 (hm--html-form-add-input "date" name value nil size maxlength))
|
|
3263
|
|
3264
|
|
3265 (defun hm--html-form-add-input-url (name value size maxlength)
|
|
3266 "Adds the HTML tags for a url input field."
|
|
3267 (interactive (list (hm--html-form-read-name)
|
|
3268 (hm--html-form-read-value "Defaultvalue: ")
|
|
3269 (hm--html-form-read-size)
|
|
3270 (hm--html-form-read-maxlength)))
|
|
3271 (hm--html-form-add-input "url" name value nil size maxlength))
|
|
3272
|
|
3273
|
|
3274 (defun hm--html-form-add-input-scribble (name value size maxlength)
|
|
3275 "Adds the HTML tags for a scribble input field."
|
|
3276 (interactive (list (hm--html-form-read-name)
|
|
3277 (hm--html-form-read-value "Defaultvalue: ")
|
|
3278 (hm--html-form-read-size)
|
|
3279 (hm--html-form-read-maxlength)))
|
|
3280 (hm--html-form-add-input "scribble" name value nil size maxlength))
|
|
3281
|
|
3282
|
|
3283 (defun hm--html-form-add-input-checkbox (name value checked)
|
|
3284 "Adds the HTML tags for a checkbox button."
|
|
3285 (interactive (list (hm--html-form-read-name)
|
|
3286 (hm--html-form-read-value "Checkbox value: ")
|
|
3287 (hm--html-form-read-checked)))
|
|
3288 (hm--html-form-add-input "checkbox" name value checked nil nil))
|
|
3289
|
|
3290
|
|
3291 (defvar hm--html-last-radio-button-name nil
|
|
3292 "Name of the last radio button.")
|
|
3293
|
|
3294
|
|
3295 (defun hm--html-form-add-input-radio (name value checked)
|
|
3296 "Adds the HTML tags for a radio button."
|
|
3297 (interactive (list (hm--html-form-read-name hm--html-last-radio-button-name)
|
|
3298 (hm--html-form-read-value "Radiobutton value: ")
|
|
3299 (hm--html-form-read-checked)))
|
|
3300 (setq hm--html-last-radio-button-name name)
|
|
3301 (hm--html-form-add-input "radio" name value checked nil nil))
|
|
3302
|
|
3303
|
|
3304 (defun hm--html-form-add-input-submit (value)
|
|
3305 "Adds the HTML tags for a submit input field."
|
|
3306 (interactive (list (hm--html-form-read-value
|
|
3307 "Label of the submit button: "
|
|
3308 "Submit")))
|
|
3309 (hm--html-form-add-input "submit" nil value nil nil nil))
|
|
3310
|
|
3311
|
|
3312 (defun hm--html-form-add-input-image (name src)
|
|
3313 "Adds the HTML tags for an image input field."
|
|
3314 (interactive (list (hm--html-form-read-name)
|
|
3315 (hm--html-read-url "Image URL: "
|
|
3316 hm--html-url-alist
|
|
3317 (function
|
|
3318 (lambda (table-element-list)
|
|
3319 (hm--html-read-url-predicate
|
|
3320 table-element-list
|
|
3321 'IMAGE)))
|
|
3322 nil
|
|
3323 nil)))
|
|
3324 (hm--html-form-add-input "IMAGE"
|
|
3325 name
|
|
3326 nil
|
|
3327 nil
|
|
3328 nil
|
|
3329 nil
|
|
3330 src))
|
|
3331
|
|
3332
|
|
3333 (defun hm--html-form-add-input-audio (name src)
|
|
3334 "Adds the HTML tags for an audio input field."
|
|
3335 (interactive (list (hm--html-form-read-name)
|
|
3336 (hm--html-read-url "Audio URL: "
|
|
3337 hm--html-url-alist
|
|
3338 (function
|
|
3339 (lambda (table-element-list)
|
|
3340 (hm--html-read-url-predicate
|
|
3341 table-element-list
|
|
3342 'AUDIO)))
|
|
3343 nil
|
|
3344 nil)))
|
|
3345 (hm--html-form-add-input "AUDIO"
|
|
3346 name
|
|
3347 nil
|
|
3348 nil
|
|
3349 nil
|
|
3350 nil
|
|
3351 src))
|
|
3352
|
|
3353
|
|
3354 (defun hm--html-form-add-input-reset (value)
|
|
3355 "Adds the HTML tags for a reset input field."
|
|
3356 (interactive (list (hm--html-form-read-value
|
|
3357 "Label of the reset button: "
|
|
3358 "Reset")))
|
|
3359 (hm--html-form-add-input "reset" nil value nil nil nil))
|
|
3360
|
|
3361
|
|
3362 (defun hm--html-form-add-input-isindex (size)
|
|
3363 "Adds the HTML tags for an isindex input field.
|
|
3364 Size is the value of the input field wide."
|
|
3365 (interactive "nWidth of the input field (i.e: 20): ")
|
|
3366 (hm--html-insert-start-tag (concat "<INPUT NAME=\"isindex\""
|
|
3367 (if (= size 20)
|
|
3368 ">"
|
|
3369 (format
|
|
3370 " SIZE=%d>"
|
|
3371 size)))))
|
|
3372
|
|
3373
|
|
3374 (defun hm--html-form-add-select-option-menu (name)
|
|
3375 "Adds the HTML tags for a select option menu to the buffer."
|
|
3376 (interactive (list (hm--html-form-read-name)))
|
|
3377 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
3378 (concat "<SELECT NAME=\"" name "\">")
|
|
3379 'hm--html-insert-end-tag-with-newline
|
|
3380 "</SELECT>"
|
|
3381 'hm--html-insert-start-tag
|
|
3382 "<OPTION> "))
|
|
3383
|
|
3384
|
|
3385 (defun hm--html-form-add-select-scrolled-list (name listsize multiple)
|
|
3386 "Adds the HTML tags for a select scrolled list to the buffer."
|
|
3387 (interactive (list (hm--html-form-read-name)
|
|
3388 (read-number "No of visible items (>1): " t)
|
|
3389 (y-or-n-p "Multiple selections allowed ? ")))
|
|
3390 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
3391 (concat "<SELECT NAME=\""
|
|
3392 name
|
|
3393 "\" SIZE="
|
|
3394 (int-to-string listsize)
|
|
3395 (if multiple
|
|
3396 " MULTIPLE")
|
|
3397 ">")
|
|
3398 'hm--html-insert-end-tag-with-newline
|
|
3399 "</SELECT>"
|
|
3400 'hm--html-insert-start-tag
|
|
3401 "<OPTION> "))
|
|
3402
|
|
3403
|
|
3404 (defun hm--html-form-add-select-option (selected-by-default)
|
|
3405 "Adds the tags for an option in a select form menu."
|
|
3406 (interactive (list (y-or-n-p "Select this option by default ? ")))
|
|
3407 (hm--html-insert-end-tag-with-newline (concat "<OPTION"
|
|
3408 (if selected-by-default
|
|
3409 " SELECTED")
|
|
3410 "> ")))
|
|
3411
|
|
3412
|
|
3413 (defun hm--html-form-add-textarea (name rows columns)
|
|
3414 "Adds the tags for a textarea tag."
|
|
3415 (interactive (list (hm--html-form-read-name)
|
|
3416 (read-number "Number of Rows of the Textarea: " t)
|
|
3417 (read-number "Number of Columns of the Textarea: " t)))
|
|
3418 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
3419 (concat "<TEXTAREA NAME=\""
|
|
3420 name
|
|
3421 "\" ROWS="
|
|
3422 (int-to-string rows)
|
|
3423 " COLS="
|
|
3424 (int-to-string columns)
|
|
3425 ">")
|
|
3426 'hm--html-insert-end-tag
|
|
3427 "</TEXTAREA>"))
|
|
3428
|
|
3429
|
|
3430 ;;; Functions to insert tables
|
|
3431
|
|
3432 (defun hm--html-add-table (border compact)
|
|
3433 "Add the HTML tags for a table frame.
|
|
3434 If BORDER is t, then the table should be drawn with a border.
|
|
3435 If COMPACT is t, then the table should be drawn in a smaller size."
|
|
3436 (interactive (list (y-or-n-p "Use a table with a border? ")
|
|
3437 (y-or-n-p "Use a small table? ")))
|
|
3438 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
|
|
3439 (concat "<TABLE"
|
|
3440 (if border " border" "")
|
|
3441 (if compact " compact" "")
|
|
3442 ">")
|
|
3443 'hm--html-insert-start-tag-with-newline
|
|
3444 "</TABLE>")
|
|
3445 (backward-char))
|
|
3446
|
|
3447
|
|
3448 (defun hm--html-add-table-to-region (border compact)
|
|
3449 "Add the HTML tags for a table frame.
|
|
3450 If BORDER is t, then the table should be drawn with a border.
|
|
3451 If COMPACT is t, then the table should be drawn in a smaller size."
|
|
3452 (interactive (list (y-or-n-p "Use a table with a border? ")
|
|
3453 (y-or-n-p "Use a small table? ")))
|
|
3454 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
|
|
3455 (concat "<TABLE"
|
|
3456 (if border " border" "")
|
|
3457 (if compact " compact" "")
|
|
3458 ">")
|
|
3459 'hm--html-insert-start-tag-with-newline
|
|
3460 "</TABLE>"))
|
|
3461
|
|
3462
|
|
3463 (defun hm--html-add-table-title (top)
|
|
3464 "Adds the HTML tag for a table title at the current point.
|
|
3465 If TOP is t, then the title will positioned at the top instead of the
|
|
3466 bottom of the table."
|
|
3467 (interactive (list (y-or-n-p "Put the title at the table top? ")))
|
|
3468 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
3469 (concat "\n<CAPTION"
|
|
3470 (if top " align=top" " align=bottom")
|
|
3471 "> ")
|
|
3472 'hm--html-insert-end-tag
|
|
3473 " </CAPTION>"))
|
|
3474
|
|
3475
|
|
3476 (defun hm--html-add-table-title-to-region (top)
|
|
3477 "Adds the HTML tag for a table title to the region.
|
|
3478 If TOP is t, then the title will positioned at the top instead of the
|
|
3479 bottom of the table."
|
|
3480 (interactive (list (y-or-n-p "Put the title at the table top? ")))
|
|
3481 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
3482 (concat "<CAPTION"
|
|
3483 (if top " align=top" " align=bottom")
|
|
3484 "> ")
|
|
3485 'hm--html-insert-end-tag
|
|
3486 " </CAPTION>"))
|
|
3487
|
|
3488
|
|
3489 (defvar hm--html-table-alignment-alist '(("default")
|
|
3490 ("left")
|
|
3491 ("right")
|
|
3492 ("center"))
|
|
3493 "Alist with table alignments.")
|
|
3494
|
|
3495 (defun hm--html-table-read-cell-entries-and-alignments (cell-no
|
|
3496 no-of-cells
|
|
3497 &optional
|
|
3498 alignment-list)
|
|
3499 "Reads the alignments and the entries for NO-OF-CELLS cells.
|
|
3500 The return is a list with strings of the form: \"align=left> entry\".
|
|
3501 CELL-NO is the current cell no.
|
|
3502 If (car ALIGNMENT-LIST) is non-nil, then it is used as alignment."
|
|
3503 (if (> cell-no no-of-cells)
|
|
3504 nil
|
|
3505 (let ((alignment
|
|
3506 (or (car alignment-list)
|
|
3507 (completing-read (format "Alignment of the %d. cell: "
|
|
3508 cell-no)
|
|
3509 hm--html-table-alignment-alist
|
|
3510 nil
|
|
3511 t
|
|
3512 "default")))
|
|
3513 (entry (read-string (format "Entry of the %d. cell: " cell-no))))
|
|
3514 (if (string= "default" alignment)
|
|
3515 (setq alignment "")
|
|
3516 (setq alignment (concat " align=" alignment)))
|
|
3517 (cons (concat alignment "> " entry)
|
|
3518 (hm--html-table-read-cell-entries-and-alignments (1+ cell-no)
|
|
3519 no-of-cells
|
|
3520 (cdr
|
|
3521 alignment-list))
|
|
3522 ))))
|
|
3523
|
|
3524 (defun hm--html-add-table-header (no-of-cells)
|
|
3525 "Adds the HTML tags for a complete simple table header line.
|
|
3526 It asks for the number of cells and the allignment of the cells.
|
|
3527 The number of cells can also be given as prefix argument."
|
|
3528 (interactive "NNo of cells in a row: ")
|
|
3529 (if (< no-of-cells 1)
|
|
3530 (error "ERROR: There must be at least one cell in a row!"))
|
|
3531 (hm--html-add-tags
|
|
3532 'hm--html-insert-end-tag-with-newline
|
22
|
3533 (concat "<TR>"
|
|
3534 (mapconcat '(lambda (entry)
|
|
3535 (concat "<TH" entry))
|
|
3536 (hm--html-table-read-cell-entries-and-alignments
|
|
3537 1
|
|
3538 no-of-cells)
|
|
3539 " </TH>")
|
|
3540 " </TH></TR>")))
|
0
|
3541
|
|
3542
|
|
3543 (defun hm--html-add-first-table-row (no-of-cells)
|
|
3544 "Adds the HTML tags for a table row.
|
|
3545 It asks for the number of cells and the allignment of the cells.
|
|
3546 The number of cells can also be given as prefix argument."
|
|
3547 (interactive "NNo of cells in a row: ")
|
|
3548 (if (< no-of-cells 1)
|
|
3549 (error "ERROR: There must be at least one cell in a row!"))
|
|
3550 (hm--html-add-tags
|
|
3551 'hm--html-insert-end-tag-with-newline
|
22
|
3552 (concat "<TR><TD"
|
|
3553 (car (hm--html-table-read-cell-entries-and-alignments 1 1))
|
|
3554 " </TD>"
|
0
|
3555 (if (<= no-of-cells 1)
|
22
|
3556 "</TR>"
|
0
|
3557 (concat
|
|
3558 (mapconcat '(lambda (entry)
|
|
3559 (concat "<TD" entry))
|
|
3560 (hm--html-table-read-cell-entries-and-alignments
|
|
3561 2 no-of-cells)
|
22
|
3562 " </TD>")
|
|
3563 " </TD></TR>")))))
|
0
|
3564
|
|
3565
|
|
3566 (defun hm--html-table-get-previous-alignments ()
|
|
3567 "Returns a list with the alignments of the previous table row.
|
|
3568 The row must be a data row and not a header row!
|
|
3569 An example for the return list: '(\"left\" \"default\" \"center\" \"right\")"
|
|
3570 (save-excursion
|
|
3571 (let* ((point-of-view (point))
|
22
|
3572 (case-fold-search t)
|
|
3573 (end-of-last-row (search-backward "</tr>" (point-min) t))
|
|
3574 (begin-of-last-row (progn (search-backward "<tr" (point-min) t)
|
|
3575 (re-search-forward "<t[dh]"
|
|
3576 point-of-view t)
|
0
|
3577 (match-beginning 0)))
|
|
3578 (alignment-list nil))
|
22
|
3579 (goto-char begin-of-last-row)
|
|
3580 (if (not (re-search-forward "<t[dh]" end-of-last-row t))
|
0
|
3581 (error "Error: No previous data row found!")
|
|
3582 (goto-char end-of-last-row)
|
|
3583 (while (> (point) begin-of-last-row)
|
|
3584 (let ((cell-start
|
|
3585 (search-backward-regexp "\\(<td[^>]*>\\)\\|\\(<th[^>]*>\\)"
|
|
3586 begin-of-last-row
|
|
3587 t)))
|
|
3588 (if (not cell-start)
|
|
3589 (goto-char begin-of-last-row)
|
|
3590 (setq alignment-list
|
|
3591 (cons
|
|
3592 (if (search-forward-regexp "\\(align=\\)\\([^ \t\n>]*\\)"
|
|
3593 (match-end 0)
|
|
3594 t)
|
|
3595 (buffer-substring (match-beginning 2)
|
|
3596 (match-end 2))
|
|
3597 "default")
|
|
3598 alignment-list))
|
|
3599 (goto-char cell-start))))
|
|
3600 alignment-list))))
|
|
3601
|
|
3602
|
|
3603 (defun hm--html-add-additional-table-row ()
|
|
3604 "Adds the HTML tags for a table row.
|
|
3605 It tries to detect the number of cells and their alignments
|
|
3606 from existing rows of the table."
|
|
3607 (interactive)
|
|
3608 (let* ((old-alignment-list (hm--html-table-get-previous-alignments))
|
|
3609 (no-of-cells (length old-alignment-list)))
|
|
3610 (hm--html-add-tags
|
|
3611 'hm--html-insert-end-tag-with-newline
|
22
|
3612 (concat "<TR><TD" (car (hm--html-table-read-cell-entries-and-alignments
|
|
3613 1
|
|
3614 1
|
|
3615 old-alignment-list))
|
|
3616 " </TD>"
|
0
|
3617 (if (<= no-of-cells 1)
|
22
|
3618 "</TR>"
|
0
|
3619 (concat
|
|
3620 (mapconcat '(lambda (entry)
|
|
3621 (concat "<TD" entry))
|
|
3622 (hm--html-table-read-cell-entries-and-alignments
|
|
3623 2
|
|
3624 no-of-cells
|
|
3625 (cdr old-alignment-list))
|
22
|
3626 " </TD>")
|
|
3627 " </TD></TR>"))))))
|
0
|
3628
|
|
3629
|
|
3630 (defun hm--html-add-row-entry (alignment)
|
|
3631 "Adds the HTML tag for a table row entry at the current point."
|
|
3632 (interactive (list (completing-read "Alignment of the cell: "
|
|
3633 hm--html-table-alignment-alist
|
|
3634 nil
|
|
3635 t
|
|
3636 "default")))
|
|
3637 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
3638 (concat "<TD"
|
|
3639 (if (string= "default" alignment)
|
|
3640 "> "
|
|
3641 (concat " align=" alignment "> ")))))
|
|
3642
|
|
3643
|
|
3644 (defun hm--html-add-header-entry (alignment)
|
|
3645 "Adds the HTML tag for a table header entry at the current point."
|
|
3646 (interactive (list (completing-read "Alignment of the cell: "
|
|
3647 hm--html-table-alignment-alist
|
|
3648 nil
|
|
3649 t
|
|
3650 "default")))
|
|
3651 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
3652 (concat "<TH"
|
|
3653 (if (string= "default" alignment)
|
|
3654 "> "
|
|
3655 (concat " align=" alignment "> ")))))
|
|
3656
|
|
3657
|
|
3658 (defun hm--html-add-row-frame (alignment)
|
|
3659 "Adds the HTML tags for a table row start and end at the current point."
|
|
3660 (interactive (list (completing-read "Alignment of the start cell: "
|
|
3661 hm--html-table-alignment-alist
|
|
3662 nil
|
|
3663 t
|
|
3664 "default")))
|
|
3665 (hm--html-add-tags 'hm--html-insert-start-tag
|
|
3666 (concat "<TD"
|
|
3667 (if (string= "default" alignment)
|
|
3668 "> "
|
|
3669 (concat " align=" alignment "> ")))
|
|
3670 'hm--html-insert-end-tag
|
|
3671 "<TR>"))
|
|
3672
|
|
3673
|
|
3674 (defun hm--html-add-row-frame-to-region (alignment)
|
|
3675 "Adds the HTML tags for a table row start and end to the current region."
|
|
3676 (interactive (list (completing-read "Alignment of the start cell: "
|
|
3677 hm--html-table-alignment-alist
|
|
3678 nil
|
|
3679 t
|
|
3680 "default")))
|
|
3681 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
|
|
3682 (concat "<TD"
|
|
3683 (if (string= "default" alignment)
|
|
3684 "> "
|
|
3685 (concat " align=" alignment "> ")))
|
|
3686 'hm--html-insert-end-tag
|
|
3687 " <TR>"))
|
|
3688
|
|
3689
|
|
3690 (defun hm--html-table-add-colspan-attribute (columns)
|
|
3691 "Adds a colspawn attribute to a table cell.
|
|
3692 A prefix arg is used as no of COLUMNS."
|
|
3693 (interactive "NNo of columns, spaned by this cell: ")
|
22
|
3694 (let ((case-fold-search t))
|
|
3695 (save-excursion
|
|
3696 (if (and (search-backward "<" nil t)
|
|
3697 (search-forward-regexp "<[ \t\n]*\\(th\\)\\|\\(td\\)" nil t))
|
|
3698 (if (search-forward-regexp "\\([ \t\n]+colspan=\\)\\([^ \t\n>]*\\)"
|
|
3699 nil
|
|
3700 t)
|
|
3701 (progn
|
|
3702 (delete-region (match-beginning 2) (match-end 2))
|
|
3703 (insert (format "\"%d\"" columns)))
|
|
3704 (insert (format " colspan=\"%d\"" columns)))
|
|
3705 (error "ERROR: Point not in a table cell!")))))
|
0
|
3706
|
|
3707
|
|
3708 (defun hm--html-table-add-rowspan-attribute (rows)
|
|
3709 "Adds a rowspan attribute to a table cell.
|
|
3710 A prefix arg is used as no of ROWS."
|
|
3711 (interactive "NNo of rows, spaned by this cell: ")
|
22
|
3712 (let ((case-fold-search t))
|
|
3713 (save-excursion
|
|
3714 (if (and (search-backward "<" nil t)
|
|
3715 (search-forward-regexp "<[ \t\n]*\\(th\\)\\|\\(td\\)" nil t))
|
|
3716 (if (search-forward-regexp "\\([ \t\n]+rowspan=\\)\\([^ \t\n>]*\\)"
|
|
3717 nil
|
|
3718 t)
|
|
3719 (progn
|
|
3720 (delete-region (match-beginning 2) (match-end 2))
|
|
3721 (insert (format "\"%d\"" rows)))
|
|
3722 (insert (format " rowspan=\"%d\"" rows)))
|
|
3723 (error "ERROR: Point not in a table cell!")))))
|
0
|
3724
|
|
3725
|
|
3726 ;;; ISO-Characters for Emacs HTML-mode (Berthold Crysmann)
|
2
|
3727 ;(setq buffer-invisibility-spec '(hm--html-iso-entity-invisible-flag))
|
|
3728
|
|
3729 ;(defvar hm--html-iso-entity-invisible-flag t
|
|
3730 ; "Controls the visibility of the iso entities.")
|
|
3731
|
|
3732 ;(defvar hm--html-iso-glyph-invisible-flag nil
|
|
3733 ; "Controls the visibility of the iso character glyphs.")
|
|
3734
|
|
3735 ;(defvar hm--html-glyph-cache nil
|
|
3736 ; "Internal variable. An assoc list with the already created glyphs.")
|
|
3737
|
|
3738 ;(defun hm--html-create-glyph (string)
|
|
3739 ; "Creates a glyph from the string or returns an existing one.
|
|
3740 ;The glyph is stored in `hm--html-glyph-cache'."
|
|
3741 ; (if nil ;(assoc string hm--html-glyph-cache)
|
|
3742 ; (cdr (assoc string hm--html-glyph-cache))
|
|
3743 ; (let ((glyph (make-glyph string)))
|
|
3744 ; (setq hm--html-glyph-cache (cons (cons string glyph)
|
|
3745 ; hm--html-glyph-cache))
|
|
3746 ; glyph)))
|
|
3747
|
|
3748 ;(defun hm--html-attach-glyph-to-region (start
|
|
3749 ; end
|
|
3750 ; string
|
|
3751 ; region-invisible-flag
|
|
3752 ; glyph-invisible-flag)
|
|
3753 ; "Make the region invisible and attach a glyph STRING.
|
|
3754 ;The invisible flags could be used, to toggle the visibility."
|
|
3755 ; (mapcar 'delete-annotation (annotations-at end)) ; delete old anotations
|
|
3756 ; ;; delete old extents
|
|
3757 ; (let ((extent (make-extent start end))
|
|
3758 ; (annotation nil))
|
|
3759 ; (set-extent-property extent 'invisible region-invisible-flag)
|
|
3760 ; (set-extent-property extent 'end-open t)
|
|
3761 ; (set-extent-property extent 'start-open t)
|
|
3762 ; (set-extent-property extent 'intangible t)
|
|
3763 ; (setq annotation (make-annotation "Hallo Du da" ;(hm--html-create-glyph string)
|
|
3764 ; end
|
|
3765 ; 'text))
|
|
3766 ; (goto-char end)))
|
|
3767
|
|
3768
|
|
3769 ;(defun hm--html-insert-iso-char-as-entity-and-glyph (char entity)
|
|
3770 ; "Inserts an iso char as html ENTITY and displays a glyph.
|
|
3771 ;The glyph is created from the string CHAR."
|
|
3772 ; (let ((start (point)))
|
|
3773 ; (insert entity)
|
|
3774 ; (hm--html-attach-glyph-to-region start
|
|
3775 ; (point)
|
|
3776 ; char
|
|
3777 ; 'hm--html-iso-entity-invisible-flag
|
|
3778 ; 'hm--html-iso-glyph-invisible-flag)))
|
|
3779
|
|
3780 ;(defun hm--html_ue ()
|
|
3781 ; (interactive)
|
|
3782 ; (hm--html-insert-iso-char-as-entity-and-glyph "ü" "ü"))
|
|
3783
|
|
3784
|
|
3785 ;(defun hm--html-insert-iso-char-as-entity-and-glyph (char entity)
|
|
3786 ; (let ((start (point))
|
|
3787 ; (end nil)
|
|
3788 ; (extent nil))
|
|
3789 ; (insert entity)
|
|
3790 ; (setq end (point))
|
|
3791 ; (setq extent (make-extent start end))
|
|
3792 ; (set-extent-begin-glyph extent char)
|
|
3793 ; (set-extent-property extent 'invisible t)))
|
|
3794
|
|
3795 ;(defun hm--html_ue ()
|
|
3796 ; (interactive)
|
|
3797 ; (hm--html-insert-iso-char-as-entity-and-glyph ?ü "ü"))
|
0
|
3798
|
|
3799 (defun hm--html_ue ()
|
|
3800 "Insert the character 'ue'."
|
|
3801 (interactive)
|
|
3802 (insert "ü"))
|
|
3803
|
|
3804 (defun hm--html_oe ()
|
|
3805 "Insert the character 'oe'."
|
|
3806 (interactive)
|
|
3807 (insert "ö"))
|
|
3808
|
|
3809 (defun hm--html_ae ()
|
|
3810 "Insert the character 'ae'."
|
|
3811 (interactive)
|
|
3812 (insert "ä"))
|
|
3813
|
|
3814 (defun hm--html_aa ()
|
|
3815 "Insert the character 'aa'."
|
|
3816 (interactive)
|
|
3817 (insert "å"))
|
|
3818
|
|
3819 (defun hm--html_Ue ()
|
|
3820 "Insert the character 'Ue'."
|
|
3821 (interactive)
|
|
3822 (insert "Ü"))
|
|
3823
|
|
3824 (defun hm--html_Oe ()
|
|
3825 "Insert the character 'Oe'."
|
|
3826 (interactive)
|
|
3827 (insert "Ö"))
|
|
3828
|
|
3829 (defun hm--html_Ae ()
|
|
3830 "Insert the character 'Ae'."
|
|
3831 (interactive)
|
|
3832 (insert "Ä"))
|
|
3833
|
|
3834 (defun hm--html_Aa ()
|
|
3835 "Insert the character 'Aa'."
|
|
3836 (interactive)
|
|
3837 (insert "Å"))
|
|
3838
|
|
3839 (defun hm--html_sz ()
|
|
3840 "Insert the character 'sz'."
|
|
3841 (interactive)
|
|
3842 (insert "ß"))
|
|
3843
|
|
3844 (defun hm--html_aacute ()
|
|
3845 "Insert the character 'aacute'."
|
|
3846 (interactive)
|
|
3847 (insert "á"))
|
|
3848
|
|
3849 (defun hm--html_eacute ()
|
|
3850 "Insert the character 'eacute'."
|
|
3851 (interactive)
|
|
3852 (insert "é"))
|
|
3853
|
|
3854 (defun hm--html_iacute ()
|
|
3855 "Insert the character 'iacute'."
|
|
3856 (interactive)
|
|
3857 (insert "í"))
|
|
3858
|
|
3859 (defun hm--html_oacute ()
|
|
3860 "Insert the character 'oacute'."
|
|
3861 (interactive)
|
|
3862 (insert "ó"))
|
|
3863
|
|
3864 (defun hm--html_uacute ()
|
|
3865 "Insert the character 'uacute'."
|
|
3866 (interactive)
|
|
3867 (insert "ú"))
|
|
3868
|
|
3869 (defun hm--html_Aacute ()
|
|
3870 "Insert the character 'Aacute'."
|
|
3871 (interactive)
|
|
3872 (insert "á"))
|
|
3873
|
|
3874 (defun hm--html_Eacute ()
|
|
3875 "Insert the character 'Eacute'."
|
|
3876 (interactive)
|
|
3877 (insert "é"))
|
|
3878
|
|
3879 (defun hm--html_Iacute ()
|
|
3880 "Insert the character 'Iacute'."
|
|
3881 (interactive)
|
|
3882 (insert "í"))
|
|
3883
|
|
3884 (defun hm--html_Oacute ()
|
|
3885 "Insert the character 'Oacute'."
|
|
3886 (interactive)
|
|
3887 (insert "ó"))
|
|
3888
|
|
3889 (defun hm--html_Uacute ()
|
|
3890 "Insert the character 'Uacute'."
|
|
3891 (interactive)
|
|
3892 (insert "ú"))
|
|
3893
|
|
3894 (defun hm--html_agrave ()
|
|
3895 "Insert the character 'agrave'."
|
|
3896 (interactive)
|
|
3897 (insert "à"))
|
|
3898
|
|
3899 (defun hm--html_egrave ()
|
|
3900 "Insert the character 'egrave'."
|
|
3901 (interactive)
|
|
3902 (insert "è"))
|
|
3903
|
|
3904 (defun hm--html_igrave ()
|
|
3905 "Insert the character 'igrave'."
|
|
3906 (interactive)
|
|
3907 (insert "ì"))
|
|
3908
|
|
3909 (defun hm--html_ograve ()
|
|
3910 "Insert the character 'ograve'."
|
|
3911 (interactive)
|
|
3912 (insert "ò"))
|
|
3913
|
|
3914 (defun hm--html_ugrave ()
|
|
3915 "Insert the character 'ugrave'."
|
|
3916 (interactive)
|
|
3917 (insert "ù"))
|
|
3918
|
|
3919 (defun hm--html_Agrave ()
|
|
3920 "Insert the character 'Agrave'."
|
|
3921 (interactive)
|
|
3922 (insert "À"))
|
|
3923
|
|
3924 (defun hm--html_Egrave ()
|
|
3925 "Insert the character 'Egrave'."
|
|
3926 (interactive)
|
|
3927 (insert "È"))
|
|
3928
|
|
3929 (defun hm--html_Igrave ()
|
|
3930 "Insert the character 'Igrave'."
|
|
3931 (interactive)
|
|
3932 (insert "Ì"))
|
|
3933
|
|
3934 (defun hm--html_Ograve ()
|
|
3935 "Insert the character 'Ograve'."
|
|
3936 (interactive)
|
|
3937 (insert "Ò"))
|
|
3938
|
|
3939 (defun hm--html_Ugrave ()
|
|
3940 "Insert the character 'Ugrave'."
|
|
3941 (interactive)
|
|
3942 (insert "Ù"))
|
|
3943
|
|
3944 (defun hm--html_ccedilla ()
|
|
3945 "Insert the character 'ccedilla'."
|
|
3946 (interactive)
|
|
3947 (insert "çla;"))
|
|
3948
|
|
3949 (defun hm--html_Ccedilla ()
|
|
3950 "Insert the character 'Ccedilla'."
|
|
3951 (interactive)
|
|
3952 (insert "Çla;"))
|
|
3953
|
|
3954 (defun hm--html_atilde ()
|
|
3955 "Insert the character 'atilde'."
|
|
3956 (interactive)
|
|
3957 (insert "ã"))
|
|
3958
|
|
3959 (defun hm--html_otilde ()
|
|
3960 "Insert the character 'otilde'."
|
|
3961 (interactive)
|
|
3962 (insert "õ"))
|
|
3963
|
|
3964 (defun hm--html_ntilde ()
|
|
3965 "Insert the character 'ntilde'."
|
|
3966 (interactive)
|
|
3967 (insert "ñ"))
|
|
3968
|
|
3969 (defun hm--html_Atilde ()
|
|
3970 "Insert the character 'Atilde'."
|
|
3971 (interactive)
|
|
3972 (insert "Ã"))
|
|
3973
|
|
3974 (defun hm--html_Otilde ()
|
|
3975 "Insert the character 'Otilde'."
|
|
3976 (interactive)
|
|
3977 (insert "Õ"))
|
|
3978
|
|
3979 (defun hm--html_Ntilde ()
|
|
3980 "Insert the character 'Ntilde'."
|
|
3981 (interactive)
|
|
3982 (insert "Ñ"))
|
|
3983
|
|
3984 (defun hm--html_acircumflex ()
|
|
3985 "Insert the character 'acircumflex'."
|
|
3986 (interactive)
|
|
3987 (insert "âumflex;"))
|
|
3988
|
|
3989 (defun hm--html_ecircumflex ()
|
|
3990 "Insert the character 'ecircumflex'."
|
|
3991 (interactive)
|
|
3992 (insert "êumflex;"))
|
|
3993
|
|
3994 (defun hm--html_icircumflex ()
|
|
3995 "Insert the character 'icircumflex'."
|
|
3996 (interactive)
|
|
3997 (insert "îumflex;"))
|
|
3998
|
|
3999 (defun hm--html_ocircumflex ()
|
|
4000 "Insert the character 'ocircumflex'."
|
|
4001 (interactive)
|
|
4002 (insert "ôumflex;"))
|
|
4003
|
|
4004 (defun hm--html_ucircumflex ()
|
|
4005 "Insert the character 'ucircumflex'."
|
|
4006 (interactive)
|
|
4007 (insert "ûumflex;"))
|
|
4008
|
|
4009 (defun hm--html_Acircumflex ()
|
|
4010 "Insert the character 'Acircumflex'."
|
|
4011 (interactive)
|
|
4012 (insert "Âumflex;"))
|
|
4013
|
|
4014 (defun hm--html_Ecircumflex ()
|
|
4015 "Insert the character 'Ecircumflex'."
|
|
4016 (interactive)
|
|
4017 (insert "Êumflex;"))
|
|
4018
|
|
4019 (defun hm--html_Icircumflex ()
|
|
4020 "Insert the character 'Icircumflex'."
|
|
4021 (interactive)
|
|
4022 (insert "Îumflex;"))
|
|
4023
|
|
4024 (defun hm--html_Ocircumflex ()
|
|
4025 "Insert the character 'Ocircumflex'."
|
|
4026 (interactive)
|
|
4027 (insert "Ôumflex;"))
|
|
4028
|
|
4029 (defun hm--html_Ucircumflex ()
|
|
4030 "Insert the character 'Ucircumflex'."
|
|
4031 (interactive)
|
|
4032 (insert "Ûumflex;"))
|
|
4033
|
|
4034 (defun hm--html_ediaeresis ()
|
|
4035 "Insert the character 'ediaeresis'."
|
|
4036 (interactive)
|
|
4037 (insert "ë"))
|
|
4038
|
|
4039 (defun hm--html_idiaeresis ()
|
|
4040 "Insert the character 'idiaeresis'."
|
|
4041 (interactive)
|
|
4042 (insert "ï"))
|
|
4043
|
|
4044 (defun hm--html_Ediaeresis ()
|
|
4045 "Insert the character 'Ediaeresis'."
|
|
4046 (interactive)
|
|
4047 (insert "Ë"))
|
|
4048
|
|
4049 (defun hm--html_Idiaeresis ()
|
|
4050 "Insert the character 'Idiaeresis'."
|
|
4051 (interactive)
|
|
4052 (insert "Ï"))
|
|
4053
|
|
4054 (defun hm--html_thorn ()
|
|
4055 "Insert the character 'thorn'."
|
|
4056 (interactive)
|
|
4057 (insert "þ"))
|
|
4058
|
|
4059 (defun hm--html_Thorn ()
|
|
4060 "Insert the character 'Thorn'."
|
|
4061 (interactive)
|
|
4062 (insert "Þ"))
|
|
4063
|
|
4064 (defun hm--html_eth ()
|
|
4065 "Insert the character 'eth'."
|
|
4066 (interactive)
|
|
4067 (insert "ð"))
|
|
4068
|
|
4069 (defun hm--html_Eth ()
|
|
4070 "Insert the character 'Eth'."
|
|
4071 (interactive)
|
|
4072 (insert "Ð"))
|
|
4073
|
|
4074
|
|
4075 ;;;
|
|
4076 ;
|
|
4077 ; smart functions
|
|
4078
|
|
4079 (defvar hm--just-insert-less-than nil
|
|
4080 "Internal variable.")
|
|
4081
|
2
|
4082 (defun hm--html-less-than ()
|
|
4083 "Inserts the entity '>'."
|
|
4084 (interactive)
|
|
4085 (insert "<"))
|
|
4086
|
0
|
4087 (defun hm--html-smart-less-than ()
|
|
4088 "Insert a '<' or the entity '<' if you execute this command twice."
|
|
4089 (interactive)
|
|
4090 (if (and (eq last-command 'hm--html-smart-less-than)
|
|
4091 hm--just-insert-less-than)
|
|
4092 (progn
|
|
4093 (delete-char -1)
|
2
|
4094 (hm--html-less-than)
|
0
|
4095 (setq hm--just-insert-less-than nil))
|
|
4096 (insert ?<)
|
|
4097 (setq hm--just-insert-less-than t)))
|
|
4098
|
|
4099 (defvar hm--just-insert-greater-than nil
|
|
4100 "Internal variable.")
|
|
4101
|
2
|
4102 (defun hm--html-greater-than ()
|
|
4103 "Inserts the entity '>'."
|
|
4104 (interactive)
|
|
4105 (insert ">"))
|
|
4106
|
0
|
4107 (defun hm--html-smart-greater-than ()
|
|
4108 "Insert a '>' or the entity '>' if you execute this command twice."
|
|
4109 (interactive)
|
|
4110 (if (and (eq last-command 'hm--html-smart-greater-than)
|
|
4111 hm--just-insert-greater-than)
|
|
4112 (progn
|
|
4113 (delete-char -1)
|
2
|
4114 (hm--html-greater-than)
|
0
|
4115 (setq hm--just-insert-greater-than nil))
|
|
4116 (insert ?>)
|
|
4117 (setq hm--just-insert-greater-than t)))
|
|
4118
|
|
4119
|
2
|
4120 (defvar hm--just-insert-ampersand nil
|
|
4121 "Internal variable.")
|
|
4122
|
|
4123 (defun hm--html-ampersand ()
|
|
4124 "Inserts the entity '&'."
|
|
4125 (interactive)
|
|
4126 (insert "&"))
|
|
4127
|
|
4128 (defun hm--html-smart-ampersand ()
|
|
4129 "Insert a '&' or the entity '&' if you execute this command twice."
|
|
4130 (interactive)
|
|
4131 (if (and (eq last-command 'hm--html-smart-ampersand)
|
|
4132 hm--just-insert-ampersand)
|
|
4133 (progn
|
|
4134 (delete-char -1)
|
|
4135 (hm--html-ampersand)
|
|
4136 (setq hm--just-insert-ampersand nil))
|
|
4137 (insert ?&)
|
|
4138 (setq hm--just-insert-ampersand t)))
|
|
4139
|
|
4140
|
0
|
4141 ;;;
|
|
4142 ; sending the contents of a html buffer to netscape
|
|
4143 ; (Thanks to Adrian Aichner for providing this function)
|
|
4144
|
|
4145 (defun hm--html-send-buffer-to-netscape (buffer
|
|
4146 &optional new-netscape new-window)
|
|
4147 "View html buffer with Netscape.
|
|
4148 This should be changed in the fututure, so that it doesn't need vm."
|
|
4149 (interactive)
|
|
4150 (require 'vm)
|
|
4151 (if new-netscape
|
|
4152 (vm-run-background-command vm-netscape-program buffer-file-name)
|
|
4153 (or (equal 0
|
|
4154 (vm-run-command vm-netscape-program
|
|
4155 "-remote"
|
|
4156 (concat "openURL(file://localhost"
|
|
4157 buffer-file-name
|
|
4158 (if new-window ", new-window" "")
|
|
4159 ")")))
|
|
4160 (hm--html-send-buffer-to-netscape buffer t new-window))))
|
|
4161
|
|
4162
|
|
4163
|
|
4164 ;;;
|
|
4165 ; some other usefull functions
|
|
4166 ;
|
|
4167
|
|
4168 (defun hm--html-remove-numeric-names ()
|
|
4169 "Remove the number in numbered links in the current buffer.
|
|
4170 Eg: the string \"Name=3\". The function asks the user every time whether
|
|
4171 the number should be removed."
|
|
4172 (interactive)
|
|
4173 (save-excursion
|
|
4174 (goto-char (point-min))
|
|
4175 (query-replace-regexp "name=\"?[0-9]+\"?+[ \t]*" "")))
|
|
4176
|
|
4177 ;;This should be extended in the future to use also other viewers.
|
|
4178 (defun hm--html-view-www-package-docu ()
|
|
4179 "View the WWW documentation of the package."
|
|
4180 (interactive)
|
|
4181 (w3-fetch "http://www.tnt.uni-hannover.de:80/data/info/www/tnt/soft/info/www/html-editors/hm--html-menus/overview.html"))
|
|
4182
|
|
4183 ;;;
|
|
4184 ; Bug reporting
|
|
4185 ;
|
|
4186
|
|
4187 (defun hm--html-submit-bug-report ()
|
|
4188 "Submit via mail a bug report on hm--html-menus."
|
|
4189 (interactive)
|
|
4190 (require 'reporter)
|
|
4191 (let ((reporter-prompt-for-summary-p t))
|
|
4192 (reporter-submit-bug-report
|
|
4193 hm--html-menus-package-maintainer
|
|
4194 (concat hm--html-menus-package-name
|
|
4195 " "
|
|
4196 hm--html-menus-package-version)
|
|
4197 (list 'emacs-version
|
|
4198 'major-mode
|
|
4199 'hm--html-automatic-changed-comment
|
|
4200 'hm--html-automatic-created-comment
|
|
4201 'hm--html-automatic-expand-templates
|
|
4202 'hm--html-automatic-new-date
|
|
4203 'hm--html-expert
|
|
4204 'hm--html-favorite-http-server-host-name
|
|
4205 'hm--html-file-path-alist
|
|
4206 'hm--html-ftp-hostname:port-alist
|
|
4207 'hm--html-ftp-hostname:port-default
|
|
4208 'hm--html-ftp-path-alist
|
|
4209 'hm--html-gopher-anchor-alist
|
|
4210 'hm--html-gopher-doctype-alist
|
|
4211 'hm--html-gopher-doctype-default
|
|
4212 'hm--html-gopher-hostname:port-alist
|
|
4213 'hm--html-gopher-hostname:port-default
|
|
4214 'hm--html-html-hostname:port-alist
|
|
4215 'hm--html-html-hostname:port-default
|
|
4216 'hm--html-html-path-alist
|
|
4217 'hm--html-info-hostname:port-alist
|
|
4218 'hm--html-info-hostname:port-default
|
|
4219 'hm--html-info-path-alist
|
|
4220 'hm--html-local-proggate-path-alist
|
|
4221 'hm--html-mail-hostname:port-alist
|
|
4222 'hm--html-mail-hostname:port-default
|
|
4223 'hm--html-mail-path-alist
|
|
4224 'hm--html-marc
|
|
4225 'hm--html-menu-load-hook
|
|
4226 'hm--html-proggate-allowed-file
|
|
4227 'hm--html-proggate-hostname:port-alist
|
|
4228 'hm--html-proggate-hostname:port-default
|
|
4229 'hm--html-server-side-include-command-alist
|
|
4230 'hm--html-server-side-include-command-with-parameter-alist
|
|
4231 'hm--html-signature-file
|
|
4232 'hm--html-template-dir
|
|
4233 'hm--html-url-alist
|
|
4234 'hm--html-user-config-file
|
22
|
4235 'hm--html-site-config-file
|
0
|
4236 'hm--html-username
|
|
4237 'hm--html-wais-hostname:port-alist
|
|
4238 'hm--html-wais-hostname:port-default
|
|
4239 'hm--html-wais-path-alist
|
|
4240 'hm--html-wais-servername:port-alist
|
|
4241 'hm--html-wais-servername:port-default
|
2
|
4242 ; 'html-deemphasize-color
|
0
|
4243 'html-document-previewer
|
2
|
4244 ; 'html-document-previewer-args
|
|
4245 ; 'html-emphasize-color
|
|
4246 ; 'html-quotify-hrefs-on-find
|
|
4247 'hm--html-region-mode
|
0
|
4248 'html-sigusr1-signal-value
|
2
|
4249 ; 'html-use-font-lock
|
|
4250 ; 'html-use-highlighting
|
0
|
4251 )
|
|
4252 nil
|
|
4253 nil
|
|
4254 "Decribe your Bug: "
|
|
4255 )))
|
|
4256
|
|
4257
|
|
4258 ;;;
|
|
4259 ; hook adding functions
|
|
4260 ;
|
|
4261
|
|
4262 (if (adapt-xemacsp)
|
|
4263 (progn
|
|
4264
|
2
|
4265 (add-hook 'zmacs-activate-region-hook
|
|
4266 'hm--html-switch-region-modes-on)
|
|
4267 ; (function (lambda () (hm--html-region-mode 1))))
|
0
|
4268
|
|
4269 (add-hook 'zmacs-deactivate-region-hook
|
2
|
4270 'hm--html-switch-region-modes-off)
|
|
4271 ; (function (lambda () (hm--html-region-mode -1))))
|
0
|
4272
|
|
4273 )
|
|
4274
|
|
4275 (transient-mark-mode t)
|
|
4276
|
|
4277 (add-hook 'activate-mark-hook
|
2
|
4278 'hm--html-switch-region-modes-on)
|
|
4279 ; (function (lambda () (hm--html-region-mode t))))
|
0
|
4280
|
|
4281 (add-hook 'deactivate-mark-hook
|
2
|
4282 'hm--html-switch-region-modes-off)
|
|
4283 ; (function (lambda () (hm--html-region-mode nil))))
|
0
|
4284
|
|
4285 )
|
|
4286
|
|
4287
|
2
|
4288 ;(add-hook 'hm--html-mode-hook
|
|
4289 ; (function
|
|
4290 ; (lambda ()
|
|
4291 ; (make-variable-buffer-local 'write-file-hooks)
|
|
4292 ; (add-hook 'write-file-hooks
|
|
4293 ; 'hm--html-maybe-new-date-and-changed-comment))))
|
0
|
4294
|
|
4295 ;(add-hook 'zmacs-activate-region-hook 'hm--set-hm--region-active)
|
|
4296 ;
|
|
4297 ;(add-hook 'zmacs-deactivate-region-hook 'hm--unset-hm--region-active)
|
|
4298
|
|
4299
|
|
4300
|
|
4301 ;;;
|
|
4302 ; Environment loading
|
|
4303 ;
|
|
4304
|
|
4305 (defun hm--html-load-config-files ()
|
|
4306 "Load the html configuration files.
|
|
4307 First, the system config file (detemined by the environment variable
|
22
|
4308 HTML_CONFIG_FILE; normaly hm--html-configuration.el(c)) is loaded.
|
|
4309 At second a site config file is loaded, if the environment variable
|
|
4310 HTML_SITE_CONFIG_FILE or the lisp variable `hm--html-site-config-file'
|
|
4311 is set to such a file.
|
|
4312 At least the user config file (determined by the environment variable
|
0
|
4313 HTML_USER_CONFIG_FILE; normaly the file ~/.hm--html-configuration.el(c)).
|
|
4314 If no HTML_CONFIG_FILE exists, then the file hm--html-configuration.el(c)
|
|
4315 is searched in one of the lisp load path directories.
|
|
4316 If no HTML_USER_CONFIG_FILE exists, then the variable
|
|
4317 `hm--html-user-config-file' is checked. If this variable is nil or the file
|
|
4318 also doesn't exist, then the file ~/.hm--html-configuration.el(c) is used."
|
|
4319 (interactive)
|
|
4320 ;; at first the system config file
|
|
4321 (if (and (stringp (getenv "HTML_CONFIG_FILE"))
|
|
4322 (file-exists-p
|
|
4323 (expand-file-name
|
|
4324 (getenv "HTML_CONFIG_FILE"))))
|
|
4325 (load-library (expand-file-name (getenv "HTML_CONFIG_FILE")))
|
|
4326 (load-library "hm--html-configuration"))
|
22
|
4327
|
|
4328 ;; at second the site config file
|
|
4329 (if (and (stringp (getenv "HTML_SITE_CONFIG_FILE"))
|
|
4330 (file-exists-p
|
|
4331 (expand-file-name
|
|
4332 (getenv "HTML_SITE_CONFIG_FILE"))))
|
|
4333 (load-file (expand-file-name (getenv "HTML_SITE_CONFIG_FILE")))
|
|
4334 (when (and (boundp 'hm--html-site-config-file)
|
|
4335 (stringp hm--html-site-config-file)
|
|
4336 (file-exists-p (expand-file-name hm--html-site-config-file)))
|
|
4337 (load-file (expand-file-name hm--html-site-config-file))))
|
0
|
4338
|
|
4339 ;; and now the user config file
|
|
4340 (cond ((and (stringp (getenv "HTML_USER_CONFIG_FILE"))
|
|
4341 (file-exists-p
|
|
4342 (expand-file-name
|
|
4343 (getenv "HTML_USER_CONFIG_FILE"))))
|
|
4344 (load-file (expand-file-name (getenv "HTML_USER_CONFIG_FILE"))))
|
|
4345 ((and (boundp 'hm--html-user-config-file)
|
|
4346 (stringp hm--html-user-config-file)
|
|
4347 (file-exists-p (expand-file-name hm--html-user-config-file)))
|
|
4348 (load-file (expand-file-name hm--html-user-config-file)))
|
|
4349 ((file-exists-p (expand-file-name "~/.hm--html-configuration.elc"))
|
|
4350 (load-file (expand-file-name "~/.hm--html-configuration.elc")))
|
|
4351 ((file-exists-p (expand-file-name "~/.hm--html-configuration.el"))
|
|
4352 (load-file (expand-file-name "~/.hm--html-configuration.el")))
|
|
4353 (t
|
|
4354 (message (concat "WARNING: No HTML User Config File ! "
|
|
4355 "Look at hm--html-load-config-files !")))
|
|
4356 )
|
|
4357 )
|
|
4358
|
|
4359
|
|
4360
|
|
4361 ;(hm--html-load-config-files)
|
|
4362
|
|
4363 ;;; Definition of the minor mode html-region-mode
|
|
4364
|
2
|
4365 ;(defvar html-region-mode nil
|
|
4366 ; "*t, if the minor mode html-region-mode is on and nil otherwise.")
|
|
4367
|
|
4368 ;(make-variable-buffer-local 'html-region-mode)
|
|
4369
|
|
4370 ;(defvar html-region-mode-map nil "")
|
|
4371
|
|
4372 ;(hm--html-load-config-files)
|
|
4373
|
|
4374 ;(if hm--html-use-old-keymap
|
|
4375 ; (progn
|
|
4376
|
|
4377 ;;(setq minor-mode-alist (cons '(html-region-mode " Region") minor-mode-alist))
|
|
4378 ;(or (assq 'html-region-mode minor-mode-alist)
|
|
4379 ; (setq minor-mode-alist
|
|
4380 ; (purecopy
|
|
4381 ; (append minor-mode-alist
|
|
4382 ; '((html-region-mode " Region"))))))
|
|
4383
|
|
4384 ;(defun html-region-mode (on)
|
|
4385 ; "Turns the minor mode html-region-mode on or off.
|
|
4386 ;The function turns the html-region-mode on, if ON is t and off otherwise."
|
|
4387 ; (if (string= mode-name "HTML")
|
|
4388 ; (if on
|
|
4389 ; ;; html-region-mode on
|
|
4390 ; (progn
|
|
4391 ; (setq html-region-mode t)
|
|
4392 ; (use-local-map html-region-mode-map))
|
|
4393 ; ;; html-region-mode off
|
|
4394 ; (setq html-region-mode nil)
|
|
4395 ; (use-local-map html-mode-map))))
|
|
4396
|
|
4397 ;))
|
0
|
4398
|
|
4399
|
|
4400
|
|
4401
|
|
4402
|
|
4403 ;;;
|
|
4404 ; Set font lock color
|
|
4405 ; (hm--html-font-lock-color should be defined in hm--html-configuration.el
|
|
4406 ; oder .hm--html-configuration.el)
|
|
4407 ;
|
2
|
4408 ;(require 'font-lock)
|
0
|
4409 ;(load-library "font-lock")
|
|
4410 ;(set-face-foreground 'font-lock-comment-face hm--html-font-lock-color)
|
|
4411
|
|
4412
|
2
|
4413 ;(hm--html-generate-help-buffer-faces)
|
0
|
4414
|
|
4415
|
|
4416
|
|
4417
|
|
4418 ;;;;;;;;
|
|
4419 ;(setq hm--html-hostname-search-string
|
|
4420 ; "[-a-zA-Z0-9]*\\.[-a-zA-Z0-9]*\\.[-a-zA-Z0-9.]*")
|
|
4421 ;
|
|
4422 ;(defun hm--html-get-next-hostname ()
|
|
4423 ; (interactive)
|
|
4424 ; (search-forward-regexp hm--html-hostname-search-string)
|
|
4425 ; (buffer-substring (match-beginning 0) (match-end 0)))
|
|
4426 ;
|
2
|
4427
|
|
4428 ;;; Announce the feature hm--html-configuration
|
|
4429
|
|
4430 ;;; quotify href
|
|
4431
|
|
4432 (defvar hm--html-quotify-href-regexp
|
|
4433 "<[aA][ \t\n]+\\([nN][aA][mM][eE]=[a-zA-Z0-9]+[ \t\n]+\\)?[hH][rR][eE][fF]="
|
|
4434 "Regular expression used for searching hrefs.")
|
|
4435
|
|
4436 (defun hm--html-quotify-hrefs ()
|
|
4437 "Insert quotes around all HREF and NAME attribute value literals.
|
|
4438
|
|
4439 This remedies the problem with old HTML files that can't be processed
|
|
4440 by SGML parsers. That is, changes <A HREF=foo> to <A HREF=\"foo\">.
|
|
4441
|
|
4442 Look also at the variable `hm--html-quotify-href-regexp'."
|
|
4443 (interactive)
|
|
4444 (save-excursion
|
|
4445 (goto-char (point-min))
|
|
4446 (while
|
|
4447 (re-search-forward hm--html-quotify-href-regexp
|
|
4448 (point-max)
|
|
4449 t)
|
|
4450 (cond
|
|
4451 ((null (looking-at "\""))
|
|
4452 (insert "\"")
|
|
4453 (re-search-forward "[ \t\n>]" (point-max) t)
|
|
4454 (forward-char -1)
|
|
4455 (insert "\""))))))
|
|
4456
|
|
4457
|
|
4458
|
|
4459 (provide 'hm--html)
|