emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] * org-html.el (org-html-handle-links): add an alternate


From: Aankhen
Subject: Re: [O] [PATCH] * org-html.el (org-html-handle-links): add an alternate for inline images
Date: Wed, 20 Apr 2011 02:38:57 +0530

Hi,

On Tue, Apr 19, 2011 at 14:52, Bastien <address@hidden> wrote:
> Applied, thanks.
>
> Manuel Giraud <address@hidden> writes:
>
>> ---
>>  lisp/org-html.el |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/lisp/org-html.el b/lisp/org-html.el
>> index 5d53478..7a4564d 100644
>> --- a/lisp/org-html.el
>> +++ b/lisp/org-html.el
>> @@ -888,7 +888,8 @@ OPT-PLIST is the export options list."
>>         (if (string-match "^file:" desc)
>>             (setq desc (substring desc (match-end 0)))))
>>       (setq desc (org-add-props
>> -                    (concat "<img src=\"" desc "\"/>")
>> +                    (concat "<img src=\"" desc "\" alt=\""
>> +                            (file-name-nondirectory desc) "\"/>")
>>                      '(org-protected t))))
>>        (cond
>>         ((equal type "internal")

This might not be the best solution.  The purpose of the ‘alt’
attribute is to provide a textual alternative, which the file name
really isn’t.  It would be better to provide an empty value:

,----
| <img src="foo.png" alt=""/>
`----

I took a look at ‘org-html.el’ and changed the relevant line, but it
doesn’t seem to have any effect.  I think it’s being overriden by
‘org-export-html-format-image’, so I changed that as well.  Here’s the
resultant patch:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org-html.el b/lisp/org-html.el
index 7a4564d..570d7d6 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -888,8 +888,7 @@ OPT-PLIST is the export options list."
          (if (string-match "^file:" desc)
              (setq desc (substring desc (match-end 0)))))
        (setq desc (org-add-props
-                      (concat "<img src=\"" desc "\" alt=\""
-                              (file-name-nondirectory desc) "\"/>")
+                      (concat "<img src=\"" desc "\" alt=\"\"/>")
                       '(org-protected t))))
       (cond
        ((equal type "internal")
@@ -1839,8 +1838,8 @@ lang=\"%s\" xml:lang=\"%s\">
   "Create image tag with source and attributes."
   (save-match-data
     (if (string-match "^ltxpng/" src)
-       (format "<img src=\"%s\" alt=\"%s\"/>"
-                src (org-find-text-property-in-string 'org-latex-src src))
+       (format "<img src=\"%s\" alt=\"\"/>"
+                src)
       (let* ((caption (org-find-text-property-in-string 'org-caption src))
             (attr (org-find-text-property-in-string 'org-attributes src))
             (label (org-find-text-property-in-string 'org-label src)))
@@ -1855,7 +1854,7 @@ lang=\"%s\" xml:lang=\"%s\">
                src
                (if (string-match "\\<alt=" (or attr ""))
                    (concat " " attr )
-                 (concat " " attr " alt=\"" src "\"")))
+                 (concat " " attr " alt=\"\"")))
        (if caption
            (format "</p>%s
 </div>%s"
--8<---------------cut here---------------end--------------->8---

Aankhen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]