Class: Stepmod::Utils::Converters::Strong

Inherits:
ReverseAdoc::Converters::Base
  • Object
show all
Defined in:
lib/stepmod/utils/converters/strong.rb

Constant Summary collapse

BLANK_CHARS =
"{blank}"

Instance Method Summary collapse

Instance Method Details

#convert(node, state = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/stepmod/utils/converters/strong.rb', line 9

def convert(node, state = {})
  content = treat_children(node, state.merge(already_strong: true))
  strong_tag = state[:non_flanking_whitesapce] ? '**' : '*'
  if content.strip.empty? || state[:already_strong]
    content
  else
    handle_express_escape_seq(
      node,
      "#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}"
    )
  end
end