test/md2man/roff_test.rb in md2man-1.6.2 vs test/md2man/roff_test.rb in md2man-2.0.0
- old
+ new
@@ -5,15 +5,15 @@
# http://serverfault.com/questions/109490/how-do-i-write-man-pages
# man groff_man
# man 7 groff
require 'test_helper'
-require 'md2man/engine'
+require 'md2man/roff/engine'
describe 'roff engine' do
before do
- @markdown = Md2Man::ENGINE
+ @markdown = Md2Man::Roff::ENGINE
end
SPACE = 0x20.chr
def heredoc document
@@ -677,10 +677,30 @@
|Pipe\t$1
|.TE
OUTPUT
end
+ it 'does not break surrounding Markdown while processing references' do
+ @markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
+ |For example, the `printf(3)` cross reference would be emitted as this HTML:
+ |
+ | <a class="md2man-xref" href="../man3/printf.3.html">printf(3)</a>
+ INPUT
+ |.PP
+ |For example, the \\fB\\fC
+ |.BR printf (3)\\fR#{SPACE}
+ |cross reference would be emitted as this HTML:
+ |.PP
+ |.RS
+ |.nf
+ |<a class="md2man-xref" href="../man3/printf.3.html">
+ |.BR printf (3)</a>
+ |.fi
+ |.RE
+ OUTPUT
+ end
+
it 'renders references to other man pages as hyperlinks' do
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|convert them from markdown(7) into roff(7), using
INPUT
|.PP
@@ -690,32 +710,51 @@
|.BR roff (7),#{SPACE}
|using
OUTPUT
end
- it 'does not render references inside code blocks' do
+ it 'renders references inside code blocks' do
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
| this is a code block
| containing markdown(7),
| roff(7), and much more!
INPUT
|.PP
|.RS
|.nf
|this is a code block
- |containing markdown(7),
- |roff(7), and much more!
+ |containing#{SPACE}
+ |.BR markdown (7),
+ |.BR roff (7),#{SPACE}
+ |and much more!
|.fi
|.RE
OUTPUT
end
- it 'does not render references inside code spans' do
+ it 'renders references inside code spans' do
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|this is a code span `containing markdown(7), roff(7), and` much more!
INPUT
|.PP
- |this is a code span \\fB\\fCcontaining markdown(7), roff(7), and\\fR much more!
+ |this is a code span \\fB\\fCcontaining#{SPACE}
+ |.BR markdown (7),#{SPACE}
+ |.BR roff (7),#{SPACE}
+ |and\\fR much more!
+ OUTPUT
+ end
+
+ it 'renders references inside image descriptions' do
+ @markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
+ |
+ INPUT
+ |.PP
+ |[Obligatory screenshot of#{SPACE}
+ |.BR md2man-roff (1)#{SPACE}
+ |in action!](
+ |.UR https://raw.github.com/sunaku/md2man/master/EXAMPLE.png
+ |.UE )
OUTPUT
end
it 'renders references to manual pages present on my linux box' do
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))