Browse Source

ox: Resolve fuzzy links pointing to pseudo-elements

* lisp/ox.el (org-export-resolve-fuzzy-link): Look for name also in
  pseudo-elements.
Nicolas Goaziou 6 years ago
parent
commit
50986c4863
1 changed files with 6 additions and 2 deletions
  1. 6 2
      lisp/ox.el

+ 6 - 2
lisp/ox.el

@@ -4365,7 +4365,7 @@ as returned by `org-export-search-cells'."
   (let ((targets (org-export-search-cells datum)))
   (let ((targets (org-export-search-cells datum)))
     (and targets (cl-some (lambda (cell) (member cell targets)) cells))))
     (and targets (cl-some (lambda (cell) (member cell targets)) cells))))
 
 
-(defun org-export-resolve-fuzzy-link (link info)
+(defun org-export-resolve-fuzzy-link (link info &rest pseudo-types)
   "Return LINK destination.
   "Return LINK destination.
 
 
 INFO is a plist holding contextual information.
 INFO is a plist holding contextual information.
@@ -4382,6 +4382,10 @@ Return value can be an object or an element:
 
 
 - Otherwise, throw an error.
 - Otherwise, throw an error.
 
 
+PSEUDO-TYPES are pseudo-elements types, i.e., elements defined
+specifically in an export back-end, that could have a name
+affiliated keyword.
+
 Assume LINK type is \"fuzzy\".  White spaces are not
 Assume LINK type is \"fuzzy\".  White spaces are not
 significant."
 significant."
   (let* ((search-cells (org-export-string-to-search-cell
   (let* ((search-cells (org-export-string-to-search-cell
@@ -4394,7 +4398,7 @@ significant."
     (if (not (eq cached 'not-found)) cached
     (if (not (eq cached 'not-found)) cached
       (let ((matches
       (let ((matches
 	     (org-element-map (plist-get info :parse-tree)
 	     (org-element-map (plist-get info :parse-tree)
-		 (cons 'target org-element-all-elements)
+		 (append pseudo-types '(target) org-element-all-elements)
 	       (lambda (datum)
 	       (lambda (datum)
 		 (and (org-export-match-search-cell-p datum search-cells)
 		 (and (org-export-match-search-cell-p datum search-cells)
 		      datum)))))
 		      datum)))))