test/md2man/roff_test.rb in md2man-1.3.1 vs test/md2man/roff_test.rb in md2man-1.3.2
- old
+ new
@@ -345,15 +345,51 @@
|.fi
|.RE
OUTPUT
end
+ it 'escapes backslashes inside code blocks' do
+ # NOTE: we have to escape backslashes in the INPUT to
+ # prevent Ruby from interpreting them as escapes
+ @markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
+ | _______ _______
+ | ___ /___________ /__
+ | _ __/ __ \\ __/ /_/
+ | / /_/ /_/ / / / ,\\
+ | \\__/\\____/_/ /_/|_\\
+ | >>>------>
+ INPUT
+ |.PP
+ |.RS
+ |.nf
+ |_______ _______
+ | ___ /___________ /__
+ | _ __/ __ \\\\ __/ /_/
+ | / /_/ /_/ / / / ,\\\\
+ | \\\\__/\\\\____/_/ /_/|_\\\\
+ | >>>------>
+ |.fi
+ |.RE
+ OUTPUT
+ end
+
it 'renders code spans' do
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|here is `some code` for you
INPUT
|.PP
|here is \\fB\\fCsome code\\fR for you
+ OUTPUT
+ end
+
+ it 'escapes backslashes inside code spans' do
+ # NOTE: we have to escape backslashes in the INPUT to
+ # prevent Ruby from interpreting them as escapes
+ @markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
+ |here is `so\\m\\e \\c\\ode` for you
+ INPUT
+ |.PP
+ |here is \\fB\\fCso\\\\m\\\\e \\\\c\\\\ode\\fR for you
OUTPUT
end
it 'renders hyperlinks' do
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))