Class: PinkShirt::SAX::BlockLevel

Inherits:
Base
  • Object
show all
Defined in:
lib/pink_shirt/sax/block_level.rb

Constant Summary collapse

TAGS =
%w(p br h1 h2 h3 h4 h5 h6 div blockquote)

Instance Method Summary collapse

Methods inherited from Base

#add_attributes, #initialize, #method_missing, #to_s

Constructor Details

This class inherits a constructor from PinkShirt::SAX::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PinkShirt::SAX::Base

Instance Method Details

#end_brObject


32
33
34
# File 'lib/pink_shirt/sax/block_level.rb', line 32

def end_br
  @output << "\n"
end

#end_divObject


17
18
19
# File 'lib/pink_shirt/sax/block_level.rb', line 17

def end_div
  @output << "\n"
end

#end_hObject Also known as: end_h1, end_h2, end_h3, end_h4, end_h5, end_h6


60
61
62
# File 'lib/pink_shirt/sax/block_level.rb', line 60

def end_h
  @output << "\n\n"
end

#end_pObject


9
10
11
# File 'lib/pink_shirt/sax/block_level.rb', line 9

def end_p
  @output << "\n\n"
end

#start_blockquote(attrs) ⇒ Object


21
22
23
24
25
26
27
# File 'lib/pink_shirt/sax/block_level.rb', line 21

def start_blockquote attrs
  if attrs['cite']
    @output << "bq.:#{attrs['cite']} "
  else
    @output << "bq#{add_attributes(attrs)}. "
  end
end

#start_br(attrs) ⇒ Object


29
30
# File 'lib/pink_shirt/sax/block_level.rb', line 29

def start_br attrs
end

#start_div(attrs) ⇒ Object


13
14
15
# File 'lib/pink_shirt/sax/block_level.rb', line 13

def start_div attrs
  @output << "div#{add_attributes(attrs)}. "
end

#start_h1(attrs) ⇒ Object


36
37
38
# File 'lib/pink_shirt/sax/block_level.rb', line 36

def start_h1 attrs
  @output << "h1#{add_attributes(attrs)}. "
end

#start_h2(attrs) ⇒ Object


40
41
42
# File 'lib/pink_shirt/sax/block_level.rb', line 40

def start_h2 attrs
  @output << "h2#{add_attributes(attrs)}. "
end

#start_h3(attrs) ⇒ Object


44
45
46
# File 'lib/pink_shirt/sax/block_level.rb', line 44

def start_h3 attrs
  @output << "h3#{add_attributes(attrs)}. "
end

#start_h4(attrs) ⇒ Object


48
49
50
# File 'lib/pink_shirt/sax/block_level.rb', line 48

def start_h4 attrs
  @output << "h4#{add_attributes(attrs)}. "
end

#start_h5(attrs) ⇒ Object


52
53
54
# File 'lib/pink_shirt/sax/block_level.rb', line 52

def start_h5 attrs
  @output << "h5#{add_attributes(attrs)}. "
end

#start_h6(attrs) ⇒ Object


56
57
58
# File 'lib/pink_shirt/sax/block_level.rb', line 56

def start_h6 attrs
  @output << "h6#{add_attributes(attrs)}. "
end

#start_p(attrs) ⇒ Object


5
6
7
# File 'lib/pink_shirt/sax/block_level.rb', line 5

def start_p attrs
  @output << "p#{add_attributes(attrs)}. " if add_attributes(attrs)
end