class Asciidoctor::Converter::ManPageConverter

def append_footnotes result, node

def append_footnotes result, node
  if node.footnotes? && !(node.attr? 'nofootnotes')
    result << '.SH "NOTES"'
    node.footnotes.each_with_index do |fn, idx|
      result << %(.IP [#{fn.index}])
      # NOTE restore newline in escaped macro that gets removed by normalize_text in substitutor
      if (text = fn.text).include? %(#{ESC}\\c #{ESC}.)
        text = (manify %(#{text.gsub MalformedEscapedMacroRx, %(\\1#{LF}\\2)} ), whitespace: :normalize).chomp ' '
      else
        text = manify text, whitespace: :normalize
      end
      result << text
    end
  end
end