ox-texinfo: Add missing support for item counters

* lisp/ox-texinfo.el (org-texinfo-plain-list): Support counter in the
  first item of the list.

Mid-list counters are not supported, per Texinfo limitation.
This commit is contained in:
Nicolas Goaziou 2019-03-13 12:15:33 +01:00
parent cd13b0241d
commit 48cafd3d3f
1 changed files with 9 additions and 1 deletions

View File

@ -1253,13 +1253,21 @@ contextual information."
(if (string-prefix-p "@" i) i (concat "@" i))))
(table-type (plist-get attr :table-type))
(type (org-element-property :type plain-list))
(initial-counter
(and (eq type 'ordered)
;; Texinfo only supports initial counters, i.e., it
;; cannot change the numbering mid-list.
(let ((first-item (car (org-element-contents plain-list))))
(org-element-property :counter first-item))))
(list-type (cond
((eq type 'ordered) "enumerate")
((eq type 'unordered) "itemize")
((member table-type '("ftable" "vtable")) table-type)
(t "table"))))
(format "@%s\n%s@end %s"
(if (eq type 'descriptive) (concat list-type " " indic) list-type)
(cond ((eq type 'descriptive) (concat list-type " " indic))
(initial-counter (format "%s %d" list-type initial-counter))
(t list-type))
contents
list-type)))