summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-12-15 16:18:31 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-12-15 16:18:31 +0100
commitd55f0632b5c05ad0521e380d2ef89c631af74d84 (patch)
treee5fe78d56546bdd13bc46e9d98f5edbab0d29602
parent4e02e48fa3ca7a9ec365516ee511bfdad0c0190d (diff)
parentf1b9339aa5f10f8367469cabba59251bd01bdf28 (diff)
downloadorg-mode-d55f0632b5c05ad0521e380d2ef89c631af74d84.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-element.el38
-rw-r--r--lisp/ox-org.el5
2 files changed, 29 insertions, 14 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 13d7fc6..089ecfb 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -240,19 +240,6 @@ application to open them.")
By default, all keywords setting attributes (i.e. \"ATTR_LATEX\")
are affiliated keywords and need not to be in this list.")
-(defconst org-element--affiliated-re
- (format "[ \t]*#\\+%s:"
- ;; Regular affiliated keywords.
- (format "\\(%s\\|ATTR_[-_A-Za-z0-9]+\\)\\(?:\\[\\(.*\\)\\]\\)?"
- (regexp-opt org-element-affiliated-keywords)))
- "Regexp matching any affiliated keyword.
-
-Keyword name is put in match group 1. Moreover, if keyword
-belongs to `org-element-dual-keywords', put the dual value in
-match group 2.
-
-Don't modify it, set `org-element-affiliated-keywords' instead.")
-
(defconst org-element-keyword-translation-alist
'(("DATA" . "NAME") ("LABEL" . "NAME") ("RESNAME" . "NAME")
("SOURCE" . "NAME") ("SRCNAME" . "NAME") ("TBLNAME" . "NAME")
@@ -299,6 +286,31 @@ This list is checked after translations have been applied. See
Any keyword in this list will have its value parsed and stored as
a secondary string.")
+(defconst org-element--affiliated-re
+ (format "[ \t]*#\\+\\(?:%s\\):\\(?: \\|$\\)"
+ (concat
+ ;; Dual affiliated keywords.
+ (format "\\(?1:%s\\)\\(?:\\[\\(.*\\)\\]\\)?"
+ (regexp-opt org-element-dual-keywords))
+ "\\|"
+ ;; Regular affiliated keywords.
+ (format "\\(?1:%s\\)"
+ (regexp-opt
+ (org-remove-if
+ #'(lambda (keyword)
+ (member keyword org-element-dual-keywords))
+ org-element-affiliated-keywords)))
+ "\\|"
+ ;; Export attributes.
+ "\\(?1:ATTR_[-_A-Za-z0-9]+\\)"))
+ "Regexp matching any affiliated keyword.
+
+Keyword name is put in match group 1. Moreover, if keyword
+belongs to `org-element-dual-keywords', put the dual value in
+match group 2.
+
+Don't modify it, set `org-element-affiliated-keywords' instead.")
+
(defconst org-element-object-restrictions
(let* ((standard-set
(remq 'plain-link (remq 'table-cell org-element-all-successors)))
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index ed0dc0e..686a4da 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -115,7 +115,10 @@ 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 t))
+ (let ((case-fold-search t))
+ (replace-regexp-in-string
+ "^[ \t]*#\\+ATTR_[-_A-Za-z0-9]+:\\(?: .*\\)?\n" ""
+ (org-export-expand blob contents t))))
(defun org-org-headline (headline contents info)
"Transcode HEADLINE element back into Org syntax.