Mercurial > hg > xemacs-beta
comparison lisp/w3/w3-parse.el @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | 5a88923fcbfe |
children |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
63 (eval-when-compile | 63 (eval-when-compile |
64 (defconst w3-p-s-var-list nil | 64 (defconst w3-p-s-var-list nil |
65 "A list of the scratch variables used by functions called by | 65 "A list of the scratch variables used by functions called by |
66 w3-parse-buffer which it is w3-parse-buffer's responsibility to | 66 w3-parse-buffer which it is w3-parse-buffer's responsibility to |
67 \"let\"-bind.") | 67 \"let\"-bind.") |
68 | |
69 ;; *** This is unused and does not belong right here anyway. | |
70 (defmacro w3-resolve-numeric-entity (ent) | |
71 "Return a string representing the numeric entity ENT (&#ENT;)" | |
72 (` (if (< (, ent) 256) | |
73 (char-to-string (, ent)) | |
74 (format "[Too large character: %s]" (, ent))))) | |
75 | 68 |
76 (defmacro w3-p-s-var-def (var) | 69 (defmacro w3-p-s-var-def (var) |
77 "Declare VAR as a scratch variable which w3-parse-buffer must | 70 "Declare VAR as a scratch variable which w3-parse-buffer must |
78 \"let\"-bind." | 71 \"let\"-bind." |
79 (` (eval-when-compile | 72 (` (eval-when-compile |
217 '([&rest &or ":nocontext" ":outer" [":mandatory-if" form] ":bad-style"] | 210 '([&rest &or ":nocontext" ":outer" [":mandatory-if" form] ":bad-style"] |
218 &rest form)) | 211 &rest form)) |
219 ) | 212 ) |
220 | 213 |
221 (defun w3-debug-html-aux (message &optional outer nocontext) | 214 (defun w3-debug-html-aux (message &optional outer nocontext) |
222 (let ( | 215 (push (if nocontext |
223 ;; We have already determined whether the user should see the | 216 message |
224 ;; message, so don't let w3-warn suppress it. | 217 (concat message |
225 (w3-debug-html t)) | 218 ;; Display context information for each error |
226 ;; Print the URL before the first error message for a document. | 219 ;; message. |
227 (cond (w3-p-d-debug-url | 220 "\n Containing elements: " |
228 (let ((url (url-view-url t))) | 221 (w3-open-elements-string (if outer 1)) |
229 (w3-warn 'html | 222 (concat |
230 (if (or (null url) | 223 "\n Text around error: " |
231 (string-equal "" url)) | 224 (save-restriction |
232 (format "HTML errors for buffer %s" | 225 (widen) |
233 (current-buffer)) | 226 (progn |
234 (format "HTML errors for <URL:%s>" url)))) | 227 (insert "*ERROR*") |
235 (setq w3-p-d-debug-url nil))) | 228 (prog1 |
236 (w3-warn 'html | 229 (w3-quote-for-string |
237 (if nocontext | 230 (buffer-substring |
238 message | 231 (max (- (point) 27) (point-min)) |
239 (concat message | 232 (min (+ (point) 20) (point-max)))) |
240 ;; Display context information for each error | 233 (delete-char -7))))))) w3-current-badhtml)) |
241 ;; message. | |
242 "\n Containing elements: " | |
243 (w3-open-elements-string (if outer 1)) | |
244 (concat | |
245 "\n Text around error: " | |
246 (save-restriction | |
247 (widen) | |
248 (progn | |
249 (insert "*ERROR*") | |
250 (prog1 | |
251 (w3-quote-for-string | |
252 (buffer-substring | |
253 (max (- (point) 27) (point-min)) | |
254 (min (+ (point) 20) (point-max)))) | |
255 (delete-char -7)))))))))) | |
256 | 234 |
257 (defun w3-quote-for-string (string) | 235 (defun w3-quote-for-string (string) |
258 (save-excursion | 236 (save-excursion |
259 (set-buffer (get-buffer-create " w3-quote-whitespace")) | 237 (set-buffer (get-buffer-create " w3-quote-whitespace")) |
260 (erase-buffer) | 238 (erase-buffer) |