Sha256: 10bb43522218dfb39b038efa3fcabc7f8a1ed52288912be3e10f1686105d02cb
Contents?: true
Size: 490 Bytes
Versions: 3
Compression:
Stored size: 490 Bytes
Contents
module ReverseMarkdown module Converters class Em < Base def convert(node) content = treat_children(node) if content.strip.empty? || already_italic?(node) content else "#{content[/^\s*/]}_#{content.strip}_#{content[/\s*$/]}" end end def already_italic?(node) node.ancestors('italic').size > 0 || node.ancestors('em').size > 0 end end register :em, Em.new register :i, Em.new end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reverse_markdown-0.8.2 | lib/reverse_markdown/converters/em.rb |
reverse_markdown-0.8.1 | lib/reverse_markdown/converters/em.rb |
reverse_markdown-0.8.0 | lib/reverse_markdown/converters/em.rb |