diff options
authorJonathan Leech-Pepin <>2012-11-21 16:15:33 (GMT)
committer Jonathan Leech-Pepin <>2012-11-21 16:15:33 (GMT)
commitd939c4fb755afcc4ef3a50784d108917e2d906ae (patch)
parent6d01be052d9ec01164b9dd70e0b21d5da5a41c5f (diff)
* contrib/lisp/org-e-texinfo.el: Added support for optional menu titles, also do not create menu entries for non-exporting headlines
(org-e-texinfo--generate-menu-items): Use optional title in menu if present. (org-e-texinfo-headline): Use optional title in node entry if present. (org-e-texinfo--generate-menu-list): Omit headlines with :noexport: tag when generating menu entries.
1 files changed, 34 insertions, 8 deletions
diff --git a/contrib/lisp/org-e-texinfo.el b/contrib/lisp/org-e-texinfo.el
index d083862..8a050ee 100644
--- a/contrib/lisp/org-e-texinfo.el
+++ b/contrib/lisp/org-e-texinfo.el
@@ -36,6 +36,9 @@
+;; It introduces 1 new headline property keywords:
+;; "TEXINFO_MENU_TITLE" for optional menu titles.
;; To include inline code snippets (for example for generating @kbd{}
;; and @key{} commands), the following export-snippet keys are
;; accepted:
@@ -127,7 +130,8 @@
(:subauthor "SUBAUTHOR" nil nil newline)
(:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t)
(:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t)
- (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t)))
+ (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t)
+ (:texinfo-menu-title "TEXINFO_MENU_TITLE" nil nil newline)))
@@ -541,13 +545,18 @@ of the tree for further formatting.
TREE is the parse-tree containing the headlines. LEVEL is the
headline level to generate a list of. INFO is a plist holding
contextual information."
- (let (seq)
+ (let (seq
+ (noexport (string= "noexport"
+ (and (plist-get info :with-tags)
+ (org-export-get-tags tree info)))))
tree 'headline
(lambda (head)
(when (org-element-property :level head)
(if (and (eq level (org-element-property :level head))
- ;; Do not take note of footnotes or copying headlines
+ ;; Do not take note of footnotes or copying
+ ;; headlines. Also ignore :noexport: headlines
+ (not noexport)
(not (org-element-property :copying head))
(not (org-element-property :footnote-section-p head)))
(push head seq))))
@@ -565,13 +574,21 @@ Returns a list containing the following information from each
headline: length, title, description. This is used to format the
menu using `org-e-texinfo--format-menu'."
(loop for headline in items collect
- (let* ((title (org-e-texinfo--sanitize-menu
+ (let* ((menu-title (org-e-texinfo--sanitize-menu
+ (org-export-data
+ (org-element-property :texinfo-menu-title headline)
+ info)))
+ (title (org-e-texinfo--sanitize-menu
(org-element-property :title headline) info)))
(descr (org-export-data
- (org-element-property :description headline) info))
- (len (length title))
- (output (list len title descr)))
+ (org-element-property :description headline)
+ info))
+ (menu-entry (if (string= "" menu-title) title menu-title))
+ (len (length menu-entry))
+ (output (list len menu-entry descr)))
+ (message "%S" menu-title)
+ ;; (message "%s" headline)
(defun org-e-texinfo--menu-headlines (headline info)
@@ -892,13 +909,22 @@ holding contextual information."
(class-sectionning (assoc class org-e-texinfo-classes))
;; Find the index type, if any
(index (org-element-property :index headline))
+ ;; Retrieve custom menu title (if any)
+ (menu-title (org-e-texinfo--sanitize-menu
+ (org-export-data
+ (org-element-property :texinfo-menu-title headline)
+ info)))
;; Retrieve headline text
(text (org-e-texinfo--sanitize-headline
(org-element-property :title headline) info))
;; Create node info, to insert it before section formatting.
+ ;; Use custom menu title if present
(node (format "@node %s\n"
- (replace-regexp-in-string "%" "%%" text))))
+ (replace-regexp-in-string "%" "%%"
+ (if (not (string= "" menu-title))
+ menu-title
+ text)))))
;; Menus must be generated with first child, otherwise they
;; will not nest properly
(menu (let* ((first (org-export-first-sibling-p headline info))