Browse 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 10 years ago
parent
commit
0ed99a4c8c
1 changed files with 11 additions and 7 deletions
  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
 LINK is the link pointing to the inline image.  INFO is the
 current state of the export, as a plist."
 current state of the export, as a plist."
   (let* ((parent (org-export-get-parent-element link))
   (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))
 	 (caption (org-export-get-caption parent))
 	 (shortcaption (org-export-get-caption parent t))
 	 (shortcaption (org-export-get-caption parent t))
 	 (path  (org-element-property :path link))
 	 (path  (org-element-property :path link))
@@ -1049,13 +1051,15 @@ current state of the export, as a plist."
 	 (alt (or (plist-get attributes :alt) ""))
 	 (alt (or (plist-get attributes :alt) ""))
 	 (image (format "@image{%s,%s,%s,%s,%s}"
 	 (image (format "@image{%s,%s,%s,%s,%s}"
 			filename width height alt extension)))
 			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
 ;;;; Menu