summaryrefslogtreecommitdiff
path: root/lisp/ox-org.el
diff options
context:
space:
mode:
authorS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:35 +0200
committerS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:35 +0200
commit361fd4da7cfa870165cb1ec175cdbea55ca40e7e (patch)
treea36bfd91d9e14c354b6eaebb20f5d5d64ec438db /lisp/ox-org.el
parent77ddd382df838e38504b822e729250b2a6dd9b63 (diff)
Imported Upstream version 8.2.7a
Diffstat (limited to 'lisp/ox-org.el')
-rw-r--r--lisp/ox-org.el50
1 files changed, 39 insertions, 11 deletions
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index 3b2e55e..195b9d7 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -65,7 +65,7 @@ setting of `org-html-htmlize-output-type' is 'css."
(entity . org-org-identity)
(example-block . org-org-identity)
(fixed-width . org-org-identity)
- (footnote-definition . org-org-identity)
+ (footnote-definition . ignore)
(footnote-reference . org-org-identity)
(headline . org-org-headline)
(horizontal-rule . org-org-identity)
@@ -87,7 +87,7 @@ setting of `org-html-htmlize-output-type' is 'css."
(quote-block . org-org-identity)
(quote-section . org-org-identity)
(radio-target . org-org-identity)
- (section . org-org-identity)
+ (section . org-org-section)
(special-block . org-org-identity)
(src-block . org-org-identity)
(statistics-cookie . org-org-identity)
@@ -122,15 +122,16 @@ CONTENTS is its contents, as a string or nil. INFO is ignored."
(defun org-org-headline (headline contents info)
"Transcode HEADLINE element back into Org syntax.
CONTENTS is its contents, as a string or nil. INFO is ignored."
- (unless (plist-get info :with-todo-keywords)
- (org-element-put-property headline :todo-keyword nil))
- (unless (plist-get info :with-tags)
- (org-element-put-property headline :tags nil))
- (unless (plist-get info :with-priority)
- (org-element-put-property headline :priority nil))
- (org-element-put-property headline :level
- (org-export-get-relative-level headline info))
- (org-element-headline-interpreter headline contents))
+ (unless (org-element-property :footnote-section-p headline)
+ (unless (plist-get info :with-todo-keywords)
+ (org-element-put-property headline :todo-keyword nil))
+ (unless (plist-get info :with-tags)
+ (org-element-put-property headline :tags nil))
+ (unless (plist-get info :with-priority)
+ (org-element-put-property headline :priority nil))
+ (org-element-put-property headline :level
+ (org-export-get-relative-level headline info))
+ (org-element-headline-interpreter headline contents)))
(defun org-org-keyword (keyword contents info)
"Transcode KEYWORD element back into Org syntax.
@@ -144,6 +145,33 @@ keywords targeted at other export back-ends."
org-element-block-name-alist))
(org-element-keyword-interpreter keyword nil)))
+(defun org-org-section (section contents info)
+ "Transcode SECTION element back into Org syntax.
+CONTENTS is the contents of the section. INFO is a plist used as
+a communication channel."
+ (concat
+ (org-element-normalize-string contents)
+ ;; Insert footnote definitions appearing for the first time in this
+ ;; section. Indeed, some of them may not be available to narrowing
+ ;; so we make sure all of them are included in the result.
+ (let ((footnotes-alist
+ (org-element-map section 'footnote-reference
+ (lambda (fn)
+ (and (eq (org-element-property :type fn) 'standard)
+ (org-export-footnote-first-reference-p fn info)
+ (cons (org-element-property :label fn)
+ (org-export-get-footnote-definition fn info))))
+ info)))
+ (and footnotes-alist
+ (concat "\n"
+ (mapconcat
+ (lambda (d)
+ (org-element-normalize-string
+ (concat (format "[%s] "(car d))
+ (org-export-data (cdr d) info))))
+ footnotes-alist "\n"))))
+ (make-string (or (org-element-property :post-blank section) 0) ?\n)))
+
;;;###autoload
(defun org-org-export-as-org (&optional async subtreep visible-only ext-plist)
"Export current buffer to an Org buffer.