Class: Gmi2html::NodeRenderers::Base
- Inherits:
-
Object
- Object
- Gmi2html::NodeRenderers::Base
show all
- Defined in:
- lib/gmi2html/node_renderers/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(node) ⇒ Base
Returns a new instance of Base.
29
30
31
|
# File 'lib/gmi2html/node_renderers/base.rb', line 29
def initialize(node)
@node = node
end
|
Class Method Details
.for_gemtext(gemtext_node) ⇒ Object
15
16
17
|
# File 'lib/gmi2html/node_renderers/base.rb', line 15
def for_gemtext(gemtext_node)
klass_for_gemtext_node(gemtext_node).new gemtext_node
end
|
Instance Method Details
#content ⇒ Object
41
42
43
|
# File 'lib/gmi2html/node_renderers/base.rb', line 41
def content
@node.content
end
|
#escaped_content ⇒ Object
45
46
47
|
# File 'lib/gmi2html/node_renderers/base.rb', line 45
def escaped_content
CGI.escapeHTML(content)
end
|
#render(_prev_node = nil, _next_node = nil) ⇒ Object
33
34
35
|
# File 'lib/gmi2html/node_renderers/base.rb', line 33
def render(_prev_node = nil, _next_node = nil)
"<#{tag}>#{escaped_content}</#{tag}>\n"
end
|
#to_s ⇒ Object
37
38
39
|
# File 'lib/gmi2html/node_renderers/base.rb', line 37
def to_s
render
end
|