Parcourir la source

ox-texinfo: Fix labelled images without caption

* lisp/ox-texinfo.el (org-texinfo--inline-image): Add an @anchor for
  labelled images without a caption.

Reported-by: Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97961>
Nicolas Goaziou il y a 9 ans
Parent
commit
0ed99a4c8c
1 fichiers modifiés avec 11 ajouts et 7 suppressions
  1. 11 7
      lisp/ox-texinfo.el

+ 11 - 7
lisp/ox-texinfo.el

@@ -1036,6 +1036,8 @@ INFO is a plist holding contextual information.  See
 LINK is the link pointing to the inline image.  INFO is the
 current state of the export, as a plist."
   (let* ((parent (org-export-get-parent-element link))
+	 (label (and (org-element-property :name parent)
+		     (org-texinfo--get-node parent info)))
 	 (caption (org-export-get-caption parent))
 	 (shortcaption (org-export-get-caption parent t))
 	 (path  (org-element-property :path link))
@@ -1049,13 +1051,15 @@ current state of the export, as a plist."
 	 (alt (or (plist-get attributes :alt) ""))
 	 (image (format "@image{%s,%s,%s,%s,%s}"
 			filename width height alt extension)))
-    (if (not (or caption shortcaption)) image
-      (org-texinfo--wrap-float image
-			       info
-			       (org-export-translate "Figure" :utf-8 info)
-			       (org-element-property :name parent)
-			       caption
-			       shortcaption))))
+    (cond ((or caption shortcaption)
+	   (org-texinfo--wrap-float image
+				    info
+				    (org-export-translate "Figure" :utf-8 info)
+				    label
+				    caption
+				    shortcaption))
+	  (label (concat "@anchor{" label "}\n" image))
+	  (t image))))
 
 
 ;;;; Menu