Ver Fonte

lint: Fix false positive with inline footnote definitions

* lisp/org-lint.el (org-lint-invalid-macro-argument-and-template):
Take into consideration inline definitions.
* testing/lisp/test-org-lint.el (test-org-lint/undefined-footnote-reference):
Add test.

Reported-by: Timothy <tecosaur@gmail.com>
Nicolas Goaziou há 3 anos atrás
pai
commit
17e4fe9093
2 ficheiros alterados com 9 adições e 2 exclusões
  1. 6 2
      lisp/org-lint.el
  2. 3 0
      testing/lisp/test-org-lint.el

+ 6 - 2
lisp/org-lint.el

@@ -784,8 +784,12 @@ Use \"export %s\" instead"
     reports))
 
 (defun org-lint-undefined-footnote-reference (ast)
-  (let ((definitions (org-element-map ast 'footnote-definition
-		       (lambda (f) (org-element-property :label f)))))
+  (let ((definitions
+          (org-element-map ast '(footnote-definition footnote-reference)
+	    (lambda (f)
+              (and (or (eq 'footnote-definition (org-element-type f))
+                       (eq 'inline (org-element-property :type f)))
+                   (org-element-property :label f))))))
     (org-element-map ast 'footnote-reference
       (lambda (f)
 	(let ((label (org-element-property :label f)))

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

@@ -358,6 +358,9 @@ This is not a node property
   (should-not
    (org-test-with-temp-text "Text[fn:1:inline reference]"
      (org-lint '(undefined-footnote-reference))))
+  (should-not
+   (org-test-with-temp-text "Text[fn:1:inline reference] [fn:1]"
+     (org-lint '(undefined-footnote-reference))))
   (should-not
    (org-test-with-temp-text "Text[fn::anonymous reference]"
      (org-lint '(undefined-footnote-reference)))))