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/v2/manpage.rb | 26 ++++++++------------------ lib/sisu/v2/param.rb | 12 +++++------- lib/sisu/v3/manpage.rb | 35 +++++++++++++---------------------- lib/sisu/v3/param.rb | 10 ++++------ lib/sisu/v3/urls.rb | 2 +- 5 files changed, 31 insertions(+), 54 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/manpage.rb b/lib/sisu/v2/manpage.rb index 18670e2a..a040f1a0 100644 --- a/lib/sisu/v2/manpage.rb +++ b/lib/sisu/v2/manpage.rb @@ -152,7 +152,7 @@ GSUB ) end @@endnotes[:para] << wrap - @@endnotes[:end] << wrap << "\n.BR" + @@endnotes[:end] << wrap << "\n.br" @@endnotes end end @@ -176,16 +176,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} @@ -231,16 +221,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] \ @@ -308,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| diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 207154b0..655177a7 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -7,7 +7,7 @@ * Author: Ralph Amissah - * Copyright: (C) 1997 - 2010, Ralph Amissah, All Rights Reserved. + * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved. * License: GPL 3 or later: @@ -732,16 +732,14 @@ module SiSU_Param end end if manpage['name'] - manpage['name']=manpage['name'].join("\n.BR\n") - manpage['name'].gsub!(/(-)/m,"\\\\\\1") - manpage['name'].gsub!(/\A/,"\n.SH NAME\n") + manpage['name']=manpage['name'].join("\n.br\n") + manpage['name'].gsub!(/\A/,"\n.br\n.SH NAME\n.br\n") else manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]' end if manpage['synopsis'] - manpage['synopsis']=manpage['synopsis'].join("\n\n.BR\n") - manpage['synopsis'].gsub!(/(-)/m,"\\\\\\1") - manpage['synopsis'].gsub!(/\A/,"\n.SH SYNOPSIS\n") + manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n") + manpage['synopsis'].gsub!(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n") else manpage['synopsis']='' end 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| diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 9dfbc70f..8ae87010 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -743,16 +743,14 @@ module SiSU_Param end end if manpage['name'] - manpage['name']=manpage['name'].join("\n.BR\n") - manpage['name'].gsub!(/(-)/m,"\\\\\\1") - manpage['name'].gsub!(/\A/,"\n.SH NAME\n") + manpage['name']=manpage['name'].join("\n.br\n") + manpage['name'].gsub!(/\A/,"\n.br\n.SH NAME\n.br\n") else manpage['name']='man page "name/whatis" information not provided, set in header @man: name=[whatis information]' end if manpage['synopsis'] - manpage['synopsis']=manpage['synopsis'].join("\n\n.BR\n") - manpage['synopsis'].gsub!(/(-)/m,"\\\\\\1") - manpage['synopsis'].gsub!(/\A/,"\n.SH SYNOPSIS\n") + manpage['synopsis']=manpage['synopsis'].join("\n\n.br\n") + manpage['synopsis'].gsub!(/\A/,"\n.br\n.SH SYNOPSIS\n.br\n") else manpage['synopsis']='' end diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 127a17c2..900d9849 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -230,7 +230,7 @@ module SiSU_urls end if x=~/^i/ \ and @opt.cmd =~/i/ - SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@env.processing_path.manpage}/#{@fnb}.1").result + SiSU_Screen::Ansi.new(@opt.cmd,"-#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage}/#{@md.file.base_filename.manpage}").result end if x=~/^N/ \ and @opt.cmd =~/N/ -- cgit v1.2.3