org-element: Remove `org-element-document-properties'

* lisp/org-element.el (org-element-document-properties): Remove
  variable.
(org-element-context): Ignore ex-"document keywords".

* testing/lisp/test-org-element.el (test-org-element/context): Remove
  no longer applicable tests.

Parsed keywords are no longer hard-coded and can be set per export
back-end.

As a consequence, `org-element-context' no longer returns objects in
"TITLE", "DATE" or "AUTHOR" keywords.  This makes sense as these
objects would only make sense during export, and only if the chosen
back-end actually uses them.
This commit is contained in:
Nicolas Goaziou 2015-04-05 10:29:16 +02:00
parent fa64b59b05
commit fa70778a20
2 changed files with 0 additions and 28 deletions

View File

@ -319,11 +319,6 @@ associated to a hash value with the following:
This list is checked after translations have been applied. See
`org-element-keyword-translation-alist'.")
(defconst org-element-document-properties '("AUTHOR" "DATE" "TITLE")
"List of properties associated to the whole document.
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
@ -5722,16 +5717,6 @@ Providing it allows for quicker computation."
(or (< pos cend) (and (= pos cend) (eobp))))
(narrow-to-region cbeg cend)
(throw 'objects-forbidden element))))
;; At a parsed keyword, objects are located within value.
((eq type 'keyword)
(if (not (member (org-element-property :key element)
org-element-document-properties))
(throw 'objects-forbidden element)
(goto-char (org-element-property :begin element))
(search-forward ":")
(if (and (>= pos (point)) (< pos (line-end-position)))
(narrow-to-region (point) (line-end-position))
(throw 'objects-forbidden element))))
;; At a planning line, if point is at a timestamp, return it,
;; otherwise, return element.
((eq type 'planning)

View File

@ -3238,19 +3238,6 @@ Text
(org-test-with-temp-text "* H\n SCHEDULED: <2012-03-29 thu.>"
(search-forward "SCHEDULED")
(org-element-type (org-element-context)))))
;; Find objects in document keywords.
(should
(eq 'macro
(org-test-with-temp-text "#+DATE: <point>{{{macro}}}"
(org-element-type (org-element-context)))))
(should-not
(eq 'macro
(org-test-with-temp-text "#+DATE: {{{macro}}}\n<point>"
(org-element-type (org-element-context)))))
(should-not
(eq 'macro
(org-test-with-temp-text "#+RANDOM_KEYWORD: <point>{{{macro}}}"
(org-element-type (org-element-context)))))
;; Do not find objects in table rules.
(should
(eq 'table-row