Skip to content
Merged
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
2 changes: 1 addition & 1 deletion lib/org-ruby/image_regexp.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions lib/org-ruby/markdown_output_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
"![#{defi}](#{defi})"
elsif defi
"[#{defi}](#{link})"
Expand Down
4 changes: 0 additions & 4 deletions lib/org-ruby/regexp_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/org-ruby/textile_output_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}\""
Expand Down
8 changes: 4 additions & 4 deletions spec/html_examples/escape-pre.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<pre class="example">
&lt;li&gt;[ ] &amp;#8220;smart quotes&amp;#8221;&lt;/li&gt;
&lt;li&gt;[ ] I think I need this for &amp;#8216;single quotes&amp;#8217; too. Don&amp;#8217;t I?&lt;/li&gt;
&lt;li&gt;[ ] Em dashes would be great &amp;#8212; wouldn&amp;#8217;t they?&lt;/li&gt;
&lt;li&gt;[ ] I hope to develop an en dash sometime in 2010 &amp;#8211; 2011.&lt;/li&gt;
&lt;li&gt;[ ] &amp;#8220;smart quotes&amp;#8221;&lt;/li&gt;
&lt;li&gt;[ ] I think I need this for &amp;#8216;single quotes&amp;#8217; too. Don&amp;#8217;t I?&lt;/li&gt;
&lt;li&gt;[ ] Em dashes would be great &amp;#8212; wouldn&amp;#8217;t they?&lt;/li&gt;
&lt;li&gt;[ ] I hope to develop an en dash sometime in 2010 &amp;#8211; 2011.&lt;/li&gt;
</pre>
10 changes: 5 additions & 5 deletions spec/html_examples/escape-pre.org
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#+BEGIN_EXAMPLE
<li>[ ] &#8220;smart quotes&#8221;</li>
<li>[ ] I think I need this for &#8216;single quotes&#8217; too. Don&#8217;t I?</li>
<li>[ ] Em dashes would be great &#8212; wouldn&#8217;t they?</li>
<li>[ ] I hope to develop an en dash sometime in 2010 &#8211; 2011.</li>
#+END_EXAMPLE
<li>[ ] &#8220;smart quotes&#8221;</li>
<li>[ ] I think I need this for &#8216;single quotes&#8217; too. Don&#8217;t I?</li>
<li>[ ] Em dashes would be great &#8212; wouldn&#8217;t they?</li>
<li>[ ] I hope to develop an en dash sometime in 2010 &#8211; 2011.</li>
#+END_EXAMPLE
10 changes: 6 additions & 4 deletions spec/html_examples/include-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ <h2>Continue numbered list</h2>
<p>And now back to normal!</p>
<h2>Within a commented block</h2>
<pre class="example">
&lt;li&gt;[ ] &amp;#8220;smart quotes&amp;#8221;&lt;/li&gt;
&lt;li&gt;[ ] I think I need this for &amp;#8216;single quotes&amp;#8217; too. Don&amp;#8217;t I?&lt;/li&gt;
&lt;li&gt;[ ] Em dashes would be great &amp;#8212; wouldn&amp;#8217;t they?&lt;/li&gt;
&lt;li&gt;[ ] I hope to develop an en dash sometime in 2010 &amp;#8211; 2011.&lt;/li&gt;
&lt;li&gt;[ ] &amp;#8220;smart quotes&amp;#8221;&lt;/li&gt;
&lt;li&gt;[ ] I think I need this for &amp;#8216;single quotes&amp;#8217; too. Don&amp;#8217;t I?&lt;/li&gt;
&lt;li&gt;[ ] Em dashes would be great &amp;#8212; wouldn&amp;#8217;t they?&lt;/li&gt;
&lt;li&gt;[ ] I hope to develop an en dash sometime in 2010 &amp;#8211; 2011.&lt;/li&gt;
</pre>
<h2>Within a center block</h2>
<div style="text-align: center">
Expand All @@ -98,6 +98,7 @@ <h2>Within a center block</h2>
<li>.jpeg</li>
<li>.svg</li>
<li>.svgz</li>
<li>.webp</li>
</ul>
<p>Sample absolute link to .svg:</p>
<p><img src="https://www.w3.org/Graphics/SVG/Test/20110816/svg/animate-dom-01-f.svg" alt="https://www.w3.org/Graphics/SVG/Test/20110816/svg/animate-dom-01-f.svg" /></p>
Expand Down Expand Up @@ -129,6 +130,7 @@ <h2>Within a blockquote</h2>
<li>.jpeg</li>
<li>.svg</li>
<li>.svgz</li>
<li>.webp</li>
</ul>
<p>Sample absolute link to .svg:</p>
<p><img src="https://www.w3.org/Graphics/SVG/Test/20110816/svg/animate-dom-01-f.svg" alt="https://www.w3.org/Graphics/SVG/Test/20110816/svg/animate-dom-01-f.svg" /></p>
Expand Down
1 change: 1 addition & 0 deletions spec/html_examples/inline-images.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<li>.jpeg</li>
<li>.svg</li>
<li>.svgz</li>
<li>.webp</li>
</ul>
<p>Sample absolute link to .svg:</p>
<p><img src="https://www.w3.org/Graphics/SVG/Test/20110816/svg/animate-dom-01-f.svg" alt="https://www.w3.org/Graphics/SVG/Test/20110816/svg/animate-dom-01-f.svg" /></p>
Expand Down
1 change: 1 addition & 0 deletions spec/html_examples/inline-images.org
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ the inline image. I recognize the following image file types:
- .jpeg
- .svg
- .svgz
- .webp

Sample absolute link to .svg:

Expand Down
1 change: 1 addition & 0 deletions spec/markdown_examples/inline-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ the inline image. I recognize the following image file types:
* .jpeg
* .svg
* .svgz
* .webp

Sample .svg:

Expand Down
1 change: 1 addition & 0 deletions spec/markdown_examples/inline-images.org
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ the inline image. I recognize the following image file types:
- .jpeg
- .svg
- .svgz
- .webp

Sample .svg:

Expand Down
1 change: 1 addition & 0 deletions spec/org-ruby/image_regexp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DummyRegexp
it { expect(regexp.image_file).to match 'some/path/file.gif' }
it { expect(regexp.image_file).to match 'other.svgz' }
it { expect(regexp.image_file).to match 'tiffany.tiff' }
it { expect(regexp.image_file).to match 'file.webp' }
it { expect(regexp.image_file).to match 'xx.xpm' }
it { expect(regexp.image_file).to match 'yy.xbm' }

Expand Down
Loading