Class: Usertext

Inherits:
Object
  • Object
show all
Defined in:
lib/usertext.rb

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Usertext

Returns a new instance of Usertext.



4
5
6
# File 'lib/usertext.rb', line 4

def initialize(text)
  @string = text
end

Instance Method Details

#to_htmlObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/usertext.rb', line 8

def to_html
  html = @string

  html = html.to_s
  html = cleanup_newlines(html)
  
  # Character level markup
  html = replace_typography(html)
  html = insert_currency_symbols(html)
  html = insert_fraction_symbols(html)
  html = insert_roman_numerals(html)
  html = insert_smileys(html)
  html = insert_copyright_symbols(html)
  
  # Block level markup
  html = html_escape(html)
  html = mark_code(html)
  html = auto_link(html)
  html = auto_link_phone_numbers(html)
  html = block_element_markup(html)

  return html
end