lib/md2man/roff.rb in md2man-1.1.0 vs lib/md2man/roff.rb in md2man-1.2.0
- old
+ new
@@ -27,25 +27,19 @@
#---------------------------------------------------------------------------
# block-level processing
#---------------------------------------------------------------------------
- PARAGRAPH_INDENT = /^\s*$|^ (?=\S)/
+ def indented_paragraph text
+ "\n.IP\n#{text}\n"
+ end
- def paragraph text
- head, *body = text.lines.to_a
- head_indented = head =~ PARAGRAPH_INDENT
- body_indented = !body.empty? && body.all? {|s| s =~ PARAGRAPH_INDENT }
+ def tagged_paragraph text
+ "\n.TP\n#{text}\n"
+ end
- if head_indented || body_indented
- macro = if head_indented && body_indented then :IP else :TP end
- text.gsub! PARAGRAPH_INDENT, ''
- else
- macro = :PP
- text.chomp!
- end
-
- "\n.#{macro}\n#{text}\n"
+ def normal_paragraph text
+ "\n.PP\n#{text}\n"
end
def block_code code, language
"\n.nf\n#{code.chomp}\n.fi\n"
end