Browse Source

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.
Nicolas Goaziou 8 years ago
parent
commit
753b90e321
3 changed files with 5 additions and 22 deletions
  1. 4 6
      lisp/org-element.el
  2. 1 13
      testing/lisp/test-org-element.el
  3. 0 3
      testing/lisp/test-org-lint.el

+ 4 - 6
lisp/org-element.el

@@ -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)

+ 1 - 13
testing/lisp/test-org-element.el

@@ -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

+ 0 - 3
testing/lisp/test-org-lint.el

@@ -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 ()