ox: Remove `org-export-ignore-element'
* lisp/ox.el (org-export-ignore-element): Remove function. (org-export-collect-tree-properties): Do not assume users can modify :ignore-list export property. * testing/lisp/test-ox.el (test-org-export/user-ignore-list): Remove test. :ignore-property is an implementation detail, which should not be exposed to users. Also, it is easier to simply remove the element to ignore from the parse tree with `org-element-extract-element'.
This commit is contained in:
parent
2ca9222252
commit
6b450ce81c
19
lisp/ox.el
19
lisp/ox.el
|
@ -1672,13 +1672,11 @@ Return updated plist."
|
|||
;; Install the parse tree in the communication channel.
|
||||
(setq info (plist-put info :parse-tree data))
|
||||
;; Get the list of elements and objects to ignore, and put it into
|
||||
;; `:ignore-list'. Do not overwrite any user ignore that might have
|
||||
;; been done during parse tree filtering.
|
||||
;; `:ignore-list'.
|
||||
(setq info
|
||||
(plist-put info
|
||||
:ignore-list
|
||||
(append (org-export--populate-ignore-list data info)
|
||||
(plist-get info :ignore-list))))
|
||||
(org-export--populate-ignore-list data info)))
|
||||
;; Compute `:headline-offset' in order to be able to use
|
||||
;; `org-export-get-relative-level'.
|
||||
(setq info
|
||||
|
@ -1934,12 +1932,6 @@ a tree with a select tag."
|
|||
;; `org-export-data' or even use a temporary back-end by using
|
||||
;; `org-export-data-with-backend'.
|
||||
;;
|
||||
;; Internally, three functions handle the filtering of objects and
|
||||
;; elements during the export. In particular,
|
||||
;; `org-export-ignore-element' marks an element or object so future
|
||||
;; parse tree traversals skip it and `org-export-expand' transforms
|
||||
;; the others back into their original shape.
|
||||
;;
|
||||
;; `org-export-transcoder' is an accessor returning appropriate
|
||||
;; translator function for a given element or object.
|
||||
|
||||
|
@ -2164,13 +2156,6 @@ keywords before output."
|
|||
(funcall (intern (format "org-element-%s-interpreter" type))
|
||||
blob contents))))
|
||||
|
||||
(defun org-export-ignore-element (element info)
|
||||
"Add ELEMENT to `:ignore-list' in INFO.
|
||||
|
||||
Any element in `:ignore-list' will be skipped when using
|
||||
`org-element-map'. INFO is modified by side effects."
|
||||
(plist-put info :ignore-list (cons element (plist-get info :ignore-list))))
|
||||
|
||||
|
||||
|
||||
;;; The Filter System
|
||||
|
|
|
@ -1078,34 +1078,6 @@ Footnotes[fn:2], foot[fn:test], digit only[3], and [fn:inline:anonymous footnote
|
|||
(let ((output (org-export-as (org-test-default-backend))))
|
||||
(substring output (string-match ".*\n\\'" output)))))))
|
||||
|
||||
(ert-deftest test-org-export/user-ignore-list ()
|
||||
"Test if `:ignore-list' accepts user input."
|
||||
(let ((backend (org-test-default-backend)))
|
||||
(setf (org-export-backend-transcoders backend)
|
||||
(cons '(template . (lambda (body i)
|
||||
(format "BEGIN\n%sEND" body)))
|
||||
(org-export-backend-transcoders backend)))
|
||||
(org-test-with-temp-text "Text"
|
||||
(should (equal (org-export-as backend nil nil 'body-only)
|
||||
"Text\n"))
|
||||
(should (equal (org-export-as backend) "BEGIN\nText\nEND"))))
|
||||
(should
|
||||
(equal
|
||||
"* Head1\n"
|
||||
(let ((org-export-filter-parse-tree-functions
|
||||
'((lambda (data backend info)
|
||||
;; Ignore headlines with the word "note" in their title.
|
||||
(org-element-map data 'headline
|
||||
(lambda (headline)
|
||||
(when (string-match "\\<note\\>"
|
||||
(org-element-property :raw-value
|
||||
headline))
|
||||
(org-export-ignore-element headline info)))
|
||||
info)
|
||||
data))))
|
||||
(org-test-with-temp-text "* Head1\n* Head2 (note)\n"
|
||||
(org-export-as (org-test-default-backend)))))))
|
||||
|
||||
(ert-deftest test-org-export/before-processing-hook ()
|
||||
"Test `org-export-before-processing-hook'."
|
||||
(should
|
||||
|
|
Loading…
Reference in New Issue