diff options
| author | Nicholas Drozd | 2019-02-16 16:37:52 -0600 |
|---|---|---|
| committer | Eli Zaretskii | 2019-02-22 09:52:57 +0200 |
| commit | 8282c34f0f2f4ad2c4956fc595518da64a7bef1f (patch) | |
| tree | 2432ac4729cb9cbec105e6c41345f3e41b763b6f /lisp | |
| parent | 3432f5545c1a0c8149d489d1df8cf1d037dae2df (diff) | |
| download | emacs-8282c34f0f2f4ad2c4956fc595518da64a7bef1f.tar.gz emacs-8282c34f0f2f4ad2c4956fc595518da64a7bef1f.zip | |
Handle HTML 'ol' start attribute in shr.el
* lisp/net/shr.el (shr-tag-ol): Don't automatically assume
1-indexing for all ordered lists, use <ol> if given.
* etc/NEWS: Announce change in shr behavior.
* test/data/shr/ol.html:
* test/data/shr/ol.txt: New test data files.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/shr.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 94d68faf2a8..2f628e1caa2 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -1755,7 +1755,14 @@ The preference is a float determined from `shr-prefer-media-type'." | |||
| 1755 | 1755 | ||
| 1756 | (defun shr-tag-ol (dom) | 1756 | (defun shr-tag-ol (dom) |
| 1757 | (shr-ensure-paragraph) | 1757 | (shr-ensure-paragraph) |
| 1758 | (let ((shr-list-mode 1)) | 1758 | (let* ((attrs (dom-attributes dom)) |
| 1759 | (start-attr (alist-get 'start attrs)) | ||
| 1760 | ;; Start at 1 if there is no start attribute | ||
| 1761 | ;; or if start can't be parsed as an integer. | ||
| 1762 | (start-index (condition-case _ | ||
| 1763 | (cl-parse-integer start-attr) | ||
| 1764 | (t 1))) | ||
| 1765 | (shr-list-mode start-index)) | ||
| 1759 | (shr-generic dom)) | 1766 | (shr-generic dom)) |
| 1760 | (shr-ensure-paragraph)) | 1767 | (shr-ensure-paragraph)) |
| 1761 | 1768 | ||