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

- old
+ new

@@ -1,8 +1,12 @@ +require 'md2man/document' + module Md2Man module Roff + include Document + #--------------------------------------------------------------------------- # document-level processing #--------------------------------------------------------------------------- def preprocess document @@ -10,18 +14,15 @@ @table_cells = {} document end def postprocess document - document.strip. + super.strip. # ensure that spaces after URLs appear properly gsub(/(?<=^\.[UM]E) \s/, "\n"). - # encode references to other man pages as "hyperlinks" - gsub(/(\S+)(\([1-9nol]\)[[:punct:]]?\s*)/, "\n.BR \\1 \\2\n"). - # squeeze blank lines to prevent double-spaced output gsub(/^\n/, '') end #--------------------------------------------------------------------------- @@ -127,9 +128,13 @@ end #--------------------------------------------------------------------------- # span-level processing #--------------------------------------------------------------------------- + + def reference page, section, addendum + "\n.BR #{page} (#{section})#{addendum}\n" + end def linebreak "\n.br\n" end