From 78170753d8682c8ea9ae5f75232951d5b8043803 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 08:26:36 -0500 Subject: v2, v3: texpdf, url (regex) pattern match fix --- lib/sisu/v2/texpdf_format.rb | 4 ++-- lib/sisu/v3/texpdf_format.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 732a903e..19e53d3b 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.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: @@ -970,7 +970,7 @@ WOK para_array=[] str=if word word.each do |w| # _ - / # | : ! ^ ~ - if w !~/http:/ \ + if w !~/https?:/ \ and w=~/\/\S+?\// \ and w.length > 6 w.gsub!(/([_.\/])/,'\1\-') diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index a1fb3e72..114c3cb6 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -972,7 +972,7 @@ WOK para_array=[] str=if word word.each do |w| # _ - / # | : ! ^ ~ - if w !~/http:/ \ + if w !~/https?:/ \ and w=~/\/\S+?\// \ and w.length > 6 w.gsub!(/([_.\/])/,'\1\-') -- cgit v1.2.3 From 755acef8c7673081e9fb946d789d394afaee68ee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 08:43:44 -0500 Subject: v2, v3: dal_syntax + downstream output, email regex revised * revised pattern match for email address, (removes occasional interference with urls having embedded email addresses) (dal_syntax and affected downstream output modules) --- lib/sisu/v2/dal_syntax.rb | 6 +++--- lib/sisu/v2/epub_tune.rb | 7 ++----- lib/sisu/v2/html_tune.rb | 7 ++----- lib/sisu/v2/odf.rb | 10 +++++----- lib/sisu/v2/shared_xml.rb | 2 ++ lib/sisu/v2/texpdf_format.rb | 2 ++ lib/sisu/v3/dal_syntax.rb | 4 ++-- lib/sisu/v3/epub_tune.rb | 5 +---- lib/sisu/v3/html_tune.rb | 5 +---- lib/sisu/v3/odf.rb | 12 ++++++------ lib/sisu/v3/shared_xml.rb | 2 ++ lib/sisu/v3/texpdf_format.rb | 2 ++ 12 files changed, 30 insertions(+), 34 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 47c7f8d0..55556371 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.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: @@ -327,7 +327,7 @@ module SiSU_Syntax else dob.obj.gsub!(/^\s*(?:(by\s+)?(?:@creator|@author))\s*$/,'\1') end end - dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup + dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup dob.obj.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30 dob.obj.gsub!(//,'<:\1>') #escaped special character dob.obj.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character @@ -398,6 +398,7 @@ module SiSU_Syntax "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3") #any remaining linked text or image dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image + dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}") dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image dob.obj.gsub!(/\{\s*(.+?)\s*\}#(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, @@ -409,7 +410,6 @@ module SiSU_Syntax elsif dob.is=='table' dob=fontface(dob) elsif dob.is =='code' -#p dob.obj dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ') dob.obj.gsub!(/([<>])/,'_\1') dob.obj.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy diff --git a/lib/sisu/v2/epub_tune.rb b/lib/sisu/v2/epub_tune.rb index 10583936..9c9223a0 100644 --- a/lib/sisu/v2/epub_tune.rb +++ b/lib/sisu/v2/epub_tune.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: @@ -349,11 +349,8 @@ module SiSU_EPUB_Tune dob.obj.gsub!(/!new/,%{ new}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'\1') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') - if dob.obj =~/\b\S+\@\S+?\.\S+/ \ - and dob.obj !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ - dob.obj.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ diff --git a/lib/sisu/v2/html_tune.rb b/lib/sisu/v2/html_tune.rb index 9d3dce0b..99ce1b0f 100644 --- a/lib/sisu/v2/html_tune.rb +++ b/lib/sisu/v2/html_tune.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: @@ -321,11 +321,8 @@ module SiSU_HTML_Tune dob.obj.gsub!(/!new/,%{ new}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'\1') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') - if dob.obj =~/\b\S+\@\S+?\.\S+/ \ - and dob.obj !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ - dob.obj.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index 2e2a88b4..b6ec4c1b 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.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: @@ -291,10 +291,10 @@ module SiSU_ODF def normal(dob) #P1 - P3 dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj= if dob.is=='para' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true %{#{dob.obj}} else %{#{dob.obj}} @@ -372,10 +372,10 @@ module SiSU_ODF parray=[] dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'') diff --git a/lib/sisu/v2/shared_xml.rb b/lib/sisu/v2/shared_xml.rb index 2fcab17e..e82f51bf 100644 --- a/lib/sisu/v2/shared_xml.rb +++ b/lib/sisu/v2/shared_xml.rb @@ -398,6 +398,8 @@ module SiSU_XML_munge if dob.of=='group' dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') end + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}") dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}") dob.obj.gsub!(/ |#{Mx[:nbsp]}/m,' ') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 19e53d3b..dbf0d095 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -65,6 +65,8 @@ module SiSU_TeX_Pdf @brace_url=SiSU_Viz::Skin.new.url_decoration end def bare_urls + @dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + "#{@brace_url.tex_open}\\1#{@brace_url.tex_close}") @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work @dob.tmp.gsub!(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m, "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}") diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 2de931f6..61253561 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -333,7 +333,7 @@ module SiSU_Syntax end end end - dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup + dob.obj.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup dob.obj.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30 dob.obj.gsub!(//,'<:\1>') #escaped special character dob.obj.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character @@ -404,6 +404,7 @@ module SiSU_Syntax "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3") #any remaining linked text or image dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:url_o]}\S+?#{Mx[:url_c]})/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image + dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}") dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image dob.obj.gsub!(/\{\s*(.+?)\s*\}#(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, @@ -415,7 +416,6 @@ module SiSU_Syntax elsif dob.is=='table' dob=fontface(dob) elsif dob.is =='code' -#p dob.obj dob.obj.gsub!(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: ') dob.obj.gsub!(/([<>])/,'_\1') dob.obj.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index 746a112e..19453fc8 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -347,11 +347,8 @@ module SiSU_EPUB_Tune dob.obj.gsub!(/!new/,%{ new}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'\1') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') - if dob.obj =~/\b\S+\@\S+?\.\S+/ \ - and dob.obj !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ - dob.obj.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration if dob.obj =~/..\/\S+/ \ and dob.obj !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb index 18b4576b..5bbcdf6c 100644 --- a/lib/sisu/v3/html_tune.rb +++ b/lib/sisu/v3/html_tune.rb @@ -319,11 +319,8 @@ module SiSU_HTML_Tune dob.obj.gsub!(/!new/,%{ new}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'\1') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'to { \1 } ') - if dob.obj =~/\b\S+\@\S+?\.\S+/ \ - and dob.obj !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/ - dob.obj.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration if dob.obj =~/#{Xx[:html_relative2]}\/\S+/ \ and dob.obj !~/(\"#{Xx[:html_relative2]}\/\S+?\"|>\s*#{Xx[:html_relative2]}\/\S+<)/ diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 204f0e50..c14a6c91 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -294,10 +294,10 @@ module SiSU_ODF def normal(dob,p_num='') #P1 - P3 dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj= if dob.is=='para' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true %{#{dob.obj}#{p_num}} else %{#{dob.obj}#{p_num}} @@ -377,10 +377,10 @@ module SiSU_ODF parray=[] dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'') @@ -400,10 +400,10 @@ module SiSU_ODF parray=[] dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) if dob.obj !~/https?:\/\// # improve upon, document crash where url contains '@' symbol dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| parablock=group_clean(parablock) parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'') diff --git a/lib/sisu/v3/shared_xml.rb b/lib/sisu/v3/shared_xml.rb index 06b89395..daf59a4c 100644 --- a/lib/sisu/v3/shared_xml.rb +++ b/lib/sisu/v3/shared_xml.rb @@ -398,6 +398,8 @@ module SiSU_XML_munge if dob.of=='block' dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') end + dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}") dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}") dob.obj.gsub!(/ |#{Mx[:nbsp]}/m,' ') diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 114c3cb6..a91095e8 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -65,6 +65,8 @@ module SiSU_TeX_Pdf @brace_url=SiSU_Viz::Skin.new.url_decoration end def bare_urls + @dob.obj.gsub!(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, + "#{@brace_url.tex_open}\\1#{@brace_url.tex_close}") @dob.tmp.gsub!(/(^|[^\\])_/m,'\1\_') #watch may not work @dob.tmp.gsub!(/(^|[^#{Mx[:lnk_c]}])#{Mx[:url_o]}_?(?:\\?_)?(\S+?)#{Mx[:url_c]}/m, "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}") -- cgit v1.2.3 From 259351d439d016ddb46e2dcb3356cfb9738d7bde Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 08:46:46 -0500 Subject: v2, v3: dal_syntax: (internal document) link matching, a fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Debian-live, live-manual (Jose Luis Zabalza, Ben Armstrong, reported bug in Spanish translation markup (that crashed the pdf generator). Bug in markup subsequently identified as "versátil,#{iso-hybrid}#, se" which the interpreter identified as an internal document link to a comma (instead of as being monospace markup), markup should have been "versátil, #{iso-hybrid}#, se" this fix prevents that incorrect match, (but the markup remains faulty and the monospace markup is not identified as such without the corrected spacing). Unfortunate "grave" results for what is a pretty insignificant data entry typo (there are no doubt other such situations).] --- lib/sisu/v2/dal_syntax.rb | 2 +- lib/sisu/v3/dal_syntax.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 55556371..76287464 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -401,7 +401,7 @@ module SiSU_Syntax dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}") dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image - dob.obj.gsub!(/\{\s*(.+?)\s*\}#(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + dob.obj.gsub!(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3") #any remaining linked text or image, check need dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image, check need diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 61253561..2f6353bc 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -407,7 +407,7 @@ module SiSU_Syntax dob.obj.gsub!(/(^|\s)([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,"\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}") dob.obj.gsub!(/(^|[ ])\{\s*(.+?)\s*\}(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4") #any remaining linked text or image - dob.obj.gsub!(/\{\s*(.+?)\s*\}#(\S+?)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, + dob.obj.gsub!(/\{\s*(.+?)\s*\}#([a-zA-Z0-9][a-zA-Z0-9_-]*)([;,.]?)(?=\s|[#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}]|$)/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}#{Mx[:rel_o]}\\2#{Mx[:rel_c]}\\3") #any remaining linked text or image, check need dob.obj.gsub!(/\{\s*(.+?)\s*\}(#{Mx[:rel_o]}\S+?#{Mx[:rel_c]})/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #any remaining linked text or image, check need -- cgit v1.2.3 From 63251bd46a2936a44b112c9f863c665f6bfe72b2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 08:50:17 -0500 Subject: v2, v3: dal_substitutions_and_insertions: sisu header matching in codeblock, fix --- lib/sisu/v2/dal_substitutions_and_insertions.rb | 6 +++--- lib/sisu/v3/dal_substitutions_and_insertions.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/dal_substitutions_and_insertions.rb b/lib/sisu/v2/dal_substitutions_and_insertions.rb index e1326232..c598b990 100644 --- a/lib/sisu/v2/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v2/dal_substitutions_and_insertions.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: @@ -144,8 +144,8 @@ module SiSU_substitute_and_insert para.gsub!(/^(:?A~)\s*$/,'\1~ @title @author') #conditional header para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 if para =~/^@\S+?:/ - para.gsub!(/^@(\S+?):\s+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}") - para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}") + para.gsub!(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2") + para.gsub!(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") end end end diff --git a/lib/sisu/v3/dal_substitutions_and_insertions.rb b/lib/sisu/v3/dal_substitutions_and_insertions.rb index 84b58756..cf3309ec 100644 --- a/lib/sisu/v3/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v3/dal_substitutions_and_insertions.rb @@ -144,8 +144,8 @@ module SiSU_substitute_and_insert para.gsub!(/^(:?A~)\s*$/,'\1~ @title @author') #conditional header para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 if para =~/^@\S+?:/ - para.gsub!(/^@(\S+?):\s+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}") - para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}") + para.gsub!(/^@(\S+?):(\s+|$)/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}\\2") + para.gsub!(/^@(\S+?):([+-])(\s+|$)/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}\\3") end end end -- cgit v1.2.3 From cbcf26cd1fcb5dd3f839a8b5de8caf441d957b5f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 08:53:34 -0500 Subject: v2, v3: dal_doc_str: fix, looks like typo in regex --- lib/sisu/v2/dal_doc_str.rb | 2 +- lib/sisu/v3/dal_doc_str.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb index bca3cf7d..56bf205f 100644 --- a/lib/sisu/v2/dal_doc_str.rb +++ b/lib/sisu/v2/dal_doc_str.rb @@ -330,7 +330,7 @@ module SiSU_document_structure_extract sub_array=t_o.dup + "#{Mx[:br_nl]}" @line_mode=sub_array.scan(/.+/) @line_mode=[] - sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\Ss]+/} + sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\S]+/} t_o=SiSU_document_structure_extract::Build.new(@md,@line_mode).build_lines('code').join @tuned_code << t_o t_o=nil diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index 365973eb..6ce77057 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -335,7 +335,7 @@ module SiSU_document_structure_extract sub_array=t_o.dup + "#{Mx[:br_nl]}" @line_mode=sub_array.scan(/.+/) @line_mode=[] - sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\Ss]+/} + sub_array.scan(/.+/) {|w| @line_mode << w if w =~/[\S]+/} t_o=SiSU_document_structure_extract::Build.new(@md,@line_mode).build_lines('code').join @tuned_code << t_o t_o=nil -- cgit v1.2.3 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 From e4ca6d0451ec7497b55af5ae30540dd4a1e724ca Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 10 Mar 2011 09:01:39 -0500 Subject: v2, v3: help (markup): correct path to markup-samples --- lib/sisu/v2/help.rb | 25 +++++-------------------- lib/sisu/v3/help.rb | 19 ++----------------- 2 files changed, 7 insertions(+), 37 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/help.rb b/lib/sisu/v2/help.rb index b07ab6ed..85bb898c 100644 --- a/lib/sisu/v2/help.rb +++ b/lib/sisu/v2/help.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: @@ -1426,7 +1426,7 @@ WOK sisu --help example sample marked up documents are provided in directory: - #{@cX.green}sisu-examples/sample/document_samples_sisu_markup/#{@cX.off} + #{@cX.green}/usr/share/doc/sisu/markup-samples#{@cX.off} and online #{@cX.green}www.jus.uio.no/sisu#{@cX.off} WOK @@ -1672,22 +1672,7 @@ WOK def hyperestraier out_dir='(' + `ls #{@env.path.webserv}`.split("\n").join('|') + ')' print < Date: Fri, 11 Mar 2011 00:29:15 -0500 Subject: param: tidy, remove redundant document header tags --- lib/sisu/v3/param.rb | 81 ++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 44 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 8ae87010..9a11da8c 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -958,7 +958,7 @@ module SiSU_Param SiSU_Screen::Ansi.new(@cmd,'SiSU filetype indicator not provided',mv).warn unless @cmd =~/q/ end @code_flag=false - fns_array.each do |para| #% Scan document + fns_array.each do |para| #% scan document if para !~/^%+\s/ \ and para =~//,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. - @rights=Md.new($1.strip,@opt,@env).rights - when /^@papersize:\s+(.+?)$/m #% metainfo DC - l=$1 - if @mod.inspect !~/--papersize[=-]\S+/ - l=determine_papersize(l.dup) - @papersize=l + when /^@notes?:\s(.+)\Z/m #% * header metadata - notes + @notes=Md.new($1.strip,@opt,@env).notes + when /^@links:\s+(.+?)\Z/m #% * header metadata - links + doc_links=Md.new($1.strip,@opt,@env).links + count=1 + @links=[] + doc_links.each do |doc_link| + if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ + @links[count]={} + @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] + count +=1 + end end - when /^@make:(.+)/m #% metainfo DC + @lnk=@links + when /^@make:(.+)/m #% * header processing - make @make=Md.new($1.strip,@opt,@env).make if defined? @make.breaks \ - and @make.breaks[:page_new] #clearpage + and @make.breaks[:page_new] #clearpage @pagenew=@make.breaks[:page_new] end if defined? @make.breaks \ - and @make.breaks[:page_break] #newpage + and @make.breaks[:page_break] #newpage @pagebreak=@make.breaks[:page_break] end if defined? @make.headings \ @@ -1032,23 +1038,10 @@ module SiSU_Param end if defined? @make.manpage \ and @make.manpage - @man_section=(defined? @make.manpage.section) ? @make.manpage.section : 1 - end - when /^@links:\s+(.+?)\Z/m #% processing - doc_links=Md.new($1.strip,@opt,@env).links - count=1 - @links=[] - doc_links.each do |doc_link| - if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ - @links[count]={} - @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] - count +=1 - end + @man_section=(defined? @make.manpage.section) \ + ? @make.manpage.section \ + : 1 end - @lnk=@links - when /^@notes?:\s(.+)\Z/m #% metainfo - @notes=Md.new($1.strip,@opt,@env).notes - when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing end @lv1 ||=/^1~/ @lv2 ||=/^2~/ @@ -1056,7 +1049,7 @@ module SiSU_Param @lv4 ||=/^4~/ @lv5 ||=/^5~/ @lv6 ||=/^6~/ - else #% + else #% * case para when /^:?A~/ @lvs[1]=1 @@ -1071,7 +1064,7 @@ module SiSU_Param when /^3~/ @lvs[6]=1 end - if para =~ /^:A~/ #% processing + if para =~ /^:A~/ #% processing if @markup.nil? \ or @markup.empty? @markup=@markup_version.determined.to_s @@ -1091,13 +1084,13 @@ module SiSU_Param end unless @code_flag case para - when /~\{\s+.+?\}~/m #% processing + when /~\{\s+.+?\}~/m #% processing en=para.scan(/~\{.+?\}~/m) en.each { |e| @en[:sum] +=1 } - when /~\^(?:\s|$)/m #% processing + when /~\^(?:\s|$)/m #% processing mk=para.scan(/~\^(?:\s|$)/) mk.each { |e| @en[:mark] +=1 } - when /^\^~\s+\S/; @en[:note] +=1 #% processing + when /^\^~\s+\S/; @en[:note] +=1 #% processing end end if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true @@ -1147,7 +1140,7 @@ module SiSU_Param unless @sem_tag @sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later end - end #% here endeth the document loop + end #% here endeth the document loop if @ec[:image].length > 0 @ec[:image].flatten! @ec[:image].uniq! @@ -1360,7 +1353,7 @@ module SiSU_Param end @data=nil #else whole file's contents are stored in md pstore & is not required to be... big waste actually @file=SiSU_Env::SiSU_file.new(self) #watch - Store.new(self,@env).store #% pstore + Store.new(self,@env).store #% pstore self end private -- cgit v1.2.3