* 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.
If set, shr will not render tags with attribute 'aria-hidden="true"'.
This attribute is meant to tell screen readers to ignore a tag.
+*** 'shr-tag-ol' now respects the ordered list 'start' attribute.
+
** Htmlfontify
*** The functions 'hfy-color', 'hfy-color-vals' and
(defun shr-tag-ol (dom)
(shr-ensure-paragraph)
- (let ((shr-list-mode 1))
+ (let* ((attrs (dom-attributes dom))
+ (start-attr (alist-get 'start attrs))
+ ;; Start at 1 if there is no start attribute
+ ;; or if start can't be parsed as an integer.
+ (start-index (condition-case _
+ (cl-parse-integer start-attr)
+ (t 1)))
+ (shr-list-mode start-index))
(shr-generic dom))
(shr-ensure-paragraph))
--- /dev/null
+<ol>
+ <li>one</li>
+ <li>two</li>
+ <li>three</li>
+</ol>
+
+<ol start="10">
+ <li>ten</li>
+ <li>eleven</li>
+ <li>twelve</li>
+</ol>
+
+<ol start="0">
+ <li>zero</li>
+ <li>one</li>
+ <li>two</li>
+</ol>
+
+<ol start="-5">
+ <li>minus five</li>
+ <li>minus four</li>
+ <li>minus three</li>
+</ol>
+
+<ol start="notanumber">
+ <li>one</li>
+ <li>two</li>
+ <li>three</li>
+</ol>
--- /dev/null
+1 one
+2 two
+3 three
+
+10 ten
+11 eleven
+12 twelve
+
+0 zero
+1 one
+2 two
+
+-5 minus five
+-4 minus four
+-3 minus three
+
+1 one
+2 two
+3 three