Class: ReverseMarkdown::Converters::Base
- Inherits:
-
Object
- Object
- ReverseMarkdown::Converters::Base
show all
- Defined in:
- lib/reverse_markdown/converters/base.rb
Direct Known Subclasses
A, Blockquote, Br, Bypass, Code, Del, Details, Div, Drop, Em, FigCaption, Figure, H, Hr, Iframe, Ignore, Img, Li, Ol, P, PassThrough, Pre, Strong, Table, Td, Text, Tr
Instance Method Summary
collapse
Instance Method Details
#escape_keychars(string) ⇒ Object
14
15
16
|
# File 'lib/reverse_markdown/converters/base.rb', line 14
def escape_keychars(string)
string.gsub(/(?<!\\)[*_]/, '*' => '\*', '_' => '\_')
end
|
23
24
25
|
# File 'lib/reverse_markdown/converters/base.rb', line 23
def (node)
node['src'].to_s.empty? ? '' : node['src'].to_s
end
|
18
19
20
21
|
# File 'lib/reverse_markdown/converters/base.rb', line 18
def (node)
title = escape_keychars(node['title'].to_s)
title.empty? ? '' : %[ "#{title}"]
end
|
#treat(node, state) ⇒ Object
10
11
12
|
# File 'lib/reverse_markdown/converters/base.rb', line 10
def treat(node, state)
ReverseMarkdown::Converters.lookup(node.name).convert(node, state)
end
|
#treat_children(node, state) ⇒ Object
4
5
6
7
8
|
# File 'lib/reverse_markdown/converters/base.rb', line 4
def treat_children(node, state)
node.children.inject(+'') do |memo, child|
memo << treat(child, state)
end
end
|