From eba04bfb3c9c498c6ff25a26f29f0fca4080bb62 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 26 Apr 2013 15:47:34 +0200 Subject: [PATCH] ox-org: Preserve affiliated keywords * lisp/ox.el (org-export-expand): Optionally add affiliated keywords to results. * lisp/ox-org.el (org-org-identity): Use new argument for `org-export-expand'. --- lisp/ox-org.el | 2 +- lisp/ox.el | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/ox-org.el b/lisp/ox-org.el index f55b5dc67..753931713 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -119,7 +119,7 @@ setting of `org-html-htmlize-output-type' is 'css." (defun org-org-identity (blob contents info) "Transcode BLOB element or object back into Org syntax. CONTENTS is its contents, as a string or nil. INFO is ignored." - (org-export-expand blob contents)) + (org-export-expand blob contents t)) (defun org-org-headline (headline contents info) "Transcode HEADLINE element back into Org syntax. diff --git a/lisp/ox.el b/lisp/ox.el index c3dc942b6..88b4122d1 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -2246,13 +2246,19 @@ according to export options INFO, stored as a plist." (table (plist-get info :with-tables)) (otherwise t))) -(defun org-export-expand (blob contents) +(defun org-export-expand (blob contents &optional with-affiliated) "Expand a parsed element or object to its original state. + BLOB is either an element or an object. CONTENTS is its -contents, as a string or nil." - (funcall - (intern (format "org-element-%s-interpreter" (org-element-type blob))) - blob contents)) +contents, as a string or nil. + +When optional argument WITH-AFFILIATED is non-nil, add affiliated +keywords before output." + (let ((type (org-element-type blob))) + (concat (and with-affiliated (memq type org-element-all-elements) + (org-element--interpret-affiliated-keywords blob)) + (funcall (intern (format "org-element-%s-interpreter" type)) + blob contents)))) (defun org-export-ignore-element (element info) "Add ELEMENT to `:ignore-list' in INFO.