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