lib/stepmod/utils/converters/strong.rb in stepmod-utils-0.4.14 vs lib/stepmod/utils/converters/strong.rb in stepmod-utils-0.5.0

- old
+ new

@@ -13,25 +13,26 @@ private def bold_converted(node, state) cloned_node = node.clone equations = extract_equations(cloned_node) - content = treat_children(cloned_node, state.merge(already_strong: true)) + content = treat_children(cloned_node, + state.merge(already_strong: true)) equation_content = equations.map do |equation| treat(equation, state.merge(equation: true, already_strong: true)) end content = if state[:equation] && state[:convert_bold_and_italics] - "bb(#{content.strip})" - elsif content.strip.empty? || state[:already_strong] || state[:equation] - content - else - strong_tag = state[:non_flanking_whitesapce] ? '**' : '*' - handle_express_escape_seq( - node, - "#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}" - ) - end + "bb(#{content.strip})" + elsif content.strip.empty? || state[:already_strong] || state[:equation] + content + else + strong_tag = state[:non_flanking_whitesapce] ? "**" : "*" + handle_express_escape_seq( + node, + "#{content[/^\s*/]}#{strong_tag}#{content.strip}#{strong_tag}#{content[/\s*$/]}", + ) + end [content, equation_content].compact.join("") end def extract_equations(node)