From fddee022b75cb44f8804c4af011b6def9144c5f1 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 3 Aug 2014 22:30:11 +0200 Subject: [PATCH] ox-texinfo: Fix error with wide @direntry * lisp/ox-texinfo.el (org-texinfo-template): Properly pad @direntry description. --- lisp/ox-texinfo.el | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index a961d7acd..739f9f02f 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -695,12 +695,6 @@ holding export options." (copying (org-element-map (plist-get info :parse-tree) 'headline (lambda (hl) (and (org-element-property :COPYING hl) hl)) info t)) - (dircat (plist-get info :texinfo-dircat)) - (dirtitle (plist-get info :texinfo-dirtitle)) - (dirdesc (plist-get info :texinfo-dirdesc)) - ;; Spacing to align description (column 32 - 3 for `* ' and - ;; `.' in text. - (dirspacing (- 29 (length dirtitle))) (menu (org-texinfo-make-menu info 'main)) (detail-menu (org-texinfo-make-menu info 'detailed))) (concat @@ -749,18 +743,26 @@ holding export options." (org-export-data (nth 2 copying) info) "@end copying\n" "\n\n" - - ;; Info directory information - ;; Only supply if both title and category are provided - (if (and dircat dirtitle) + ;; Info directory information. Only supply if both title and + ;; category are provided. + (let ((dircat (plist-get info :texinfo-dircat)) + ;; Make sure title ends with a full stop. + (dirtitle + (let ((title (plist-get info :texinfo-dirtitle))) + (and title + (string-match "^\\(?:\\* \\)?\\(.*?\\)\\(\\.\\)?$" title) + (format "* %s." (match-string 1 title)))))) + (when (and dircat dirtitle) (concat "@dircategory " dircat "\n" "@direntry\n" - "* " dirtitle "." - (make-string dirspacing ?\s) - dirdesc "\n" - "@end direntry\n")) - "\n\n" - + (let ((dirdesc + (let ((desc (plist-get info :texinfo-dirdesc))) + (cond ((not desc) nil) + ((org-string-match-p "\\.$" desc) desc) + (t (concat desc ".")))))) + (if dirdesc (format "%-23s %s" dirtitle dirdesc) dirtitle)) + "\n" + "@end direntry\n\n"))) ;; Title "@titlepage\n" "@title " title "\n\n" -- 2.11.4.GIT