Class: HParser::Block::RAW

Inherits:
Pair
  • Object
show all
Includes:
Collectable
Defined in:
lib/hparser/html.rb,
lib/hparser/text.rb,
lib/hparser/latex.rb,
lib/hparser/block/raw.rb

Instance Attribute Summary

Attributes inherited from Pair

#content

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pair

get, #initialize, spliter

Constructor Details

This class inherits a constructor from HParser::Block::Pair

Class Method Details

.<=>(o) ⇒ Object



29
30
31
# File 'lib/hparser/block/raw.rb', line 29

def self.<=>(o)
  -1
end

.parse(scanner, context, inlines) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hparser/block/raw.rb', line 10

def self.parse(scanner, context, inlines)
  if scanner.scan(/^></)
    content = scanner.matched
    until content.match(/><$/)
      str = scanner.scan(/.*/)
      if str.nil? then
        content << "<"
        break
      end
      content << "\n" << str
    end
    self.new inlines.parse(content[1..-2], context)
  end
end

Instance Method Details

#==(o) ⇒ Object



25
26
27
# File 'lib/hparser/block/raw.rb', line 25

def ==(o)
  self.class == o.class and self.content == o.content
end

#to_htmlObject



267
268
269
# File 'lib/hparser/html.rb', line 267

def to_html
  @content.map {|i| i.to_html }.join
end

#to_latexObject



216
217
218
# File 'lib/hparser/latex.rb', line 216

def to_latex
  @content.map {|i| i.to_latex }.join
end

#to_textObject



130
131
132
# File 'lib/hparser/text.rb', line 130

def to_text
  @content.map {|i| i.to_text }.join
end