Class: PinkShirt::SAX::Basic

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

Constant Summary collapse

TAGS =
%w(strong b em i cite del ins sub sup span code)

Instance Attribute Summary collapse

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 Attribute Details

#nospanObject

Returns the value of attribute nospan.



4
5
6
# File 'lib/pink_shirt/sax/basic.rb', line 4

def nospan
  @nospan
end

Instance Method Details

#end_bObject



22
23
24
# File 'lib/pink_shirt/sax/basic.rb', line 22

def end_b
  @output << "**"
end

#end_citeObject



31
32
33
# File 'lib/pink_shirt/sax/basic.rb', line 31

def end_cite
  @output << "??"
end

#end_codeObject



109
110
111
# File 'lib/pink_shirt/sax/basic.rb', line 109

def end_code
  @output << "@"
end

#end_delObject



58
59
60
# File 'lib/pink_shirt/sax/basic.rb', line 58

def end_del
  @output << "-"
end

#end_emObject



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

def end_em
  @output << "_"
end

#end_iObject



49
50
51
# File 'lib/pink_shirt/sax/basic.rb', line 49

def end_i
  @output << "__"
end

#end_insObject



67
68
69
# File 'lib/pink_shirt/sax/basic.rb', line 67

def end_ins
  @output << "+"
end

#end_spanObject



99
100
101
102
# File 'lib/pink_shirt/sax/basic.rb', line 99

def end_span
  @output << "%" unless @nospan
  @nospan = false
end

#end_strongObject



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

def end_strong
  @output << "*"
end

#end_subObject



76
77
78
# File 'lib/pink_shirt/sax/basic.rb', line 76

def end_sub
  @output << "~"
end

#end_supObject



85
86
87
# File 'lib/pink_shirt/sax/basic.rb', line 85

def end_sup
  @output << "^"
end

#start_cite(attrs) ⇒ Object



26
27
28
29
# File 'lib/pink_shirt/sax/basic.rb', line 26

def start_cite attrs
  @output << "??"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_code(attrs) ⇒ Object



104
105
106
107
# File 'lib/pink_shirt/sax/basic.rb', line 104

def start_code attrs
  @output << "@"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_del(attrs) ⇒ Object



53
54
55
56
# File 'lib/pink_shirt/sax/basic.rb', line 53

def start_del attrs
  @output << "-"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_em(attrs) ⇒ Object



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

def start_em attrs
  @output << "_"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_i(attrs) ⇒ Object



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

def start_i attrs
  @output << "__"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_ins(attrs) ⇒ Object



62
63
64
65
# File 'lib/pink_shirt/sax/basic.rb', line 62

def start_ins attrs
  @output << "+"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_span(attrs) ⇒ Object

redcloth loves to put caps in ‘span-caps’, it’s lame



90
91
92
93
94
95
96
97
# File 'lib/pink_shirt/sax/basic.rb', line 90

def start_span attrs
  if attrs['class'] == 'caps'
    @nospan = true
  else
    @output << "%"
    @output << add_attributes(attrs) if add_attributes(attrs)
  end
end

#start_strong(attrs) ⇒ Object Also known as: start_b



6
7
8
9
# File 'lib/pink_shirt/sax/basic.rb', line 6

def start_strong attrs
  @output << "*"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_sub(attrs) ⇒ Object



71
72
73
74
# File 'lib/pink_shirt/sax/basic.rb', line 71

def start_sub attrs
  @output << "~"
  @output << add_attributes(attrs) if add_attributes(attrs)
end

#start_sup(attrs) ⇒ Object



80
81
82
83
# File 'lib/pink_shirt/sax/basic.rb', line 80

def start_sup attrs
  @output << "^"
  @output << add_attributes(attrs) if add_attributes(attrs)
end