Class: JsDuck::HTML

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

Overview

Helpers for dealing with HTML

Class Method Summary collapse

Class Method Details

.escape(html) ⇒ Object

Escapes HTML, replacing < with &lt; …



14
15
16
# File 'lib/jsduck/html.rb', line 14

def self.escape(html)
  CGI.escapeHTML(html)
end

.strip_tags(html) ⇒ Object

Strips tags from HTML text



9
10
11
# File 'lib/jsduck/html.rb', line 9

def self.strip_tags(html)
  html.gsub(/<.*?>/, "")
end

.unescape(html) ⇒ Object

Unescapes HTML, replacing &lt; with < …



19
20
21
# File 'lib/jsduck/html.rb', line 19

def self.unescape(html)
  CGI.unescapeHTML(html)
end