summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-11-15 17:43:08 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-11-15 17:43:08 +0100
commit64ac3bb5b39f5028ac89bda5c8ab1c344a1fee71 (patch)
treeb9b7a44994247f8b59a31f807f9d508c08c8fdf2
parent8ff3673dfc9b00b63971457a21ffd681041a325d (diff)
downloadorg-mode-64ac3bb5b39f5028ac89bda5c8ab1c344a1fee71.tar.gz
ox-ascii: Lighten numbering in table of contents
* lisp/ox-ascii.el (org-ascii--build-title): Use only last number in headline numbering when building table of contents.
-rw-r--r--lisp/ox-ascii.el15
1 files changed, 7 insertions, 8 deletions
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index e83eb19..61c231b 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -632,7 +632,7 @@ Return value is a symbol among `left', `center', `right' and
(or justification 'left)))
(defun org-ascii--build-title
- (element info text-width &optional underline notags toc)
+ (element info text-width &optional underline notags toc)
"Format ELEMENT title and return it.
ELEMENT is either an `headline' or `inlinetask' element. INFO is
@@ -651,13 +651,12 @@ possible. It doesn't apply to `inlinetask' elements."
(let* ((headlinep (eq (org-element-type element) 'headline))
(numbers
;; Numbering is specific to headlines.
- (and headlinep (org-export-numbered-headline-p element info)
- ;; All tests passed: build numbering string.
- (concat
- (mapconcat
- 'number-to-string
- (org-export-get-headline-number element info) ".")
- " ")))
+ (and headlinep
+ (org-export-numbered-headline-p element info)
+ (let ((numbering (org-export-get-headline-number element info)))
+ (if toc (format "%d. " (org-last numbering))
+ (concat (mapconcat #'number-to-string numbering ".")
+ " ")))))
(text
(org-trim
(org-export-data