Class: JsDuck::Util::HTML

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

Overview

Helpers for dealing with HTML

Class Method Summary collapse

Class Method Details

.escape(html) ⇒ Object

Escapes HTML, replacing < with &lt; …



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

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

.strip_tags(html) ⇒ Object

Strips tags from HTML text



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

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

.unescape(html) ⇒ Object

Unescapes HTML, replacing &lt; with < …



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

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