1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-02-06 21:29:25 +00:00

org-element: Do not support nested links anymore

* lisp/org-element.el (org-element-object-restrictions):
(org-element--object-lex): Do not support nested links.

* testing/lisp/test-org-element.el (test-org-element/link-parser):
* testing/lisp/test-org-lint.el (test-org-lint/link-to-local-file):
  Remove tests.
This commit is contained in:
Nicolas Goaziou 2016-12-17 11:35:50 +01:00
parent 81f4e9f651
commit 753b90e321
3 changed files with 5 additions and 22 deletions

View File

@ -356,8 +356,8 @@ Don't modify it, set `org-element-affiliated-keywords' instead.")
;; a link description. Also ignore radio-targets and line
;; breaks.
(link bold code entity export-snippet inline-babel-call inline-src-block
italic latex-fragment macro simple-link statistics-cookie
strike-through subscript superscript underline verbatim)
italic latex-fragment macro statistics-cookie strike-through
subscript superscript underline verbatim)
(paragraph ,@standard-set)
;; Remove any variable object from radio target as it would
;; prevent it from being properly recognized.
@ -4430,8 +4430,7 @@ to an appropriate container (e.g., a paragraph)."
(org-element-target-parser)))
(or (and (memq 'timestamp restriction)
(org-element-timestamp-parser))
(and (or (memq 'link restriction)
(memq 'simple-link restriction))
(and (memq 'link restriction)
(org-element-link-parser)))))
(?\\
(if (eq (aref result 1) ?\\)
@ -4452,8 +4451,7 @@ to an appropriate container (e.g., a paragraph)."
(and (memq 'statistics-cookie restriction)
(org-element-statistics-cookie-parser)))))
;; This is probably a plain link.
(_ (and (or (memq 'link restriction)
(memq 'simple-link restriction))
(_ (and (memq 'link restriction)
(org-element-link-parser)))))))
(or (eobp) (forward-char))))
(cond (found)

View File

@ -1750,19 +1750,7 @@ e^{i\\pi}+1=0
(progn (org-mode-restart)
(org-element-map (org-element-parse-buffer) 'link
(lambda (link) (org-element-property :type link))
nil t nil t)))))
;; Plain links are allowed as description of regular links.
(should
(equal "file"
(org-test-with-temp-text "[[http://orgmode.org][file:unicorn.jpg]]"
(search-forward "file:")
(org-element-property :type (org-element-context)))))
;; So are angular links.
(should
(equal "file"
(org-test-with-temp-text "[[http://orgmode.org][<file:unicorn.jpg>]]"
(search-forward "file:")
(org-element-property :type (org-element-context))))))
nil t nil t))))))
;;;; Macro

View File

@ -225,9 +225,6 @@ This is not a node property
"Test `org-lint-link-to-local-file' checker."
(should
(org-test-with-temp-text "[[file:/Idonotexist.org]]"
(org-lint '(link-to-local-file))))
(should
(org-test-with-temp-text "[[http://orgmode.org][file:/Idonotexist.org]]"
(org-lint '(link-to-local-file)))))
(ert-deftest test-org-lint/non-existent-setupfile-parameter ()