]> cat aescling's git repositories - mastodon.git/commitdiff
Add support for “start” and “reversed” attributes to ol element
authorThibaut Girka <thib@sitedethib.com>
Tue, 30 Jun 2020 22:06:22 +0000 (00:06 +0200)
committerThibG <thib@sitedethib.com>
Tue, 30 Jun 2020 23:02:27 +0000 (01:02 +0200)
Fixes #1367

app/lib/sanitize_config.rb
spec/lib/sanitize_config_spec.rb

index dfd8b9f91749a0d963b40e790540127802f00133..8b57b0f72326135a74fe2964fcdc1457d91a9139 100644 (file)
@@ -90,6 +90,7 @@ class Sanitize
         'span'       => %w(class),
         'abbr'       => %w(title),
         'blockquote' => %w(cite),
+        'ol'         => %w(start reversed),
       },
 
       add_attributes: {
index 28a548c494e9fcdaebdb22b82744810078f8a863..da24f67d61ec0dfe2ee3e17aa031994ec19d86f4 100644 (file)
@@ -13,6 +13,10 @@ describe Sanitize::Config do
       expect(Sanitize.fragment('<p>Check out:</p><ul><li>Foo</li><li>Bar</li></ul>', subject)).to eq '<p>Check out:</p><ul><li>Foo</li><li>Bar</li></ul>'
     end
 
+    it 'keeps start and reversed attributes of ol' do
+      expect(Sanitize.fragment('<p>Check out:</p><ol start="3" reversed=""><li>Foo</li><li>Bar</li></ol>', subject)).to eq '<p>Check out:</p><ol start="3" reversed=""><li>Foo</li><li>Bar</li></ol>'
+    end
+
     it 'removes a without href' do
       expect(Sanitize.fragment('<a>Test</a>', subject)).to eq 'Test'
     end