diff --git a/lisp/org-element.el b/lisp/org-element.el index 2e8289f12..fc2f5dd28 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -729,11 +729,12 @@ CONTENTS is the contents of the footnote-definition." "Parse a headline. Return a list whose CAR is `headline' and CDR is a plist -containing `:raw-value', `:title', `:begin', `:end', -`:pre-blank', `:hiddenp', `:contents-begin' and `:contents-end', -`:level', `:priority', `:tags', `:todo-keyword',`:todo-type', -`:scheduled', `:deadline', `:closed', `:quotedp', `:archivedp', -`:commentedp' and `:footnote-section-p' keywords. +containing `:raw-value', `:title', `:optional-title', `:begin', +`:end', `:pre-blank', `:hiddenp', `:contents-begin' and +`:contents-end', `:level', `:priority', `:tags', +`:todo-keyword',`:todo-type', `:scheduled', `:deadline', +`:closed', `:quotedp', `:archivedp', `:commentedp' and +`:footnote-section-p' keywords. The plist also contains any property set in the property drawer, with its name in upper cases and colons added at the @@ -847,6 +848,13 @@ Assume point is at beginning of the headline." :quotedp quotedp) time-props standard-props)))) + (let ((opt-title (org-element-property :OPTIONAL_TITLE headline))) + (when opt-title + (org-element-put-property + headline :optional-title + (if raw-secondary-p opt-title + (org-element-parse-secondary-string + opt-title (org-element-restriction 'headline) headline))))) (org-element-put-property headline :title (if raw-secondary-p raw-value diff --git a/lisp/ox.el b/lisp/ox.el index 341e2e2e0..6d80d8789 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3548,6 +3548,12 @@ fail, the fall-back value is \"???\"." (and file (file-name-sans-extension (file-name-nondirectory file)))) "???")) +(defun org-export-get-optional-title (headline info) + "Return optional title for HEADLINE, as a secondary string. +INFO is a plist used as a communication channel. If no such +title is defined, return nil." + (org-element-property :optional-title headline)) + (defun org-export-first-sibling-p (headline info) "Non-nil when HEADLINE is the first sibling in its sub-tree. INFO is a plist used as a communication channel."