Module: Teepee::CommanderMixins::Formatting

Included in:
Teepee::Commander
Defined in:
lib/teepee/commander-mixins/formatting.rb

Instance Method Summary collapse

Instance Method Details

#b(expressions) ⇒ Object



64
65
66
# File 'lib/teepee/commander-mixins/formatting.rb', line 64

def b expressions
  html_tag :b, expressions
end

#big(expressions) ⇒ Object



68
69
70
# File 'lib/teepee/commander-mixins/formatting.rb', line 68

def big expressions
  html_tag :big, expressions
end

#brObject



72
73
74
# File 'lib/teepee/commander-mixins/formatting.rb', line 72

def br
  html_tag :br, nil
end

#del(expressions) ⇒ Object



76
77
78
# File 'lib/teepee/commander-mixins/formatting.rb', line 76

def del expressions
  html_tag :del, expressions
end

#enumerate(expressions) ⇒ Object



80
81
82
# File 'lib/teepee/commander-mixins/formatting.rb', line 80

def enumerate expressions
  html_tag :ol, expressions
end

#enumerate_lowercase(expressions) ⇒ Object



92
93
94
# File 'lib/teepee/commander-mixins/formatting.rb', line 92

def enumerate_lowercase expressions
  html_tag :ol, expressions, {type: "a"}
end

#enumerate_numeric(expressions) ⇒ Object



84
85
86
# File 'lib/teepee/commander-mixins/formatting.rb', line 84

def enumerate_numeric expressions
  html_tag :ol, expressions, {type: "1"}
end

#enumerate_roman_lowercase(expressions) ⇒ Object



100
101
102
# File 'lib/teepee/commander-mixins/formatting.rb', line 100

def enumerate_roman_lowercase expressions
  html_tag :ol, expressions, {type: "i"}
end

#enumerate_roman_uppercase(expressions) ⇒ Object



96
97
98
# File 'lib/teepee/commander-mixins/formatting.rb', line 96

def enumerate_roman_uppercase expressions
  html_tag :ol, expressions, {type: "I"}
end

#enumerate_uppercase(expressions) ⇒ Object



88
89
90
# File 'lib/teepee/commander-mixins/formatting.rb', line 88

def enumerate_uppercase expressions
  html_tag :ol, expressions, {type: "A"}
end

#h1(expressions) ⇒ Object



104
105
106
# File 'lib/teepee/commander-mixins/formatting.rb', line 104

def h1 expressions
  html_tag :h1, expressions
end

#h2(expressions) ⇒ Object



108
109
110
# File 'lib/teepee/commander-mixins/formatting.rb', line 108

def h2 expressions
  html_tag :h2, expressions
end

#h3(expressions) ⇒ Object



112
113
114
# File 'lib/teepee/commander-mixins/formatting.rb', line 112

def h3 expressions
  html_tag :h3, expressions
end

#h4(expressions) ⇒ Object



116
117
118
# File 'lib/teepee/commander-mixins/formatting.rb', line 116

def h4 expressions
  html_tag :h4, expressions
end

#h5(expressions) ⇒ Object



120
121
122
# File 'lib/teepee/commander-mixins/formatting.rb', line 120

def h5 expressions
  html_tag :h5, expressions
end

#h6(expressions) ⇒ Object



124
125
126
# File 'lib/teepee/commander-mixins/formatting.rb', line 124

def h6 expressions
  html_tag :h6, expressions
end

#html_tag(tag, expressions, attribs = nil) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/teepee/commander-mixins/formatting.rb', line 42

def html_tag tag, expressions, attribs=nil
  opening_tag = if attribs
                  attribs_string = attribs.map {|k,v| %{#{k}="#{v}"}}.join " "
                  if expressions.nil?
                    "<#{tag} #{attribs_string}/>"
                  else
                    "<#{tag} #{attribs_string}>"
                  end
                else
                  if expressions.nil?
                    "<#{tag}/>"
                  else
                    "<#{tag}>"
                  end
                end
  if expressions.nil?
    opening_tag
  else
    opening_tag + expressions.map(&:to_html).join.strip + "</#{tag}>"
  end
end

#it(expressions) ⇒ Object



128
129
130
# File 'lib/teepee/commander-mixins/formatting.rb', line 128

def it expressions
  html_tag :i, expressions
end

#item(expressions) ⇒ Object



132
133
134
# File 'lib/teepee/commander-mixins/formatting.rb', line 132

def item expressions
  html_tag :li, expressions
end

#itemize(expressions) ⇒ Object



136
137
138
# File 'lib/teepee/commander-mixins/formatting.rb', line 136

def itemize expressions
  html_tag :ul, expressions
end

#itemize_circle(expressions) ⇒ Object



144
145
146
# File 'lib/teepee/commander-mixins/formatting.rb', line 144

def itemize_circle expressions
  html_tag :ul, expressions, {style: "list-style-type:circle"}
end

#itemize_disc(expressions) ⇒ Object



140
141
142
# File 'lib/teepee/commander-mixins/formatting.rb', line 140

def itemize_disc expressions
  html_tag :ul, expressions, {style: "list-style-type:disc"}
end

#itemize_none(expressions) ⇒ Object



152
153
154
# File 'lib/teepee/commander-mixins/formatting.rb', line 152

def itemize_none expressions
  html_tag :ul, expressions, {style: "list-style-type:none"}
end

#itemize_square(expressions) ⇒ Object



148
149
150
# File 'lib/teepee/commander-mixins/formatting.rb', line 148

def itemize_square expressions
  html_tag :ul, expressions, {style: "list-style-type:square"}
end

#nbsp(count) ⇒ Object



156
157
158
159
160
161
162
# File 'lib/teepee/commander-mixins/formatting.rb', line 156

def nbsp count
  if count and count.to_number and count.to_number > 0
    "&nbsp;" * count.to_number
  else
    "&nbsp;"
  end
end

#small(expressions) ⇒ Object



164
165
166
# File 'lib/teepee/commander-mixins/formatting.rb', line 164

def small expressions
  html_tag :small, expressions
end

#span_operator(expressions) ⇒ Object



168
169
170
# File 'lib/teepee/commander-mixins/formatting.rb', line 168

def span_operator expressions
  html_tag :span, expressions
end

#sub(expressions) ⇒ Object



172
173
174
# File 'lib/teepee/commander-mixins/formatting.rb', line 172

def sub expressions
  html_tag :sub, expressions
end

#sup(expressions) ⇒ Object



176
177
178
# File 'lib/teepee/commander-mixins/formatting.rb', line 176

def sup expressions
  html_tag :sup, expressions
end

#table(expressions) ⇒ Object



180
181
182
# File 'lib/teepee/commander-mixins/formatting.rb', line 180

def table expressions
  html_tag :table, expressions
end

#table_data(expressions) ⇒ Object



184
185
186
# File 'lib/teepee/commander-mixins/formatting.rb', line 184

def table_data expressions
  html_tag :td, expressions
end

#table_header(expressions) ⇒ Object



188
189
190
# File 'lib/teepee/commander-mixins/formatting.rb', line 188

def table_header expressions
  html_tag :th, expressions
end

#table_row(expressions) ⇒ Object



192
193
194
# File 'lib/teepee/commander-mixins/formatting.rb', line 192

def table_row expressions
  html_tag :tr, expressions
end

#tt(expressions) ⇒ Object



196
197
198
# File 'lib/teepee/commander-mixins/formatting.rb', line 196

def tt expressions
  html_tag :tt, expressions
end

#u(expressions) ⇒ Object



200
201
202
# File 'lib/teepee/commander-mixins/formatting.rb', line 200

def u expressions
  html_tag :u, expressions
end