summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2019-03-13 15:33:21 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2019-03-13 15:38:43 +0100
commit67de9a6865e9cbe084655252e503b79a070dfe53 (patch)
tree21ed756c05f20e3a4682b3c92c9d3c6e3422a942
parent9313f5c9eb21b045962e58f5a8f6fc102cc907b3 (diff)
downloadorg-mode-67de9a6865e9cbe084655252e503b79a070dfe53.tar.gz
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.
-rw-r--r--doc/org-manual.org25
-rw-r--r--etc/ORG-NEWS5
-rw-r--r--lisp/ox-texinfo.el16
3 files changed, 34 insertions, 12 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 9a22ffa..5d08c43 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -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.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 102f52b..039ad4c 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -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
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 4f37a2a..5e74632 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -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)))