lib/md2man/roff.rb in md2man-1.0.1 vs lib/md2man/roff.rb in md2man-1.0.2

- old
+ new

@@ -49,11 +49,11 @@ def block_code code, language "\n.nf\n#{code.chomp}\n.fi\n" end def block_quote quote - "\n.RS\n#{quote.sub(/\n\.PP\n/, '').chomp}\n.RE\n" + "\n.RS\n#{remove_leading_pp(quote).chomp}\n.RE\n" end def block_html html warn "md2man/roff: block_html not implemented: #{html.inspect}" end @@ -91,11 +91,11 @@ "\\n+[step#{@ordered_list_id}]" when :unordered "\\(bu 2" end - ".IP #{designator}\n#{text.sub(/\A\n\.PP\n/, '').lstrip.chomp}\n" + ".IP #{designator}\n#{remove_leading_pp(text).lstrip.chomp}\n" end def table header, body head_rows = decode_table_rows(header) body_rows = decode_table_rows(body) @@ -201,10 +201,14 @@ end end private + def remove_leading_pp text + text.sub(/\A\n\.PP\n/, '') + end + TABLE_COL_DELIM = ' ' TABLE_ROW_DELIM = "\n" TABLE_CELL_DELIM = "\t" def decode_table_rows rows @@ -499,11 +503,11 @@ '◊' => 0x25ca, '♠' => 0x2660, '♣' => 0x2663, '♥' => 0x2665, '♦' => 0x2666, - }.freeze + } # see groff_char(7) and "Special Characters" in groff(7) UNICODE_TO_GLYPH = { 0x0022 => "\\[dq]", 0x0023 => "\\[sh]", @@ -843,9 +847,9 @@ 0x2665 => "\\[HE]", 0x2666 => "\\[DI]", 0x2713 => "\\[OK]", 0x27e8 => "\\[la]", 0x27e9 => "\\[ra]", - }.freeze + } end end