diff --git a/lib/md2man/roff.rb b/lib/md2man/roff.rb index 953dd97..2c41dc5 100644 --- a/lib/md2man/roff.rb +++ b/lib/md2man/roff.rb @@ -42,7 +42,7 @@ def normal_paragraph text end def block_code code, language - code = escape_backslashes(code) + code = escape_macro escape_backslashes(code) block_quote "\n.nf\n#{code.chomp}\n.fi\n" end @@ -220,6 +220,10 @@ def entity text private + def escape_macro text + text.gsub(/^\./, '\\\\&.') + end + def escape_backslashes text text.gsub(/\\/, '\&\&') end