Class: Trenni::Sanitize::Text
- Inherits:
-
Filter
- Object
- Filter
- Trenni::Sanitize::Text
show all
- Defined in:
- lib/trenni/sanitize/text.rb
Constant Summary
collapse
- CLOSING =
{
"p" => "\n\n",
"div" => "\n\n",
}
Constants inherited
from Filter
Filter::ALL, Filter::CDATA, Filter::COMMENT, Filter::CONTENT, Filter::DOCTYPE, Filter::INSTRUCTION, Filter::TAG, Filter::TEXT
Instance Attribute Summary
Attributes inherited from Filter
#current, #output, #stack
Instance Method Summary
collapse
Methods inherited from Filter
#attribute, #initialize, #open_tag_begin, #open_tag_end, parse, #parse!, #parse_begin, #parse_end, #text, #top
Instance Method Details
#cdata(string) ⇒ Object
60
61
|
# File 'lib/trenni/sanitize/text.rb', line 60
def cdata(string)
end
|
#close_tag(name, offset = nil) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/trenni/sanitize/text.rb', line 43
def close_tag(name, offset = nil)
super
if value = CLOSING[name]
text(value)
end
end
|
54
55
|
# File 'lib/trenni/sanitize/text.rb', line 54
def (string)
end
|
#doctype(string) ⇒ Object
51
52
|
# File 'lib/trenni/sanitize/text.rb', line 51
def doctype(string)
end
|
#filter(node) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/trenni/sanitize/text.rb', line 31
def filter(node)
if node.name == "br"
text("\n\n")
end
if node.name == 'script'
node.skip!(ALL) else
node.skip!(TAG) end
end
|
#instruction(string) ⇒ Object
57
58
|
# File 'lib/trenni/sanitize/text.rb', line 57
def instruction(string)
end
|