Class: Banzai::Filter::SetDirectionFilter
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Banzai::Filter::SetDirectionFilter
- Defined in:
- lib/banzai/filter/set_direction_filter.rb
Overview
HTML filter that sets dir=“auto” for RTL languages support
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/banzai/filter/set_direction_filter.rb', line 7 def call # select these elements just on top level of the document doc.xpath('p|h1|h2|h3|h4|h5|h6|ol|ul[not(@class="section-nav")]|blockquote|table').each do |el| el['dir'] = 'auto' end doc end |