Module: RedCloth::Formatters::HTML

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

### Methods

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

### Included Modules

RedCloth::Formatters::Base 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
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

acronym(opts)

[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

acronym(opts)

[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

amp(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 192
    192:   def amp(opts)
    193:     "&amp;"
    194:   end

amp(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 192
    192:   def amp(opts)
    193:     "&amp;"
    194:   end

apos(opts)

[Source]

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

apos(opts)

[Source]

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

arrow(opts)

[Source]

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

arrow(opts)

[Source]

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

bc_close(opts)

[Source]

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

bc_close(opts)

[Source]

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

bc_open(opts)

[Source]

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

bc_open(opts)

[Source]

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

bq_close(opts)

[Source]

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

bq_close(opts)

[Source]

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

bq_open(opts)

[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

bq_open(opts)

[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

br(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 204
    204:   def br(opts)
    205:     if hard_breaks == false
    206:       "\n"
    207:     else
    208:       "<br />\n"
    209:     end
    210:   end

br(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 204
    204:   def br(opts)
    205:     if hard_breaks == false
    206:       "\n"
    207:     else
    208:       "<br />\n"
    209:     end
    210:   end

caps(opts)

[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

caps(opts)

[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

copyright(opts)

[Source]

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

copyright(opts)

[Source]

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

del(opts)

[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

del(opts)

[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

dim(opts)

[Source]

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

dim(opts)

[Source]

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

dl_close(opts=nil)

[Source]

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

dl_close(opts=nil)

[Source]

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

dl_open(opts)

[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

dl_open(opts)

[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

ellipsis(opts)

[Source]

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

ellipsis(opts)

[Source]

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

emdash(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 157
    157:   def emdash(opts)
    158:     "&#8212;"
    159:   end

emdash(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 157
    157:   def emdash(opts)
    158:     "&#8212;"
    159:   end

endash(opts)

[Source]

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

endash(opts)

[Source]

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

entity(opts)

[Source]

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

entity(opts)

[Source]

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

fn(opts)

[Source]

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

fn(opts)

[Source]

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

footno(opts)

[Source]

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

footno(opts)

[Source]

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

gt(opts)

[Source]

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

gt(opts)

[Source]

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

hr(opts)

[Source]

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

hr(opts)

[Source]

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

html(opts)

[Source]

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

html(opts)

[Source]

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

html_block(opts)

[Source]

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

html_block(opts)

[Source]

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

ignored_line(opts)

[Source]

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

ignored_line(opts)

[Source]

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

image(opts)

[Source]

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

image(opts)

[Source]

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

inline_html(opts)

[Source]

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

inline_html(opts)

[Source]

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

li_close(opts=nil)

[Source]

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

li_close(opts=nil)

[Source]

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

li_open(opts)

[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

li_open(opts)

[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

link(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 113
    113:   def link(opts)
    114:     "<a href=\"#{escape_attribute opts[:href]}\"#{pba(opts)}>#{opts[:name]}</a>"
    115:   end

link(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 113
    113:   def link(opts)
    114:     "<a href=\"#{escape_attribute opts[:href]}\"#{pba(opts)}>#{opts[:name]}</a>"
    115:   end

lt(opts)

[Source]

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

lt(opts)

[Source]

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

multi_paragraph_quote(opts)

[Source]

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

multi_paragraph_quote(opts)

[Source]

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

notextile(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 234
    234:   def notextile(opts)
    235:     if filter_html
    236:       html_esc(opts[:text], :html_escape_preformatted)
    237:     else
    238:       opts[:text]
    239:     end
    240:   end

notextile(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 234
    234:   def notextile(opts)
    235:     if filter_html
    236:       html_esc(opts[:text], :html_escape_preformatted)
    237:     else
    238:       opts[:text]
    239:     end
    240:   end

quot(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 212
    212:   def quot(opts)
    213:     "&quot;"
    214:   end

quot(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 212
    212:   def quot(opts)
    213:     "&quot;"
    214:   end

quote1(opts)

[Source]

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

quote1(opts)

[Source]

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

quote2(opts)

[Source]

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

quote2(opts)

[Source]

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

registered(opts)

[Source]

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

registered(opts)

[Source]

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

snip(opts)

[Source]

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

snip(opts)

[Source]

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

squot(opts)

[Source]

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

squot(opts)

[Source]

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

table_close(opts)

[Source]

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

table_close(opts)

[Source]

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

table_open(opts)

[Source]

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

table_open(opts)

[Source]

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

td(opts)

[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

td(opts)

[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

tr_close(opts)

[Source]

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

tr_close(opts)

[Source]

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

tr_open(opts)

[Source]

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

tr_open(opts)

[Source]

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

trademark(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 176
    176:   def trademark(opts)
    177:     "&#8482;"
    178:   end

trademark(opts)

[Source]

         # File lib/redcloth/formatters/html.rb, line 176
    176:   def trademark(opts)
    177:     "&#8482;"
    178:   end

[Validate]