diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-06-26 15:24:48 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-06-26 22:40:12 -0400 |
commit | def544be45f5961df774b517542934b92141fc66 (patch) | |
tree | ab9f130dad2affc4ea03a6cb0e0efa11bbee1ec6 /lib | |
parent | v3: html_tune, reduce loops; deal with angle-brackets (diff) |
v3: manpage (sysenv), move output; line-breaks within object
* start to honor line-breaks within objects (revisit)
* show double escape \\ (backslashes) in code blocks
* place under web server directory
* sysenv, accommodate manpage changes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/manpage.rb | 31 | ||||
-rw-r--r-- | lib/sisu/v3/sysenv.rb | 23 |
2 files changed, 30 insertions, 24 deletions
diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index 00515e7f..0a2c2fcc 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -266,14 +266,14 @@ WOK dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--') dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\1') - dob.obj.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") - dob.obj.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") - dob.obj.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1#{Mx[:br_line]}") - dob.obj.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}") - dob.obj.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") + dob.obj.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") + dob.obj.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}([,.:!?](?: |$))?/m,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") + dob.obj.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1\\2#{Mx[:br_line]}") + dob.obj.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.B \\1\\2#{Mx[:br_line]}") + dob.obj.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") unless dob.is=='code' - dob.obj.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}") - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}") + dob.obj.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") + dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") @manpage[:endnotes]=extract_endnotes(dob.obj) dob.obj.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up dob.obj.gsub!(/#{Mx[:en_b_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_b_c]}/m,'[^\1]') # endnote marker marked up @@ -282,6 +282,7 @@ WOK dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') + dob.obj.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\e') dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') @@ -289,6 +290,7 @@ 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!(/\\/,'\e') 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 @@ -304,10 +306,9 @@ WOK dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< 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*/m,"\n.br\n") # watch + dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})+\s*/m,"\n\n") # watch blit=dob.obj.scan(/\[[^\]]+\]|[^\[]+/) blit_array=[] blit.each do |x| @@ -319,7 +320,7 @@ WOK end dob.obj=blit_array.join dob.obj.gsub!(/#{Mx[:gl_o]}:name#\S+?#{Mx[:gl_c]}/mi,'') #added - dob.obj.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution + #dob.obj.gsub!(/\s\\\s+(#{Mx[:br_line]}|#{Mx[:br_nl]})/,'\1') #a messy solution dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1\2') dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') @@ -358,12 +359,14 @@ WOK end if dob.obj dob.obj.gsub!(/\s(\[)/m,' \ \1') - dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})/,"\n\n") + dob.obj.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,"\n\n") # watch dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{') dob.obj.gsub!(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ') - dob.obj.gsub!(/<!.+!>/,' ') - dob.obj.gsub!(/<:\S+>/,' ') + unless dob.is =='code' + dob.obj.gsub!(/<!.+!>/,' ') + dob.obj.gsub!(/<:\S+>/,' ') + end end dob end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index d0c88deb..5134b6c2 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3457,6 +3457,15 @@ WOK end self end + def manpage + def dir + output_path.manpage.dir + '/' + base_filename.manpage + end + def rel + output_path.manpage.rel + '/' + base_filename.manpage + end + self + end def manifest def dir output_path.manifest.dir + '/' + base_filename.manifest @@ -3614,11 +3623,11 @@ WOK pdf_l + @md.fn[:pdf_l_legal] end def manpage - ft='.1' + ft='1' if @env.output_dir_structure.by_language_code? - @md.fnb + ft + @md.fnb + '.' + ft else - @md.fnb + @md.lang_code_insert + ft + @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft end end def hash_digest @@ -4224,13 +4233,7 @@ WOK set_path(ft).rcp.ab end def rel_sm - if @env.output_dir_structure.by_language_code? - '' - elsif @env.output_dir_structure.by_filetype? - '' - else - '' - end + set_path(ft).rel_sm.ab end self end |