Class: Loofah::Scrubbers::NewlineBlockElements

Inherits:
Loofah::Scrubber show all
Defined in:
lib/loofah/scrubbers.rb

Overview

This class probably isn't useful publicly, but is used for #to_text's current implemention

Constant Summary

Constants inherited from Loofah::Scrubber

Loofah::Scrubber::CONTINUE, Loofah::Scrubber::STOP

Instance Attribute Summary

Attributes inherited from Loofah::Scrubber

#block, #direction

Instance Method Summary collapse

Methods inherited from Loofah::Scrubber

#append_attribute, #traverse

Constructor Details

#initializeNewlineBlockElements

:nodoc:



237
238
239
# File 'lib/loofah/scrubbers.rb', line 237

def initialize
  @direction = :bottom_up
end

Instance Method Details

#scrub(node) ⇒ Object



241
242
243
244
245
# File 'lib/loofah/scrubbers.rb', line 241

def scrub(node)
  return CONTINUE unless Loofah::Elements::BLOCK_LEVEL.include?(node.name)
  node.add_next_sibling Nokogiri::XML::Text.new("\n#{node.content}\n", node.document)
  node.remove
end