diff options
| -rw-r--r-- | lisp/net/eww.el | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 29b4b876465..033529d0616 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -407,13 +407,15 @@ Currently this means either text/html or application/xhtml+xml." | |||
| 407 | (inhibit-modification-hooks t) | 407 | (inhibit-modification-hooks t) |
| 408 | (shr-target-id (url-target (url-generic-parse-url url))) | 408 | (shr-target-id (url-target (url-generic-parse-url url))) |
| 409 | (shr-external-rendering-functions | 409 | (shr-external-rendering-functions |
| 410 | '((title . eww-tag-title) | 410 | (append |
| 411 | (form . eww-tag-form) | 411 | '((title . eww-tag-title) |
| 412 | (input . eww-tag-input) | 412 | (form . eww-tag-form) |
| 413 | (textarea . eww-tag-textarea) | 413 | (input . eww-tag-input) |
| 414 | (select . eww-tag-select) | 414 | (textarea . eww-tag-textarea) |
| 415 | (link . eww-tag-link) | 415 | (select . eww-tag-select) |
| 416 | (a . eww-tag-a)))) | 416 | (link . eww-tag-link) |
| 417 | (meta . eww-tag-meta) | ||
| 418 | (a . eww-tag-a))))) | ||
| 417 | (erase-buffer) | 419 | (erase-buffer) |
| 418 | (shr-insert-document document) | 420 | (shr-insert-document document) |
| 419 | (cond | 421 | (cond |
| @@ -458,6 +460,27 @@ Currently this means either text/html or application/xhtml+xml." | |||
| 458 | where | 460 | where |
| 459 | (plist-put eww-data (cdr where) href)))) | 461 | (plist-put eww-data (cdr where) href)))) |
| 460 | 462 | ||
| 463 | (defvar eww-redirect-level 1) | ||
| 464 | |||
| 465 | (defun eww-tag-meta (dom) | ||
| 466 | (when (and (cl-equalp (dom-attr dom 'http-equiv) "refresh") | ||
| 467 | (< eww-redirect-level 5)) | ||
| 468 | (when-let (refresh (dom-attr dom 'content)) | ||
| 469 | (when (or (string-match "^\\([0-9]+\\) *;.*url=\"\\([^\"]+\\)\"" refresh) | ||
| 470 | (string-match "^\\([0-9]+\\) *;.*url=\\([^ ]+\\)" refresh)) | ||
| 471 | (let ((timeout (match-string 1 refresh)) | ||
| 472 | (url (match-string 2 refresh)) | ||
| 473 | (eww-redirect-level (1+ eww-redirect-level))) | ||
| 474 | (if (equal timeout "0") | ||
| 475 | (eww (shr-expand-url url)) | ||
| 476 | (eww-tag-a | ||
| 477 | (dom-node 'a `((href . ,(shr-expand-url url))) | ||
| 478 | (format "Auto refresh in %s second%s disabled" | ||
| 479 | timeout | ||
| 480 | (if (equal timeout "1") | ||
| 481 | "" | ||
| 482 | "s")))))))))) | ||
| 483 | |||
| 461 | (defun eww-tag-link (dom) | 484 | (defun eww-tag-link (dom) |
| 462 | (eww-handle-link dom) | 485 | (eww-handle-link dom) |
| 463 | (shr-generic dom)) | 486 | (shr-generic dom)) |