浏览代码

org-element: Headlines properties from property drawer are upcased

* lisp/org-element.el (org-element-headline-parser,
  org-element-inlinetask-parser): Upcase properties.  This is done to
  avoid confusion between properties from parser (e.g. `:end') and
  properties from the property drawer (e.g. :END:).

In particular, it means that :CUSTOM_ID: property is accessed through:

  (org-element-property :CUSTOM_ID headline)
Nicolas Goaziou 12 年之前
父节点
当前提交
ae5932282d
共有 1 个文件被更改,包括 8 次插入10 次删除
  1. 8 10
      lisp/org-element.el

+ 8 - 10
lisp/org-element.el

@@ -763,17 +763,16 @@ Assume point is at beginning of the headline."
 	   (archivedp (member org-archive-tag tags))
 	   (footnote-section-p (and org-footnote-section
 				    (string= org-footnote-section raw-value)))
-	   ;; Normalize property names: ":SOME_PROP:" becomes
-	   ;; ":some-prop".
+	   ;; Upcase property names.  It avoids confusion between
+	   ;; properties obtained through property drawer and default
+	   ;; properties from the parser (e.g. `:end' and :END:)
 	   (standard-props
 	    (let (plist)
 	      (mapc
 	       (lambda (p)
 		 (setq plist
 		       (plist-put plist
-				  (intern (concat ":"
-						  (replace-regexp-in-string
-						   "_" "-" (downcase (car p)))))
+				  (intern (concat ":" (upcase (car p))))
 				  (cdr p))))
 	       (org-entry-properties nil 'standard))
 	      plist))
@@ -930,17 +929,16 @@ Assume point is at beginning of the inline task."
 	   (tags (let ((raw-tags (nth 5 components)))
 		   (and raw-tags (org-split-string raw-tags ":"))))
 	   (raw-value (or (nth 4 components) ""))
-	   ;; Normalize property names: ":SOME_PROP:" becomes
-	   ;; ":some-prop".
+	   ;; Upcase property names.  It avoids confusion between
+	   ;; properties obtained through property drawer and default
+	   ;; properties from the parser (e.g. `:end' and :END:)
 	   (standard-props
 	    (let (plist)
 	      (mapc
 	       (lambda (p)
 		 (setq plist
 		       (plist-put plist
-				  (intern (concat ":"
-						  (replace-regexp-in-string
-						   "_" "-" (downcase (car p)))))
+				  (intern (concat ":" (upcase (car p))))
 				  (cdr p))))
 	       (org-entry-properties nil 'standard))
 	      plist))