Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions lib/org-ruby/html_output_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,19 +314,14 @@ def inline_formatting(str)
text.sub!(/\Afile(|\+emacs|\+sys):(?=[^\s]+\Z)/, "")
end

# We don't add a description for images in links, because its
# empty value forces the image to be inlined.
defi ||= link unless link =~ @re_help.org_image_file_regexp

if defi =~ @re_help.org_image_file_regexp
defi = quote_tags "<img src=\"#{defi}\" alt=\"#{defi}\" />"
end

if defi
link = @options[:link_abbrevs][link] if @options[:link_abbrevs].has_key? link
quote_tags("<a href=\"#{link}\">") + defi + quote_tags("</a>")
if link =~ @re_help.org_image_file_regexp
quote_tags "<img src=\"#{link}\" alt=\"#{defi || link}\" />"
else
quote_tags "<img src=\"#{link}\" alt=\"#{link}\" />"
if defi =~ @re_help.org_image_file_regexp
defi = quote_tags "<img src=\"#{defi}\" alt=\"#{defi}\" />"
end
link = @options[:link_abbrevs][link] if @options[:link_abbrevs].has_key? link
quote_tags("<a href=\"#{link}\">") + (defi || link) + quote_tags("</a>")
end
end

Expand Down
3 changes: 3 additions & 0 deletions spec/html_examples/image-with-alt-description.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>Image with alt description</p>
<p>This image should use the description as the alt attribute:</p>
<p><img src="screenshots/cool_screenshot.jpg" alt="A screenshot of our new UI" /></p>
5 changes: 5 additions & 0 deletions spec/html_examples/image-with-alt-description.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Image with alt description

This image should use the description as the alt attribute:

[[file:screenshots/cool_screenshot.jpg][A screenshot of our new UI]]