ox-texinfo: Support lettered lists

* lisp/ox-texinfo.el (org-texinfo-plain-list): Add :enum attribute.
* doc/org-manual.org (Plain lists in Texinfo export): Document :enum
  attribute.
This commit is contained in:
Nicolas Goaziou 2019-03-13 15:33:21 +01:00
parent 9313f5c9eb
commit 67de9a6865
3 changed files with 34 additions and 12 deletions

View File

@ -14773,21 +14773,22 @@ This paragraph is preceded by...
#+cindex: @samp{ATTR_TEXINFO}, keyword
#+cindex: two-column tables, in Texinfo export
#+cindex: table types, in Texinfo export
#+cindex: table-type, Texinfo attribute
The Texinfo export back-end by default converts description lists in
the Org file using the default command =@table=, which results in
a table with two columns. To change this behavior, specify
=:table-type= with =ftable= or =vtable= attributes. For more
information, see [[info:texinfo::Two-column Tables]].
a table with two columns. To change this behavior, set =:table-type=
attribute to either =ftable= or =vtable= value. For more information,
see [[info:texinfo::Two-column Tables]].
#+vindex: org-texinfo-table-default-markup
#+cindex: indic, Texinfo attribute
The Texinfo export back-end by default also applies a text highlight
based on the defaults stored in ~org-texinfo-table-default-markup~.
To override the default highlight command, specify another one with
the =:indic= attribute.
#+cindex: multiple items in Texinfo lists
#+cindex: sep, Texinfo attribute
Org syntax is limited to one entry per list item. Nevertheless, the
Texinfo export back-end can split that entry according to any text
provided through the =:sep= attribute. Each part then becomes a new
@ -14811,6 +14812,20 @@ This is the common text for variables foo and bar.
@end table
#+end_example
#+cindex: lettered lists, in Texinfo export
#+cindex: enum, Texinfo attribute
Ordered lists are numbered when exported to Texinfo format. Such
numbering obeys any counter (see [[*Plain Lists]]) in the first item of
the list. The =:enum= attribute also let you start the list at
a specific number, or switch to a lettered list, as illustrated here
#+begin_example
#+ATTR_TEXINFO: :enum A
1. Alpha
2. Bravo
3. Charlie
#+end_example
*** Tables in Texinfo export
:PROPERTIES:
:DESCRIPTION: Table attributes.

View File

@ -83,6 +83,11 @@ since now it's implicitly always true.
This aligns Beamer notes with slide overlays.
*** Add support for lettered lists in Texinfo
Using =:enum A= or =:enum a= Texinfo attribute switches an otherwise
numbered list to a lettered list.
*** Add a dispatcher command to insert dynamic blocks
You can add dynamic block into ~org-dynamic-block-alist~ with function

View File

@ -1253,12 +1253,14 @@ 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))))
(enum
(cond ((not (eq type 'ordered)) nil)
((plist-member attr :enum) (plist-get attr :enum))
(t
;; 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")
@ -1266,7 +1268,7 @@ contextual information."
(t "table"))))
(format "@%s\n%s@end %s"
(cond ((eq type 'descriptive) (concat list-type " " indic))
(initial-counter (format "%s %d" list-type initial-counter))
(enum (format "%s %s" list-type enum))
(t list-type))
contents
list-type)))