From 18b4c4d74f123c3ff482806341c0329598f96bf7 Mon Sep 17 00:00:00 2001 From: IGARASHI Masanao Date: Fri, 21 Nov 2014 13:00:26 +0900 Subject: [PATCH] Support image link. fixed #2 --- ox-rst.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ox-rst.el b/ox-rst.el index be88488..197c25b 100644 --- a/ox-rst.el +++ b/ox-rst.el @@ -967,6 +967,19 @@ if its description is a single link targeting an image file." info t))))) +(defun my-org-export-inline-image-p (link &optional rules) + (let ((case-fold-search t) + (rules (or rules org-export-default-inline-image-rule))) + (catch 'exit + (mapc + (lambda (rule) + (if (string-match (cdr rule) link) + (throw 'exit t))) + rules) + ;; Return nil if no rule matched. + nil))) + + (defun org-rst-link (link desc info) "Transcode a LINK object from Org to reStructuredText. @@ -1033,6 +1046,11 @@ INFO is a plist holding contextual information." (if caption (format ".. figure:: %s%s\n %s\n" ipath attributes (org-export-data caption info)) (format ".. image:: %s%s\n" ipath attributes)))) + ((and (plist-get info :rst-inline-images) + desc + (my-org-export-inline-image-p + desc (plist-get info :rst-inline-image-rules))) + (format ".. image:: %s\n :target: %s%s" desc path attributes)) ;; Radio link: Transcode target's contents and use them as link's ;; description. ((string= type "radio")