Class: PinkShirt::SAX::Basic

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

Constant Summary

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

- (Object) nospan

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

- (Object) end_b



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

def end_b
  @output << "**"
end

- (Object) end_cite



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

def end_cite
  @output << "??"
end

- (Object) end_code



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

def end_code
  @output << "@"
end

- (Object) end_del



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

def end_del
  @output << "-"
end

- (Object) end_em



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

def end_em
  @output << "_"
end

- (Object) end_i



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

def end_i
  @output << "__"
end

- (Object) end_ins



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

def end_ins
  @output << "+"
end

- (Object) end_span



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

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

- (Object) end_strong



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

def end_strong
  @output << "*"
end

- (Object) end_sub



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

def end_sub
  @output << "~"
end

- (Object) end_sup



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

def end_sup
  @output << "^"
end

- (Object) start_cite(attrs)



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

- (Object) start_code(attrs)



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

- (Object) start_del(attrs)



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

- (Object) start_em(attrs)



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

- (Object) start_i(attrs)



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

- (Object) start_ins(attrs)



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

- (Object) start_span(attrs)

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

- (Object) start_strong(attrs) 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

- (Object) start_sub(attrs)



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

- (Object) start_sup(attrs)



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