Class: Java::NetHtmlparserJericho::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/codemodels/html/parser.rb

Instance Method Summary collapse

Instance Method Details

#text_blocks(code) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/codemodels/html/parser.rb', line 26

def text_blocks(code)
  blocks = []
  break_content(self,code).each do |s,e|
    text = code[s,e-s]      
    unless text==nil or text.strip.empty?
      block = TextBlock.new
      block.value = text
      block.source = SourceInfo.new
      block.source.position = SourcePosition.from_code_indexes(code,s,e-1)

      blocks << block
    end
  end
  blocks
end