Skip to content

Commit 45b451d

Browse files
committed
add support for webp images
1 parent dd2efd2 commit 45b451d

8 files changed

Lines changed: 13 additions & 6 deletions

File tree

lib/org-ruby/image_regexp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Orgmode
22
module ImageRegexp
33
def image_file
4-
/\.(gif|jpe?g|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i
4+
/\.(gif|jpe?g|webp|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i
55
end
66
end
77
end

lib/org-ruby/regexp_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def org_emphasis_regexp
171171
end
172172

173173
def org_image_file_regexp
174-
/\.(gif|jpe?g|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i
174+
/\.(gif|jpe?g|webp|p(?:bm|gm|n[gm]|pm)|svgz?|tiff?|x[bp]m)/i
175175
end
176176

177177
private

spec/html_examples/include-file.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ <h2>Continue numbered list</h2>
7777
<p>And now back to normal!</p>
7878
<h2>Within a commented block</h2>
7979
<pre class="example">
80-
&lt;li&gt;[ ] &amp;#8220;smart quotes&amp;#8221;&lt;/li&gt;
81-
&lt;li&gt;[ ] I think I need this for &amp;#8216;single quotes&amp;#8217; too. Don&amp;#8217;t I?&lt;/li&gt;
82-
&lt;li&gt;[ ] Em dashes would be great &amp;#8212; wouldn&amp;#8217;t they?&lt;/li&gt;
83-
&lt;li&gt;[ ] I hope to develop an en dash sometime in 2010 &amp;#8211; 2011.&lt;/li&gt;
80+
&lt;li&gt;[ ] &amp;#8220;smart quotes&amp;#8221;&lt;/li&gt;
81+
&lt;li&gt;[ ] I think I need this for &amp;#8216;single quotes&amp;#8217; too. Don&amp;#8217;t I?&lt;/li&gt;
82+
&lt;li&gt;[ ] Em dashes would be great &amp;#8212; wouldn&amp;#8217;t they?&lt;/li&gt;
83+
&lt;li&gt;[ ] I hope to develop an en dash sometime in 2010 &amp;#8211; 2011.&lt;/li&gt;
8484
</pre>
8585
<h2>Within a center block</h2>
8686
<div style="text-align: center">
@@ -98,6 +98,7 @@ <h2>Within a center block</h2>
9898
<li>.jpeg</li>
9999
<li>.svg</li>
100100
<li>.svgz</li>
101+
<li>.webp</li>
101102
</ul>
102103
<p>Sample absolute link to .svg:</p>
103104
<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>
@@ -129,6 +130,7 @@ <h2>Within a blockquote</h2>
129130
<li>.jpeg</li>
130131
<li>.svg</li>
131132
<li>.svgz</li>
133+
<li>.webp</li>
132134
</ul>
133135
<p>Sample absolute link to .svg:</p>
134136
<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>

spec/html_examples/inline-images.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<li>.jpeg</li>
1212
<li>.svg</li>
1313
<li>.svgz</li>
14+
<li>.webp</li>
1415
</ul>
1516
<p>Sample absolute link to .svg:</p>
1617
<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>

spec/html_examples/inline-images.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ the inline image. I recognize the following image file types:
1414
- .jpeg
1515
- .svg
1616
- .svgz
17+
- .webp
1718

1819
Sample absolute link to .svg:
1920

spec/markdown_examples/inline-images.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ the inline image. I recognize the following image file types:
1414
* .jpeg
1515
* .svg
1616
* .svgz
17+
* .webp
1718

1819
Sample .svg:
1920

spec/markdown_examples/inline-images.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ the inline image. I recognize the following image file types:
1414
- .jpeg
1515
- .svg
1616
- .svgz
17+
- .webp
1718

1819
Sample .svg:
1920

spec/org-ruby/image_regexp_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class DummyRegexp
1515
it { expect(regexp.image_file).to match 'some/path/file.gif' }
1616
it { expect(regexp.image_file).to match 'other.svgz' }
1717
it { expect(regexp.image_file).to match 'tiffany.tiff' }
18+
it { expect(regexp.image_file).to match 'file.webp' }
1819
it { expect(regexp.image_file).to match 'xx.xpm' }
1920
it { expect(regexp.image_file).to match 'yy.xbm' }
2021

0 commit comments

Comments
 (0)