amelioration(a11y): extrait un nouveau composant pour rendre du texte saisi par un humain accessible
This commit is contained in:
parent
1e37e5ca60
commit
4d8b4e078b
6 changed files with 149 additions and 0 deletions
21
app/lib/redcarpet/bare_renderer.rb
Normal file
21
app/lib/redcarpet/bare_renderer.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
module Redcarpet
|
||||
class BareRenderer < Redcarpet::Render::HTML
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
# won't use rubocop tag method because it is missing output buffer
|
||||
# rubocop:disable Rails/ContentTag
|
||||
def list(content, list_type)
|
||||
tag = list_type == :ordered ? :ol : :ul
|
||||
content_tag(tag, content, { class: @options[:class_names_map].fetch(:list) {} }, false)
|
||||
end
|
||||
|
||||
def list_item(content, list_type)
|
||||
content_tag(:li, content.strip.gsub(/<\/?p>/, ''), {}, false)
|
||||
end
|
||||
|
||||
def paragraph(text)
|
||||
content_tag(:p, text, { class: @options[:class_names_map].fetch(:paragraph) {} }, false)
|
||||
end
|
||||
# rubocop:enable Rails/ContentTag
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue