diff --git a/lib/org-ruby/image_regexp.rb b/lib/org-ruby/image_regexp.rb index 6fc9db4..3ddc880 100644 --- a/lib/org-ruby/image_regexp.rb +++ b/lib/org-ruby/image_regexp.rb @@ -1,7 +1,7 @@ module Orgmode module ImageRegexp def image_file - /\.(gif|jpe?g|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i + /\.(gif|jpe?g|webp|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i end end end diff --git a/lib/org-ruby/markdown_output_buffer.rb b/lib/org-ruby/markdown_output_buffer.rb index 418ee4a..649c236 100644 --- a/lib/org-ruby/markdown_output_buffer.rb +++ b/lib/org-ruby/markdown_output_buffer.rb @@ -49,10 +49,10 @@ def inline_formatting(input) @re_help.rewrite_links input do |link, defi| # 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 + defi ||= link unless RegexpHelper.image_file.match(link) link = link.gsub(/ /, "%%20") - if defi =~ @re_help.org_image_file_regexp + if RegexpHelper.image_file.match(defi) "" elsif defi "[#{defi}](#{link})" diff --git a/lib/org-ruby/regexp_helper.rb b/lib/org-ruby/regexp_helper.rb index 5d18f8d..26c1250 100644 --- a/lib/org-ruby/regexp_helper.rb +++ b/lib/org-ruby/regexp_helper.rb @@ -170,10 +170,6 @@ def org_emphasis_regexp "(?=#{post_emphasis})") end - def org_image_file_regexp - /\.(gif|jpe?g|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i - end - private def pre_emphasis_regexp diff --git a/lib/org-ruby/textile_output_buffer.rb b/lib/org-ruby/textile_output_buffer.rb index 0c5bf8e..7271ca9 100644 --- a/lib/org-ruby/textile_output_buffer.rb +++ b/lib/org-ruby/textile_output_buffer.rb @@ -61,10 +61,10 @@ def inline_formatting(input) # 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 + defi ||= link unless RegexpHelper.image_file.match(link) link = link.gsub(/ /, "%%20") - if defi =~ @re_help.org_image_file_regexp + if RegexpHelper.image_file.match(defi) defi = "!#{defi}(#{defi})!" elsif defi defi = "\"#{defi}\"" diff --git a/spec/html_examples/escape-pre.html b/spec/html_examples/escape-pre.html index 0671519..125df07 100644 --- a/spec/html_examples/escape-pre.html +++ b/spec/html_examples/escape-pre.html @@ -1,6 +1,6 @@
-<li>[ ] “smart quotes”</li> -<li>[ ] I think I need this for ‘single quotes’ too. Don’t I?</li> -<li>[ ] Em dashes would be great — wouldn’t they?</li> -<li>[ ] I hope to develop an en dash sometime in 2010 – 2011.</li> +<li>[ ] “smart quotes”</li> +<li>[ ] I think I need this for ‘single quotes’ too. Don’t I?</li> +<li>[ ] Em dashes would be great — wouldn’t they?</li> +<li>[ ] I hope to develop an en dash sometime in 2010 – 2011.</li>diff --git a/spec/html_examples/escape-pre.org b/spec/html_examples/escape-pre.org index abcb4a7..0635b87 100644 --- a/spec/html_examples/escape-pre.org +++ b/spec/html_examples/escape-pre.org @@ -1,6 +1,6 @@ #+BEGIN_EXAMPLE -
And now back to normal!
-<li>[ ] “smart quotes”</li> -<li>[ ] I think I need this for ‘single quotes’ too. Don’t I?</li> -<li>[ ] Em dashes would be great — wouldn’t they?</li> -<li>[ ] I hope to develop an en dash sometime in 2010 – 2011.</li> +<li>[ ] “smart quotes”</li> +<li>[ ] I think I need this for ‘single quotes’ too. Don’t I?</li> +<li>[ ] Em dashes would be great — wouldn’t they?</li> +<li>[ ] I hope to develop an en dash sometime in 2010 – 2011.</li>
Sample absolute link to .svg:
Sample absolute link to .svg:
Sample absolute link to .svg: