comparison lisp/hm--html-menus/hm--html.el @ 102:a145efe76779 r20-1b3

Import from CVS: tag r20-1b3
author cvs
date Mon, 13 Aug 2007 09:15:49 +0200
parents 4be1180a9e89
children 9f59509498e1
comparison
equal deleted inserted replaced
101:a0ec055d74dd 102:a145efe76779
1 ;;; $Id: hm--html.el,v 1.3 1997/02/24 01:13:28 steve Exp $ 1 ;;; $Id: hm--html.el,v 1.4 1997/02/27 06:08:10 steve Exp $
2 ;;; 2 ;;;
3 ;;; Copyright (C) 1993 - 1997 Heiko Muenkel 3 ;;; Copyright (C) 1993 - 1997 Heiko Muenkel
4 ;;; email: muenkel@tnt.uni-hannover.de 4 ;;; email: muenkel@tnt.uni-hannover.de
5 ;;; 5 ;;;
6 ;;; This program is free software; you can redistribute it and/or modify 6 ;;; This program is free software; you can redistribute it and/or modify
86 (let ((start (hm--html-set-marker-at-position (region-beginning))) 86 (let ((start (hm--html-set-marker-at-position (region-beginning)))
87 (end (region-end))) 87 (end (region-end)))
88 (goto-char end) 88 (goto-char end)
89 (eval (list function-insert-end-tag end-tag)) 89 (eval (list function-insert-end-tag end-tag))
90 (goto-char start) 90 (goto-char start)
91 ; (backward-char (+ (length end-tag) (- end start)))
92 (eval (list function-insert-start-tag start-tag)) 91 (eval (list function-insert-start-tag start-tag))
93 (if function-insert-middle-tag 92 (if function-insert-middle-tag
94 (eval (list function-insert-middle-tag middle-tag))) 93 (eval (list function-insert-middle-tag middle-tag)))
95 ))) 94 )))
96 95
99 "Inserts the HTML start tag 'tag' without a Newline. 98 "Inserts the HTML start tag 'tag' without a Newline.
100 The parameter must be a string (i.e. \"<B>\")" 99 The parameter must be a string (i.e. \"<B>\")"
101 (let ((start (point))) 100 (let ((start (point)))
102 (insert tag) 101 (insert tag)
103 (hm--html-indent-region start (point)))) 102 (hm--html-indent-region start (point))))
104 ; (html-maybe-deemphasize-region start (- (point) 1))))
105 103
106 104
107 (defun hm--html-insert-end-tag (tag) 105 (defun hm--html-insert-end-tag (tag)
108 "Inserts the HTML end tag 'tag' without a Newline. 106 "Inserts the HTML end tag 'tag' without a Newline.
109 The parameter must be a string (i.e. \"</B>\")" 107 The parameter must be a string (i.e. \"</B>\")"
110 (let ((start (point))) 108 (let ((start (point)))
111 (insert tag) 109 (insert tag)
112 (hm--html-indent-region start (point)))) 110 (hm--html-indent-region start (point))))
113 ; (html-maybe-deemphasize-region start (- (point) 1))))
114 111
115 112
116 (defun hm--html-insert-start-tag-with-newline (tag) 113 (defun hm--html-insert-start-tag-with-newline (tag)
117 "Inserts the HTML start tag 'tag' with a Newline. 114 "Inserts the HTML start tag 'tag' with a Newline.
118 The parameter must be a string (i.e. \"<PRE>\")" 115 The parameter must be a string (i.e. \"<PRE>\")"
278 (head-end-point)) 275 (head-end-point))
279 (goto-char (point-min)) 276 (goto-char (point-min))
280 (setq head-end-point (when (re-search-forward 277 (setq head-end-point (when (re-search-forward
281 "\\(</head\\)\\|\\(<body\\)\\|\\(</html\\)") 278 "\\(</head\\)\\|\\(<body\\)\\|\\(</html\\)")
282 (beginning-of-line) 279 (beginning-of-line)
283 (point)))) 280 (point)))
284 (goto-char point) 281 (goto-char point)
285 (hm--html-search-place-for-element-in-head head-end-point) 282 (hm--html-search-place-for-element-in-head head-end-point)
286 (hm--html-add-tags 'hm--html-insert-start-tag 283 (hm--html-add-tags 'hm--html-insert-start-tag
287 (concat "<META " 284 (concat "<META "
288 (if name-instead-of-http-equiv 285 (if name-instead-of-http-equiv
289 "NAME=\"" 286 "NAME=\""
290 "HTTP-EQUIV=\"") 287 "HTTP-EQUIV=\"")
291 name 288 name
292 "\" CONTENT=\"" 289 "\" CONTENT=\""
293 content 290 content
294 "\">")))) 291 "\">")))))
295 292
296 293
297 ;;; Functions which include something in HTML- documents 294 ;;; Functions which include something in HTML- documents
298 295
299 (defvar hm--html-url-history-list nil 296 (defvar hm--html-url-history-list nil
558 (interactive "FInclude File: ") 555 (interactive "FInclude File: ")
559 (let ((start (point))) 556 (let ((start (point)))
560 (if (string= file "") 557 (if (string= file "")
561 (error "ERROR: No filename specified !") 558 (error "ERROR: No filename specified !")
562 (insert "<INC SRV \"" file "\">")))) 559 (insert "<INC SRV \"" file "\">"))))
563 ; (html-maybe-deemphasize-region (1+ start) (1- (point))))))
564 560
565 561
566 (defun hm--html-add-server-side-include-command-with-isindex-parameter 562 (defun hm--html-add-server-side-include-command-with-isindex-parameter
567 (command) 563 (command)
568 "This function adds a server side include command directive in the buffer. 564 "This function adds a server side include command directive in the buffer.
587 (if (string= command "") 583 (if (string= command "")
588 (error "ERROR: No command specified !") 584 (error "ERROR: No command specified !")
589 (if (= ?| (string-to-char command)) 585 (if (= ?| (string-to-char command))
590 (insert "<INC " attribute" \"" command "\">") 586 (insert "<INC " attribute" \"" command "\">")
591 (insert "<INC " attribute " \"|" command "\">"))))) 587 (insert "<INC " attribute " \"|" command "\">")))))
592 ; (html-maybe-deemphasize-region (1+ start) (1- (point)))))))
593
594
595 ;(defun hm--html-add-server-side-include-command-with-parameter (command
596 ; parameter)
597 ; "This function adds a server side include command directive in the buffer.
598 ;The directive is only supported by the NCSA http daemon."
599 ; (interactive (list
600 ; (completing-read
601 ; "Include Command: "
602 ; hm--html-server-side-include-command-with-parameter-alist)
603 ; (read-string "Parameterlist sepearted by '?': ")))
604 ; (let ((start (point)))
605 ; (if (string= command "")
606 ; (error "ERROR: No command specified !")
607 ; (if (string= parameter "")
608 ; (error "ERROR: No parameter specified !")
609 ; (if (= ?| (string-to-char command))
610 ; (if (= ?? (string-to-char parameter))
611 ; (insert "<INC SRVURL \"" command parameter "\">")
612 ; (insert "<INC SRVURL \"" command "?" parameter "\">"))
613 ; (if (= ?? (string-to-char parameter))
614 ; (insert "<INC SRVURL \"|" command parameter "\">")
615 ; (insert "<INC SRVURL \"|" command "?" parameter "\">")))
616 ; (html-maybe-deemphasize-region (1+ start) (1- (point)))))))
617
618 588
619 589
620 ;;; Functions, which adds tags of the form <starttag> ... </endtag> 590 ;;; Functions, which adds tags of the form <starttag> ... </endtag>
621 591
622 (defun hm--html-add-big () 592 (defun hm--html-add-big ()
920 "<PRE>" 890 "<PRE>"
921 'hm--html-insert-end-tag-with-newline 891 'hm--html-insert-end-tag-with-newline
922 "</PRE>")) 892 "</PRE>"))
923 893
924 894
925 (defun hm--html-add-plaintext ()
926 "Adds the HTML tags for plaintext."
927 (interactive)
928 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
929 "<XMP>"
930 'hm--html-insert-end-tag-with-newline
931 "</XMP>"))
932
933
934 (defun hm--html-add-plaintext-to-region ()
935 "Adds the HTML tags for plaintext to the region."
936 (interactive)
937 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
938 "<XMP>"
939 'hm--html-insert-end-tag-with-newline
940 "</XMP>"))
941
942
943 (defun hm--html-add-blockquote () 895 (defun hm--html-add-blockquote ()
944 "Adds the HTML tags for blockquote." 896 "Adds the HTML tags for blockquote."
945 (interactive) 897 (interactive)
946 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline 898 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
947 "<BLOCKQUOTE>" 899 "<BLOCKQUOTE>"
955 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline 907 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
956 "<BLOCKQUOTE>" 908 "<BLOCKQUOTE>"
957 'hm--html-insert-end-tag-with-newline 909 'hm--html-insert-end-tag-with-newline
958 "</BLOCKQUOTE>")) 910 "</BLOCKQUOTE>"))
959 911
960 (defun hm--html-add-abstract () 912 (defun hm--html-add-script ()
961 "Adds the HTML tags for abstract text at the point in the current buffer." 913 "Adds the HTML tags for script."
962 (interactive) 914 (interactive)
963 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline 915 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
964 "<ABSTRACT>" 916 "<SCRIPT>"
965 'hm--html-insert-end-tag-with-newline 917 'hm--html-insert-end-tag-with-newline
966 "</ABSTRACT>")) 918 "</SCRIPT>"))
967 919
968 920
969 (defun hm--html-add-abstract-to-region () 921 (defun hm--html-add-script-to-region ()
970 "Adds the HTML tags for abstract text to the region." 922 "Adds the HTML tags for script to the region."
971 (interactive) 923 (interactive)
972 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline 924 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
973 "<ABSTRACT>" 925 "<SCRIPT>"
974 'hm--html-insert-end-tag-with-newline 926 'hm--html-insert-end-tag-with-newline
975 "</ABSTRACT>")) 927 "</SCRIPT>"))
976 928
977 929 (defun hm--html-add-style ()
930 "Adds the HTML tags for style."
931 (interactive)
932 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
933 "<STYLE>"
934 'hm--html-insert-end-tag-with-newline
935 "</STYLE>"))
936
937
938 (defun hm--html-add-style-to-region ()
939 "Adds the HTML tags for style to the region."
940 (interactive)
941 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
942 "<STYLE>"
943 'hm--html-insert-end-tag-with-newline
944 "</STYLE>"))
978 945
979 (defun hm--html-add-strikethru () 946 (defun hm--html-add-strikethru ()
980 "Adds the HTML tags for Strikethru at the point in the current buffer." 947 "Adds the HTML tags for Strikethru at the point in the current buffer."
981 (interactive) 948 (interactive)
982 (hm--html-add-tags 'hm--html-insert-start-tag 949 (hm--html-add-tags 'hm--html-insert-start-tag
987 954
988 (defun hm--html-add-strikethru-to-region () 955 (defun hm--html-add-strikethru-to-region ()
989 "Adds the HTML tags for Strikethru to the region." 956 "Adds the HTML tags for Strikethru to the region."
990 (interactive) 957 (interactive)
991 (hm--html-add-tags-to-region 'hm--html-insert-start-tag 958 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
992 "<S>" 959 "<STRIKE>"
993 'hm--html-insert-end-tag 960 'hm--html-insert-end-tag
994 "</S>")) 961 "</STRIKE>"))
995 962
996 963
997 (defun hm--html-add-superscript () 964 (defun hm--html-add-superscript ()
998 "Adds the HTML tags for Superscript at the point in the current buffer." 965 "Adds the HTML tags for Superscript at the point in the current buffer."
999 (interactive) 966 (interactive)
1028 "<SUB>" 995 "<SUB>"
1029 'hm--html-insert-end-tag 996 'hm--html-insert-end-tag
1030 "</SUB>")) 997 "</SUB>"))
1031 998
1032 999
1033 (defun hm--html-add-quote ()
1034 "Adds the HTML tags for Quote at the point in the current buffer."
1035 (interactive)
1036 (hm--html-add-tags 'hm--html-insert-start-tag
1037 "<Q>"
1038 'hm--html-insert-end-tag
1039 "</Q>"))
1040
1041
1042 (defun hm--html-add-quote-to-region ()
1043 "Adds the HTML tags for Quote to the region."
1044 (interactive)
1045 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1046 "<Q>"
1047 'hm--html-insert-end-tag
1048 "</Q>"))
1049
1050
1051 (defun hm--html-add-person ()
1052 "Adds the HTML tags for Person at the point in the current buffer."
1053 (interactive)
1054 (hm--html-add-tags 'hm--html-insert-start-tag
1055 "<PERSON>"
1056 'hm--html-insert-end-tag
1057 "</PERSON>"))
1058
1059
1060 (defun hm--html-add-person-to-region ()
1061 "Adds the HTML tags for Person to the region."
1062 (interactive)
1063 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1064 "<PERSON>"
1065 'hm--html-insert-end-tag
1066 "</PERSON>"))
1067
1068
1069 (defun hm--html-add-instance ()
1070 "Adds the HTML tags for Instance at the point in the current buffer."
1071 (interactive)
1072 (hm--html-add-tags 'hm--html-insert-start-tag
1073 "<INS>"
1074 'hm--html-insert-end-tag
1075 "</INS>"))
1076
1077
1078 (defun hm--html-add-instance-to-region ()
1079 "Adds the HTML tags for Instance to the region."
1080 (interactive)
1081 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1082 "<INS>"
1083 'hm--html-insert-end-tag
1084 "</INS>"))
1085
1086
1087 (defun hm--html-add-option () 1000 (defun hm--html-add-option ()
1088 "Adds the HTML tags for Option at the point in the current buffer." 1001 "Adds the HTML tags for Option at the point in the current buffer."
1089 (interactive) 1002 (interactive)
1090 (hm--html-add-tags 'hm--html-insert-start-tag 1003 (hm--html-add-tags 'hm--html-insert-start-tag
1091 "<OPT>" 1004 "<OPT>"
1099 (hm--html-add-tags-to-region 'hm--html-insert-start-tag 1012 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1100 "<OPT>" 1013 "<OPT>"
1101 'hm--html-insert-end-tag 1014 'hm--html-insert-end-tag
1102 "</OPT>")) 1015 "</OPT>"))
1103 1016
1104
1105 (defun hm--html-add-publication ()
1106 "Adds the HTML tags for Publication at the point in the current buffer."
1107 (interactive)
1108 (hm--html-add-tags 'hm--html-insert-start-tag
1109 "<PUB>"
1110 'hm--html-insert-end-tag
1111 "</PUB>"))
1112
1113
1114 (defun hm--html-add-publication-to-region ()
1115 "Adds the HTML tags for Publication to the region."
1116 (interactive)
1117 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1118 "<PUB>"
1119 'hm--html-insert-end-tag
1120 "</PUB>"))
1121
1122
1123 (defun hm--html-add-author ()
1124 "Adds the HTML tags for Author at the point in the current buffer."
1125 (interactive)
1126 (hm--html-add-tags 'hm--html-insert-start-tag
1127 "<AUTHOR>"
1128 'hm--html-insert-end-tag
1129 "</AUTHOR>"))
1130
1131
1132 (defun hm--html-add-author-to-region ()
1133 "Adds the HTML tags for Author to the region."
1134 (interactive)
1135 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1136 "<AUTHOR>"
1137 'hm--html-insert-end-tag
1138 "</AUTHOR>"))
1139
1140
1141 (defun hm--html-add-editor ()
1142 "Adds the HTML tags for Editor at the point in the current buffer."
1143 (interactive)
1144 (hm--html-add-tags 'hm--html-insert-start-tag
1145 "<EDITOR>"
1146 'hm--html-insert-end-tag
1147 "</EDITOR>"))
1148
1149
1150 (defun hm--html-add-editor-to-region ()
1151 "Adds the HTML tags for Editor to the region."
1152 (interactive)
1153 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1154 "<EDITOR>"
1155 'hm--html-insert-end-tag
1156 "</EDITOR>"))
1157
1158
1159 (defun hm--html-add-credits ()
1160 "Adds the HTML tags for Credits at the point in the current buffer."
1161 (interactive)
1162 (hm--html-add-tags 'hm--html-insert-start-tag
1163 "<CREDITS>"
1164 'hm--html-insert-end-tag
1165 "</CREDITS>"))
1166
1167
1168 (defun hm--html-add-credits-to-region ()
1169 "Adds the HTML tags for Credits to the region."
1170 (interactive)
1171 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1172 "<CREDITS>"
1173 'hm--html-insert-end-tag
1174 "</CREDITS>"))
1175
1176
1177 (defun hm--html-add-copyright ()
1178 "Adds the HTML tags for Copyright at the point in the current buffer."
1179 (interactive)
1180 (hm--html-add-tags 'hm--html-insert-start-tag
1181 "<COPYRIGHT>"
1182 'hm--html-insert-end-tag
1183 "</COPYRIGHT>"))
1184
1185
1186 (defun hm--html-add-copyright-to-region ()
1187 "Adds the HTML tags for Copyright to the region."
1188 (interactive)
1189 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1190 "<COPYRIGHT>"
1191 'hm--html-insert-end-tag
1192 "</COPYRIGHT>"))
1193
1194
1195 (defun hm--html-add-isbn ()
1196 "Adds the HTML tags for ISBN at the point in the current buffer."
1197 (interactive)
1198 (hm--html-add-tags 'hm--html-insert-start-tag
1199 "<ISBN>"
1200 'hm--html-insert-end-tag
1201 "</ISBN>"))
1202
1203
1204 (defun hm--html-add-isbn-to-region ()
1205 "Adds the HTML tags for ISBN to the region."
1206 (interactive)
1207 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1208 "<ISBN>"
1209 'hm--html-insert-end-tag
1210 "</ISBN>"))
1211
1212
1213 (defun hm--html-add-acronym ()
1214 "Adds the HTML tags for Acronym at the point in the current buffer."
1215 (interactive)
1216 (hm--html-add-tags 'hm--html-insert-start-tag
1217 "<ACRONYM>"
1218 'hm--html-insert-end-tag
1219 "</ACRONYM>"))
1220
1221
1222 (defun hm--html-add-acronym-to-region ()
1223 "Adds the HTML tags for Acronym to the region."
1224 (interactive)
1225 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1226 "<ACRONYM>"
1227 'hm--html-insert-end-tag
1228 "</ACRONYM>"))
1229
1230
1231 (defun hm--html-add-abbrevation ()
1232 "Adds the HTML tags for Abbrevation at the point in the current buffer."
1233 (interactive)
1234 (hm--html-add-tags 'hm--html-insert-start-tag
1235 "<ABBREV>"
1236 'hm--html-insert-end-tag
1237 "</ABBREV>"))
1238
1239
1240 (defun hm--html-add-abbrev-to-region ()
1241 "Adds the HTML tags for Abbrev to the region."
1242 (interactive)
1243 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1244 "<ABBREV>"
1245 'hm--html-insert-end-tag
1246 "</ABBREV>"))
1247
1248
1249 (defun hm--html-add-command ()
1250 "Adds the HTML tags for Command at the point in the current buffer."
1251 (interactive)
1252 (hm--html-add-tags 'hm--html-insert-start-tag
1253 "<CMD>"
1254 'hm--html-insert-end-tag
1255 "</CMD>"))
1256
1257
1258 (defun hm--html-add-command-to-region ()
1259 "Adds the HTML tags for Command to the region."
1260 (interactive)
1261 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1262 "<CMD>"
1263 'hm--html-insert-end-tag
1264 "</CMD>"))
1265
1266
1267 (defun hm--html-add-argument ()
1268 "Adds the HTML tags for Argument at the point in the current buffer."
1269 (interactive)
1270 (hm--html-add-tags 'hm--html-insert-start-tag
1271 "<ARG>"
1272 'hm--html-insert-end-tag
1273 "</ARG>"))
1274
1275
1276 (defun hm--html-add-argument-to-region ()
1277 "Adds the HTML tags for Argument to the region."
1278 (interactive)
1279 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1280 "<ARG>"
1281 'hm--html-insert-end-tag
1282 "</ARG>"))
1283
1284
1285 (defun hm--html-add-literature ()
1286 "Adds the HTML tags for Literature at the point in the current buffer."
1287 (interactive)
1288 (hm--html-add-tags 'hm--html-insert-start-tag
1289 "<LIT>"
1290 'hm--html-insert-end-tag
1291 "</LIT>"))
1292
1293
1294 (defun hm--html-add-literature-to-region ()
1295 "Adds the HTML tags for Literature to the region."
1296 (interactive)
1297 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1298 "<LIT>"
1299 'hm--html-insert-end-tag
1300 "</LIT>"))
1301
1302
1303 (defun hm--html-add-footnote ()
1304 "Adds the HTML tags for Footnote at the point in the current buffer."
1305 (interactive)
1306 (hm--html-add-tags 'hm--html-insert-start-tag
1307 "<FOOTNOTE>"
1308 'hm--html-insert-end-tag
1309 "</FOOTNOTE>"))
1310
1311
1312 (defun hm--html-add-footnote-to-region ()
1313 "Adds the HTML tags for Footnote to the region."
1314 (interactive)
1315 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1316 "<FOOTNOTE>"
1317 'hm--html-insert-end-tag
1318 "</FOOTNOTE>"))
1319
1320
1321 (defun hm--html-add-margin ()
1322 "Adds the HTML tags for Margin at the point in the current buffer."
1323 (interactive)
1324 (hm--html-add-tags 'hm--html-insert-start-tag
1325 "<MARGIN>"
1326 'hm--html-insert-end-tag
1327 "</MARGIN>"))
1328
1329
1330 (defun hm--html-add-margin-to-region ()
1331 "Adds the HTML tags for Margin to the region."
1332 (interactive)
1333 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
1334 "<MARGIN>"
1335 'hm--html-insert-end-tag
1336 "</MARGIN>"))
1337 1017
1338 (defun hm--html-read-font-size (&optional only-absolute-size) 1018 (defun hm--html-read-font-size (&optional only-absolute-size)
1339 "Reads the size for the FONT element. 1019 "Reads the size for the FONT element.
1340 It returns nil, if the size should not be changed." 1020 It returns nil, if the size should not be changed."
1341 (let ((size 1021 (let ((size
1409 1089
1410 1090
1411 ;;; Lists 1091 ;;; Lists
1412 1092
1413 1093
1414 (defun hm--html-add-listing ()
1415 "Adds the HTML tags for listing."
1416 (interactive)
1417 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
1418 "<LISTING>"
1419 'hm--html-insert-end-tag-with-newline
1420 "</LISTING>"))
1421
1422
1423 (defun hm--html-add-listing-to-region ()
1424 "Adds the HTML tags for listing to the region."
1425 (interactive)
1426 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
1427 "<LISTING>"
1428 'hm--html-insert-end-tag-with-newline
1429 "</LISTING>"))
1430
1431 (defun hm--html-add-center () 1094 (defun hm--html-add-center ()
1432 "Adds the HTML tags for center at the current point." 1095 "Adds the HTML tags for center at the current point."
1433 (interactive) 1096 (interactive)
1434 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline 1097 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline
1435 "<CENTER>" 1098 "<CENTER>"
1605 (interactive) 1268 (interactive)
1606 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline 1269 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline
1607 "<DL>" 1270 "<DL>"
1608 'hm--html-insert-end-tag-with-newline 1271 'hm--html-insert-end-tag-with-newline
1609 "</DL>")) 1272 "</DL>"))
1610
1611 ; 'hm--html-insert-start-tag
1612 ; "<DT> "))
1613 1273
1614 1274
1615 (defun hm--html-add-description-title () 1275 (defun hm--html-add-description-title ()
1616 "Adds the HTML tags for a description title at current point in the buffer." 1276 "Adds the HTML tags for a description title at current point in the buffer."
1617 (interactive) 1277 (interactive)
2032 'hm--html-insert-end-tag 1692 'hm--html-insert-end-tag
2033 "</A>")) 1693 "</A>"))
2034 1694
2035 (defun hm--html-add-link-target (name) 1695 (defun hm--html-add-link-target (name)
2036 "Adds the HTML tags for a link target at point in the current buffer." 1696 "Adds the HTML tags for a link target at point in the current buffer."
2037 ; (interactive "sName (or RET for numeric): ")
2038 (interactive "sName: ") 1697 (interactive "sName: ")
2039 ; (and (string= name "")
2040 ; (progn
2041 ; (setq html-link-counter (1+ html-link-counter))
2042 ; (setq name (format "%d" html-link-counter))))
2043 (hm--html-add-tags 'hm--html-insert-start-tag 1698 (hm--html-add-tags 'hm--html-insert-start-tag
2044 (concat "<A NAME=\"" name "\">") 1699 (concat "<A NAME=\"" name "\">")
2045 'hm--html-insert-end-tag 1700 'hm--html-insert-end-tag
2046 "</A>")) 1701 "</A>"))
2047 1702
2064 1719
2065 (defun hm--html-unmark-example (extent) 1720 (defun hm--html-unmark-example (extent)
2066 "Unmarks the example for the current question." 1721 "Unmarks the example for the current question."
2067 (if extent 1722 (if extent
2068 (delete-extent extent))) 1723 (delete-extent extent)))
2069
2070 ; )
2071 ; ;; For the Emacs 19
2072 ; (defun hm--html-mark-example (parameter-list)
2073 ; "Marks the example of the parameterlist in the current buffer.
2074 ;It returns the example extent."
2075 ; (if (hm--html-get-example-from-parameter-list parameter-list)
2076 ; (progn
2077 ; (search-forward (hm--html-get-example-from-parameter-list
2078 ; parameter-list))
2079 ; (put-text-property (match-beginning 0)
2080 ; (match-end 0)
2081 ; 'face
2082 ; 'hm--html-help-face))))
2083 ;
2084 ;
2085 ; (defun hm--html-unmark-example (extent)
2086 ; "Unmarks the example for the current question."
2087 ; t))
2088 1724
2089 1725
2090 (defun hm--html-write-alist-in-buffer (alist) 1726 (defun hm--html-write-alist-in-buffer (alist)
2091 "The function writes the contents of the ALIST in the currentbuffer." 1727 "The function writes the contents of the ALIST in the currentbuffer."
2092 (cond ((car alist) 1728 (cond ((car alist)
2188 "" 1824 ""
2189 require-match 1825 require-match
2190 nil))) 1826 nil)))
2191 (hm--html-unmark-example marked-object) 1827 (hm--html-unmark-example marked-object)
2192 (hm--html-delete-wrong-path-prefix filename)) 1828 (hm--html-delete-wrong-path-prefix filename))
2193 ; (if (not hm--html-delete-wrong-path-prefix)
2194 ; filename
2195 ; (if (string-match hm--html-delete-wrong-path-prefix filename)
2196 ; (substring filename (match-end 0))
2197 ; filename)))
2198 "")) 1829 ""))
2199 1830
2200 1831
2201 (defun hm--html-completing-read (parameter-list) 1832 (defun hm--html-completing-read (parameter-list)
2202 "Reads a string with completing-read, if alist is non nil. 1833 "Reads a string with completing-read, if alist is non nil.
2226 1857
2227 1858
2228 (defun hm--html-generate-help-buffer-faces () 1859 (defun hm--html-generate-help-buffer-faces ()
2229 "Generates faces for the add-link-help-buffer." 1860 "Generates faces for the add-link-help-buffer."
2230 (if (not (facep 'hm--html-help-face)) 1861 (if (not (facep 'hm--html-help-face))
2231 ; (if (not hm--html-faces-exist)
2232 (progn 1862 (progn
2233 (setq hm--html-faces-exist t) 1863 (setq hm--html-faces-exist t)
2234 (make-face 'hm--html-help-face) 1864 (make-face 'hm--html-help-face)
2235 (if hm--html-help-foreground 1865 (if hm--html-help-foreground
2236 (set-face-foreground 'hm--html-help-face hm--html-help-foreground)) 1866 (set-face-foreground 'hm--html-help-face hm--html-help-foreground))
3097 Single argument LINK-OBJECT is value of HREF in the new anchor. 2727 Single argument LINK-OBJECT is value of HREF in the new anchor.
3098 Mark is set after anchor." 2728 Mark is set after anchor."
3099 (interactive "sNode Link to: ") 2729 (interactive "sNode Link to: ")
3100 (hm--html-add-tags-to-region 'hm--html-insert-start-tag 2730 (hm--html-add-tags-to-region 'hm--html-insert-start-tag
3101 (concat "<A HREF=\"" 2731 (concat "<A HREF=\""
3102 ; (read-string "Link to: ")
3103 link-object 2732 link-object
3104 "\">") 2733 "\">")
3105 'hm--html-insert-end-tag 2734 'hm--html-insert-end-tag
3106 "</A>")) 2735 "</A>"))
3107 2736
3140 (point-max))))) 2769 (point-max)))))
3141 (goto-char (point-min)) 2770 (goto-char (point-min))
3142 (if (re-search-forward 2771 (if (re-search-forward
3143 (concat 2772 (concat
3144 "\\((\\)" 2773 "\\((\\)"
3145 "\\([ \t]*[0-3]?[0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9][0-9][ \t]*\\)" 2774 "\\([ \t]*[0-3]?[0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9][0-9]"
2775 "[ \t]*\\)"
3146 "\\()[ \t\n]*</title>\\)") 2776 "\\()[ \t\n]*</title>\\)")
3147 end-of-head 2777 end-of-head
3148 t) 2778 t)
3149 (progn 2779 (progn
3150 (delete-region (match-beginning 2) (match-end 2)) 2780 (delete-region (match-beginning 2) (match-end 2))
3196 "Internal function of 'hm--html-insert-changed-comment'. 2826 "Internal function of 'hm--html-insert-changed-comment'.
3197 Inserts a newline if NEWLINE is t, before the comment is inserted. 2827 Inserts a newline if NEWLINE is t, before the comment is inserted.
3198 USERNAME is the name to be inserted in the comment." 2828 USERNAME is the name to be inserted in the comment."
3199 (if newline 2829 (if newline
3200 (progn 2830 (progn
3201 ; (end-of-line)
3202 (newline))) 2831 (newline)))
3203 (hm--html-add-comment) 2832 (hm--html-add-comment)
3204 (insert "Changed by: " username ", " (hm--date))) 2833 (insert "Changed by: " username ", " (hm--date)))
3205 2834
3206 (defun hm--html-insert-changed-comment (&optional noerror) 2835 (defun hm--html-insert-changed-comment (&optional noerror)
3280 (tmpl-automatic-expand hm--html-automatic-expand-templates) 2909 (tmpl-automatic-expand hm--html-automatic-expand-templates)
3281 (tmpl-history-variable-name 'hm--html-template-file-history)) 2910 (tmpl-history-variable-name 'hm--html-template-file-history))
3282 (if filename 2911 (if filename
3283 (tmpl-insert-template-file filename) 2912 (tmpl-insert-template-file filename)
3284 (call-interactively 'tmpl-insert-template-file)) 2913 (call-interactively 'tmpl-insert-template-file))
3285 ; (if hm--html-automatic-created-comment ; better in the template files
3286 ; (hm--html-insert-created-comment t)
3287 )) 2914 ))
3288 2915
3289 (defun hm--html-insert-template-from-fixed-dirs (filename) 2916 (defun hm--html-insert-template-from-fixed-dirs (filename)
3290 "Inserts a templatefile. 2917 "Inserts a templatefile.
3291 It uses `tmpl-insert-template-file-from-fixed-dirs' to insert 2918 It uses `tmpl-insert-template-file-from-fixed-dirs' to insert
3302 (tmpl-filter-regexp hm--html-template-filter-regexp) 2929 (tmpl-filter-regexp hm--html-template-filter-regexp)
3303 (tmpl-history-variable-name 'hm--html-template-file-history)) 2930 (tmpl-history-variable-name 'hm--html-template-file-history))
3304 (if filename 2931 (if filename
3305 (tmpl-insert-template-file-from-fixed-dirs filename) 2932 (tmpl-insert-template-file-from-fixed-dirs filename)
3306 (call-interactively 'tmpl-insert-template-file-from-fixed-dirs)) 2933 (call-interactively 'tmpl-insert-template-file-from-fixed-dirs))
3307 ; (if hm--html-automatic-created-comment ; better in the template files
3308 ; (hm--html-insert-created-comment t)
3309 )) 2934 ))
3310
3311 ;(defun hm--html-insert-template (filename)
3312 ; "Inserts a templatefile."
3313 ; (interactive
3314 ; (list (tmpl-read-template-filename hm--html-template-dir
3315 ; hm--html-automatic-expand-templates
3316 ; hm--html-template-filter-regexp
3317 ; 'hm--html-template-file-history)))
3318 ; (interactive (list
3319 ; (let ((file-name-history hm--html-template-file-history))
3320 ; (read-file-name "Templatefile: "
3321 ; hm--html-template-dir
3322 ; nil
3323 ; t
3324 ; nil))))
3325 ;; 'hm--html-template-file-history)))
3326 ; (insert-file (expand-file-name filename))
3327 ; (if hm--html-automatic-expand-templates
3328 ; (tmpl-expand-templates-in-buffer))
3329 ; (if hm--html-automatic-created-comment
3330 ; (hm--html-insert-created-comment t)))
3331
3332
3333
3334 ;;; Functions for highlighting
3335
3336 ;(defun hm--html-toggle-use-highlighting ()
3337 ; "Toggles the variable html-use-highlighting."
3338 ; (interactive)
3339 ; (if html-use-highlighting
3340 ; (setq html-use-highlighting nil)
3341 ; (setq html-use-highlighting t)))
3342 2935
3343 2936
3344 ;;; Functions for font lock mode 2937 ;;; Functions for font lock mode
3345 2938
3346 (if (adapt-emacs19p) 2939 (if (adapt-emacs19p)
3355 (or (face-differs-from-default-p 'font-lock-string-face) 2948 (or (face-differs-from-default-p 'font-lock-string-face)
3356 (progn 2949 (progn
3357 (copy-face 'font-lock-doc-string-face 'font-lock-string-face) 2950 (copy-face 'font-lock-doc-string-face 'font-lock-string-face)
3358 (set-face-underline-p 'font-lock-string-face t))) 2951 (set-face-underline-p 'font-lock-string-face t)))
3359 (setq font-lock-comment-face 'font-lock-comment-face) 2952 (setq font-lock-comment-face 'font-lock-comment-face)
3360 ;; (setq font-lock-doc-string-face 'font-lock-doc-string-face)
3361 (setq font-lock-string-face 'font-lock-string-face))) 2953 (setq font-lock-string-face 'font-lock-string-face)))
3362
3363
3364 ;(defun hm--html-set-font-lock-color ()
3365 ; "Sets the color for the font lock mode in HTML mode.
3366 ;This color is used to highlight HTML expressions."
3367 ; (interactive)
3368 ; (setq hm--html-font-lock-color
3369 ; (completing-read "Color: "
3370 ; '(("grey80")
3371 ; ("black")
3372 ; ("red")
3373 ; ("yellow")
3374 ; ("blue"))
3375 ; nil
3376 ; nil
3377 ; "black"))
3378 ; (set-face-foreground 'font-lock-comment-face hm--html-font-lock-color)
3379 ; (set-face-foreground 'font-lock-string-face hm--html-font-lock-color))
3380
3381
3382 ;;; Functions which determine if an active region exists
3383
3384 ;(defvar hm--region-active nil
3385 ; "t : Region is active.
3386 ;nil: Region is inactive.")
3387 ;
3388 ;
3389 ;(defun hm--set-hm--region-active ()
3390 ; (setq hm--region-active t))
3391 ;
3392 ;
3393 ;(defun hm--unset-hm--region-active ()
3394 ; (setq hm--region-active nil))
3395
3396 2954
3397 2955
3398 ;;; Functions to insert forms 2956 ;;; Functions to insert forms
3399 2957
3400 (defun hm--html-form-read-method () 2958 (defun hm--html-form-read-method ()
4494 4052
4495 ;;This should be extended in the future to use also other viewers. 4053 ;;This should be extended in the future to use also other viewers.
4496 (defun hm--html-view-www-package-docu () 4054 (defun hm--html-view-www-package-docu ()
4497 "View the WWW documentation of the package." 4055 "View the WWW documentation of the package."
4498 (interactive) 4056 (interactive)
4499 (w3-fetch "http://www.tnt.uni-hannover.de:80/data/info/www/tnt/soft/info/www/html-editors/hm--html-menus/overview.html")) 4057 (w3-fetch (concat "http://www.tnt.uni-hannover.de"
4058 "/~muenkel/software/own/hm--html-menus/overview.html")))
4059
4500 4060
4501 ;;; 4061 ;;;
4502 ; Bug reporting 4062 ; Bug reporting
4503 ; 4063 ;
4504 4064
4555 'hm--html-wais-hostname:port-alist 4115 'hm--html-wais-hostname:port-alist
4556 'hm--html-wais-hostname:port-default 4116 'hm--html-wais-hostname:port-default
4557 'hm--html-wais-path-alist 4117 'hm--html-wais-path-alist
4558 'hm--html-wais-servername:port-alist 4118 'hm--html-wais-servername:port-alist
4559 'hm--html-wais-servername:port-default 4119 'hm--html-wais-servername:port-default
4560 ; 'html-deemphasize-color
4561 'html-document-previewer 4120 'html-document-previewer
4562 ; 'html-document-previewer-args
4563 ; 'html-emphasize-color
4564 ; 'html-quotify-hrefs-on-find
4565 'hm--html-region-mode 4121 'hm--html-region-mode
4566 'html-sigusr1-signal-value 4122 'html-sigusr1-signal-value
4567 ; 'html-use-font-lock
4568 ; 'html-use-highlighting
4569 ) 4123 )
4570 nil 4124 nil
4571 nil 4125 nil
4572 "Decribe your Bug: " 4126 "Decribe your Bug: "
4573 ))) 4127 )))
4580 (if (adapt-xemacsp) 4134 (if (adapt-xemacsp)
4581 (progn 4135 (progn
4582 4136
4583 (add-hook 'zmacs-activate-region-hook 4137 (add-hook 'zmacs-activate-region-hook
4584 'hm--html-switch-region-modes-on) 4138 'hm--html-switch-region-modes-on)
4585 ; (function (lambda () (hm--html-region-mode 1))))
4586 4139
4587 (add-hook 'zmacs-deactivate-region-hook 4140 (add-hook 'zmacs-deactivate-region-hook
4588 'hm--html-switch-region-modes-off) 4141 'hm--html-switch-region-modes-off)
4589 ; (function (lambda () (hm--html-region-mode -1))))
4590 4142
4591 ) 4143 )
4592 4144
4593 (transient-mark-mode t) 4145 (transient-mark-mode t)
4594 4146
4595 (add-hook 'activate-mark-hook 4147 (add-hook 'activate-mark-hook
4596 'hm--html-switch-region-modes-on) 4148 'hm--html-switch-region-modes-on)
4597 ; (function (lambda () (hm--html-region-mode t))))
4598 4149
4599 (add-hook 'deactivate-mark-hook 4150 (add-hook 'deactivate-mark-hook
4600 'hm--html-switch-region-modes-off) 4151 'hm--html-switch-region-modes-off)
4601 ; (function (lambda () (hm--html-region-mode nil))))
4602 4152
4603 ) 4153 )
4604
4605
4606 ;(add-hook 'hm--html-mode-hook
4607 ; (function
4608 ; (lambda ()
4609 ; (make-variable-buffer-local 'write-file-hooks)
4610 ; (add-hook 'write-file-hooks
4611 ; 'hm--html-maybe-new-date-and-changed-comment))))
4612
4613 ;(add-hook 'zmacs-activate-region-hook 'hm--set-hm--region-active)
4614 ;
4615 ;(add-hook 'zmacs-deactivate-region-hook 'hm--unset-hm--region-active)
4616
4617 4154
4618 4155
4619 ;;; 4156 ;;;
4620 ; Environment loading 4157 ; Environment loading
4621 ; 4158 ;
4673 "Look at hm--html-load-config-files !"))) 4210 "Look at hm--html-load-config-files !")))
4674 ) 4211 )
4675 ) 4212 )
4676 4213
4677 4214
4678
4679 ;(hm--html-load-config-files)
4680
4681 ;;; Definition of the minor mode html-region-mode
4682
4683 ;(defvar html-region-mode nil
4684 ; "*t, if the minor mode html-region-mode is on and nil otherwise.")
4685
4686 ;(make-variable-buffer-local 'html-region-mode)
4687
4688 ;(defvar html-region-mode-map nil "")
4689
4690 ;(hm--html-load-config-files)
4691
4692 ;(if hm--html-use-old-keymap
4693 ; (progn
4694
4695 ;;(setq minor-mode-alist (cons '(html-region-mode " Region") minor-mode-alist))
4696 ;(or (assq 'html-region-mode minor-mode-alist)
4697 ; (setq minor-mode-alist
4698 ; (purecopy
4699 ; (append minor-mode-alist
4700 ; '((html-region-mode " Region"))))))
4701
4702 ;(defun html-region-mode (on)
4703 ; "Turns the minor mode html-region-mode on or off.
4704 ;The function turns the html-region-mode on, if ON is t and off otherwise."
4705 ; (if (string= mode-name "HTML")
4706 ; (if on
4707 ; ;; html-region-mode on
4708 ; (progn
4709 ; (setq html-region-mode t)
4710 ; (use-local-map html-region-mode-map))
4711 ; ;; html-region-mode off
4712 ; (setq html-region-mode nil)
4713 ; (use-local-map html-mode-map))))
4714
4715 ;))
4716
4717
4718
4719
4720
4721 ;;;
4722 ; Set font lock color
4723 ; (hm--html-font-lock-color should be defined in hm--html-configuration.el
4724 ; oder .hm--html-configuration.el)
4725 ;
4726 ;(require 'font-lock)
4727 ;(load-library "font-lock")
4728 ;(set-face-foreground 'font-lock-comment-face hm--html-font-lock-color)
4729
4730
4731 ;(hm--html-generate-help-buffer-faces)
4732
4733
4734
4735
4736 ;;;;;;;;
4737 ;(setq hm--html-hostname-search-string
4738 ; "[-a-zA-Z0-9]*\\.[-a-zA-Z0-9]*\\.[-a-zA-Z0-9.]*")
4739 ;
4740 ;(defun hm--html-get-next-hostname ()
4741 ; (interactive)
4742 ; (search-forward-regexp hm--html-hostname-search-string)
4743 ; (buffer-substring (match-beginning 0) (match-end 0)))
4744 ;
4745
4746 ;;; Announce the feature hm--html-configuration
4747
4748 ;;; quotify href 4215 ;;; quotify href
4749 4216
4750 (defvar hm--html-quotify-href-regexp 4217 (defvar hm--html-quotify-href-regexp
4751 "<[aA][ \t\n]+\\([nN][aA][mM][eE]=[a-zA-Z0-9]+[ \t\n]+\\)?[hH][rR][eE][fF]=" 4218 "<[aA][ \t\n]+\\([nN][aA][mM][eE]=[a-zA-Z0-9]+[ \t\n]+\\)?[hH][rR][eE][fF]="
4752 "Regular expression used for searching hrefs.") 4219 "Regular expression used for searching hrefs.")