From 93308a6a6decab0ca708bdd893d2c5eecdf5fb2f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 08:59:09 -0500 Subject: v3 (v2): manpage, param, urls: manpage output presentation fixes * manpage: lowercase .br; correct newlines before .nf and after .fi; no escape of hyphens; remove redundant links; endnotes array requires flatten; screen info on output path) * param: manpage header .br and no escape of hyphens * urls: correct output path for manpage --- lib/sisu/v3/manpage.rb | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'lib/sisu/v3/manpage.rb') diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index e4cb6906..362d9cda 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -84,10 +84,10 @@ module SiSU_Manpage @env=SiSU_Env::Info_env.new(@opt.fns) path=@env.path.output_tell tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.text_editor} #{path}/man/#{@md.fn[:manpage]}" \ + ? "#{@env.program.text_editor} #{@md.file.output_path.manpage}/#{@md.file.base_filename.manpage}" \ : '' SiSU_Screen::Ansi.new(@opt.cmd,'Manpage',tool).green_hi_blue unless @opt.cmd =~/q/ - SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/man/#{@md.fn[:manpage]}").flow if @opt.cmd =~/[MV]/ + SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@md.file.output_path.manpage}/#{@md.file.base_filename.manpage}").flow if @opt.cmd =~/[MV]/ @dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here SiSU_Manpage::Source::Scroll.new(@md,@dal_array).songsheet SiSU_Env::Info_skin.new(@md).select #watch @@ -118,7 +118,7 @@ module SiSU_Manpage def extract_endnotes(para='') notes=para.scan(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})([\d*+]+\s+.+?)\s*(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m) @n=[] - notes.each do |n| #high cost to deal with
appropriately within manpage, consider + notes.flatten.each do |n| #high cost to deal with
appropriately within manpage, consider n=n.dup.to_s if n =~/#{Mx[:br_line]}/ fix = n.split(/\s*#{Mx[:br_line]}+\s*/) #watch #added @@ -151,7 +151,7 @@ GSUB ) end @@endnotes[:para] << wrap - @@endnotes[:end] << wrap << "\n.BR" + @@endnotes[:end] << wrap << "\n.br" @@endnotes end end @@ -175,16 +175,6 @@ Other versions of this document: .TP manifest: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}> .TP -html: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:toc]}> -.TP -epub: <#{vz.url_root_http}/epub/#{@md.fnb}.epub> -.TP -pdf: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_p]}> -.TP -pdf: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:pdf_l]}> -.\" .TP -.\" manpage: #{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manpage]} -.TP at: <#{vz.url_site}> .TP #{sc} @@ -230,16 +220,16 @@ WOK times=wrapped.length times=78 if times > 78 @manpage[:body] << case lv - when 1; '.SH ' << @br << wrapped.upcase << @br << '.BR' - when 2..3; '.SH ' << @br << wrapped.upcase << @br << '.BR' - when 4; '.SH ' << @br << wrapped.upcase << @br << '.BR' - when 5..6; '.SH ' << @br << wrapped.upcase << @br + when 1; '.SH ' << wrapped.upcase << @br << '.br' + when 2..3; '.SH ' << wrapped.upcase << @br << '.br' + when 4; '.SH ' << wrapped.upcase << @br << '.br' + when 5..6; '.SH ' << wrapped.upcase << @br end else @manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP '.TP' << @br << wrapped.gsub!(/^\.BI\s/,'.B ') # sleight ... simpler output else - '.BR' << @br << wrapped + '.br' << @br << wrapped end end if @@endnotes[:para] \ @@ -296,7 +286,8 @@ WOK dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') else - dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n") # watch + dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") # watch + #dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n") # watch end dob.obj.gsub!(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires dob.obj.gsub!(/┆/,'|') @@ -307,12 +298,12 @@ WOK if dob.is =='code' dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< - dob.obj.gsub!(/\A(.+)?\Z/m,"\n\n.nf\n\n\\1\n\n.fi\n\n") #dob.obj.gsub!(/\A/,"\n\n.nf\n\n"); #dob.obj.gsub!(/\Z/,"\n\n.fi\n\n") #bug, .fi repeats + dob.obj.gsub!(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi") end else dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") #unless para =~/#{Mx[:lv_o]}\d:/ #watch introduces a bug end - dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n\n.BR\n\n") # watch + dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/,"\n\n.br\n\n") # watch blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/) blit_array=[] blit.each do |x| -- cgit v1.2.3