Module RedCloth::Formatters::HTML
In: lib/redcloth/formatters/html.rb

Methods

acronym   amp   apos   arrow   bc_close   bc_open   bq_close   bq_open   br   caps   copyright   del   dim   dl_close   dl_open   ellipsis   emdash   endash   entity   fn   footno   gt   hr   html   html_block   ignored_line   image   inline_html   li_close   li_open   link   lt   multi_paragraph_quote   notextile   quot   quote1   quote2   registered   snip   squot   table_close   table_open   td   tr_close   tr_open   trademark  

Included Modules

RedCloth::Formatters::Base

Constants

BASIC_TAGS = { 'a' => ['href', 'title'], 'img' => ['src', 'alt', 'title'], 'br' => [], 'i' => nil, 'u' => nil, 'b' => nil, 'pre' => nil, 'kbd' => nil, 'code' => ['lang'], 'cite' => nil, 'strong' => nil, 'em' => nil, 'ins' => nil, 'sup' => nil, 'sub' => nil, 'del' => nil, 'table' => nil, 'tr' => nil, 'td' => ['colspan', 'rowspan'], 'th' => nil, 'ol' => ['start'], 'ul' => nil, 'li' => nil, 'p' => nil, 'h1' => nil, 'h2' => nil, 'h3' => nil, 'h4' => nil, 'h5' => nil, 'h6' => nil, 'blockquote' => ['cite'], 'notextile' => nil   HTML cleansing stuff

Public Instance methods

[Source]

    # File lib/redcloth/formatters/html.rb, line 21
21:   def acronym(opts)
22:     opts[:block] = true
23:     "<acronym#{pba(opts)}>#{caps(:text => opts[:text])}</acronym>"
24:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 196
196:   def amp(opts)
197:     "&amp;"
198:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 224
224:   def apos(opts)
225:     "&#39;"
226:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 169
169:   def arrow(opts)
170:     "&#8594;"
171:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 99
 99:   def bc_close(opts)
100:     "</pre>\n"
101:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 94
94:   def bc_open(opts)
95:     opts[:block] = true
96:     "<pre#{pba(opts)}>"
97:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 109
109:   def bq_close(opts)
110:     "</blockquote>\n"
111:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 103
103:   def bq_open(opts)
104:     opts[:block] = true
105:     cite = opts[:cite] ? " cite=\"#{ escape_attribute opts[:cite] }\"" : ''
106:     "<blockquote#{cite}#{pba(opts)}>\n"
107:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 208
208:   def br(opts)
209:     if hard_breaks == false
210:       "\n"
211:     else
212:       "<br />\n"
213:     end
214:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 26
26:   def caps(opts)
27:     if no_span_caps
28:       opts[:text]
29:     else
30:       opts[:class] = 'caps'
31:       span(opts)
32:     end
33:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 188
188:   def copyright(opts)
189:     "&#169;"
190:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 35
35:   def del(opts)
36:     opts[:block] = true
37:     "<del#{pba(opts)}>#{opts[:text]}</del>"
38:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 173
173:   def dim(opts)
174:     opts[:text].gsub!('x', '&#215;')
175:     opts[:text].gsub!("'", '&#8242;')
176:     opts[:text].gsub!('"', '&#8243;')
177:     opts[:text]
178:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 63
63:   def dl_close(opts=nil)
64:     "</dl>\n"
65:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 58
58:   def dl_open(opts)
59:     opts[:block] = true
60:     "<dl#{pba(opts)}>\n"
61:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 157
157:   def ellipsis(opts)
158:     "#{opts[:text]}&#8230;"
159:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 161
161:   def emdash(opts)
162:     "&#8212;"
163:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 165
165:   def endash(opts)
166:     " &#8211; "
167:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 192
192:   def entity(opts)
193:     "&#{opts[:text]};"
194:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 134
134:   def fn(opts)
135:     no = opts[:id]
136:     opts[:id] = "fn#{no}"
137:     opts[:class] = ["footnote", opts[:class]].compact.join(" ")
138:     "<p#{pba(opts)}><sup>#{no}</sup> #{opts[:text]}</p>\n"
139:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 129
129:   def footno(opts)
130:     opts[:id] ||= opts[:text]
131:     %Q{<sup class="footnote"><a href=\"#fn#{opts[:id]}\">#{opts[:text]}</a></sup>}
132:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 200
200:   def gt(opts)
201:     "&gt;"
202:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 17
17:   def hr(opts)
18:     "<hr />\n"
19:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 228
228:   def html(opts)
229:     "#{opts[:text]}\n"
230:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 232
232:   def html_block(opts)
233:     inline_html(:text => "#{opts[:indent_before_start]}#{opts[:start_tag]}#{opts[:indent_after_start]}") + 
234:     "#{opts[:text]}" +
235:     inline_html(:text => "#{opts[:indent_before_end]}#{opts[:end_tag]}#{opts[:indent_after_end]}")
236:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 254
254:   def ignored_line(opts)
255:     opts[:text] + "\n"
256:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 121
121:   def image(opts)
122:     opts.delete(:align)
123:     opts[:alt] = opts[:title]
124:     img = "<img src=\"#{escape_attribute opts[:src]}\"#{pba(opts)} alt=\"#{escape_attribute opts[:alt].to_s}\" />"  
125:     img = "<a href=\"#{escape_attribute opts[:href]}\">#{img}</a>" if opts[:href]
126:     img
127:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 246
246:   def inline_html(opts)
247:     if filter_html
248:       html_esc(opts[:text], :html_escape_preformatted)
249:     else
250:       "#{opts[:text]}" # nil-safe
251:     end
252:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 54
54:   def li_close(opts=nil)
55:     "</li>\n"
56:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 50
50:   def li_open(opts)
51:     "#{"\t" * opts[:nest]}<li#{pba(opts)}>#{opts[:text]}"
52:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 113
113:   def link(opts)
114:     if (filter_html || sanitize_html) && opts[:href] =~ /^\s*javascript:/
115:       opts[:name]
116:     else
117:       "<a href=\"#{escape_attribute opts[:href]}\"#{pba(opts)}>#{opts[:name]}</a>"
118:     end
119:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 204
204:   def lt(opts)
205:     "&lt;"
206:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 153
153:   def multi_paragraph_quote(opts)
154:     "&#8220;#{opts[:text]}"
155:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 238
238:   def notextile(opts)
239:     if filter_html
240:       html_esc(opts[:text], :html_escape_preformatted)
241:     else
242:       opts[:text]
243:     end
244:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 216
216:   def quot(opts)
217:     "&quot;"
218:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 145
145:   def quote1(opts)
146:     "&#8216;#{opts[:text]}&#8217;"
147:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 149
149:   def quote2(opts)
150:     "&#8220;#{opts[:text]}&#8221;"
151:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 184
184:   def registered(opts)
185:     "&#174;"
186:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 141
141:   def snip(opts)
142:     "<pre#{pba(opts)}><code>#{opts[:text]}</code></pre>\n"
143:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 220
220:   def squot(opts)
221:     "&#8217;"
222:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 90
90:   def table_close(opts)
91:     "</table>\n"
92:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 86
86:   def table_open(opts)
87:     "<table#{pba(opts)}>\n"
88:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 73
73:   def td(opts)
74:     tdtype = opts[:th] ? 'th' : 'td'
75:     "\t\t<#{tdtype}#{pba(opts)}>#{opts[:text]}</#{tdtype}>\n"
76:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 82
82:   def tr_close(opts)
83:     "\t</tr>\n"
84:   end

[Source]

    # File lib/redcloth/formatters/html.rb, line 78
78:   def tr_open(opts)
79:     "\t<tr#{pba(opts)}>\n"
80:   end

[Source]

     # File lib/redcloth/formatters/html.rb, line 180
180:   def trademark(opts)
181:     "&#8482;"
182:   end

[Validate]