diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-03-11 08:21:39 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-03-11 08:21:39 -0500 |
commit | 2c0a67fc37d65bf8c2d09a0c593700a23553dc3c (patch) | |
tree | b414fd321bb1e17b6e203beb4007dc8378de333c /lib | |
parent | debian/changelog (3.0.2-1) (diff) | |
parent | v2, v3: changelog git.sisudoc.org tag-points [3.0.3-1] (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v2/dal_doc_str.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v2/dal_substitutions_and_insertions.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v2/dal_syntax.rb | 8 | ||||
-rw-r--r-- | lib/sisu/v2/epub_tune.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v2/help.rb | 25 | ||||
-rw-r--r-- | lib/sisu/v2/html_tune.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v2/manpage.rb | 26 | ||||
-rw-r--r-- | lib/sisu/v2/odf.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v2/param.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v2/shared_xml.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v2/texpdf_format.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/dal_doc_str.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3/dal_substitutions_and_insertions.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v3/dal_syntax.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/epub_tune.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v3/help.rb | 19 | ||||
-rw-r--r-- | lib/sisu/v3/html_tune.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v3/manpage.rb | 35 | ||||
-rw-r--r-- | lib/sisu/v3/odf.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v3/param.rb | 91 | ||||
-rw-r--r-- | lib/sisu/v3/shared_xml.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3/texpdf_format.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v3/urls.rb | 2 |
23 files changed, 117 insertions, 181 deletions
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/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/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 47c7f8d0..76287464 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!(/<!(\S+)!>/,'<:\1>') #escaped special character dob.obj.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character @@ -398,9 +398,10 @@ 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]}]|$)/, + 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 @@ -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/,%{ <img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') - 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._-]+)/,'<<a href="mailto:\1">\1</a>>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@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/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 <<WOK - See the documentation for hyperestraier - #{@cX.blue} - http://hyperestraier.sourceforge.net/ - - file:///usr/share/doc/hyperestraier/index.html - #{@cX.off} #{@cX.orange} - man estcmd - #{@cX.off} - - on sisu_hyperestraier: - - #{@cX.blue} - man sisu_hyperestraier - - /usr/share/doc/sisu/sisu_markup/sisu_hyperestraier/index.html - #{@cX.off} + Not tested recently, not up-to-date NOTE: The examples that follow assume that sisu output is placed in the directory /home/ralph/sisu_www @@ -1784,7 +1769,7 @@ WOK SiSU, a framework for document structuring, publishing and search - Copyright (C) 1997 - 2010 Ralph Amissah + Copyright (C) 1997 - 2011 Ralph Amissah This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -1831,7 +1816,7 @@ WOK * Standard SiSU meta-markup syntax, and the * Standard SiSU object citation numbering and system -© Ralph Amissah 1997, current 2010. +© Ralph Amissah 1997, current 2011. All Rights Reserved. Information on these may be obtained from: 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/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') - 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._-]+)/,'<<a href="mailto:\1">\1</a>>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@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/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/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]}/, '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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 %{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}</text:p>} else %{<text:p text:style-name="P1">#{dob.obj}</text:p>} @@ -372,10 +372,10 @@ module SiSU_ODF parray=[] dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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,'<text:a xlink:type="simple" xlink:href="\1">') 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/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 732a903e..dbf0d095 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: @@ -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</a>#{@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}") @@ -970,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\-') 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 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 diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 2de931f6..2f6353bc 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!(/<!(\S+)!>/,'<:\1>') #escaped special character dob.obj.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character @@ -404,9 +404,10 @@ 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]}]|$)/, + 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 @@ -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/,%{ <img border="0" height="15" width="15" src="#{@env.url.images_epub}/#{@vz.icon_new}" alt="new" />}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') - 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._-]+)/,'<<a href="mailto:\1">\1</a>>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@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/help.rb b/lib/sisu/v3/help.rb index a0d62644..477e93e9 100644 --- a/lib/sisu/v3/help.rb +++ b/lib/sisu/v3/help.rb @@ -1434,7 +1434,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 @@ -1680,22 +1680,7 @@ WOK def hyperestraier out_dir='(' + `ls #{@env.path.webserv}`.split("\n").join('|') + ')' print <<WOK - See the documentation for hyperestraier - #{@cX.blue} - http://hyperestraier.sourceforge.net/ - - file:///usr/share/doc/hyperestraier/index.html - #{@cX.off} #{@cX.orange} - man estcmd - #{@cX.off} - - on sisu_hyperestraier: - - #{@cX.blue} - man sisu_hyperestraier - - /usr/share/doc/sisu/sisu_markup/sisu_hyperestraier/index.html - #{@cX.off} + Not tested recently, not up-to-date NOTE: The examples that follow assume that sisu output is placed in the directory /home/ralph/sisu_www 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/,%{ <img border="0" height="15" width="15" src="#{@env.url.images}/#{@vz.icon_new}" alt="new">}) dob.obj.gsub!(/<:h(.{1,7}?)>/,'<a href="#h\1">\1</a>') dob.obj.gsub!(/<:to(\d{1,7}?)>/,'<a href="#to\1">to { \1 }</a> ') - 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._-]+)/,'<<a href="mailto:\1">\1</a>>') - end dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'<a href="\1" target="_top">\1</a>') #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}<a href="mailto:\\1">\\1</a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,%{#{@brace_url.xml_open}<a href="\\1" target="_top">\\1</a>#{@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/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 <br> appropriately within manpage, consider + notes.flatten.each do |n| #high cost to deal with <br> 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/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]}/, '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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 %{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}#{p_num}</text:p>} else %{<text:p text:style-name="P1">#{dob.obj}#{p_num}</text:p>} @@ -377,10 +377,10 @@ module SiSU_ODF parray=[] dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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,'<text:a xlink:type="simple" xlink:href="\1">') @@ -400,10 +400,10 @@ module SiSU_ODF parray=[] dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #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}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@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,'<text:a xlink:type="simple" xlink:href="\1">') diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 9dfbc70f..9a11da8c 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 @@ -960,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 =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included raise "Old markup style in file #{@fns}, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n" @@ -974,40 +972,46 @@ module SiSU_Param if para =~regx_header \ and not @code_flag #or para=~/^(?:1|:?A)~/ case para - when /^@ocn:\s+(.+?)$/m; @ocn=$1 #% processing - when /^@title:(.+)/m #% metainfo DC + when /^@title:(.+)/m #% * header metadata - title @title=Md.new($1.strip,@opt,@env).title - when /^@creator:(.+)/m #% metainfo DC + when /^@creator:(.+)/m #% * header metadata - creator @creator=Md.new($1.strip,@opt,@env).creator @authorship=@author=@creator.author @authors=@creator.author_detail - when /^@classify:(.+)/m; classify=$1 - @classify=Md.new($1.strip,@opt,@env).classify - when /^@publisher:\s+(.+)/m + when /^@date:(.+)/m #% * header metadata - date + @date=Md.new($1.strip,@opt,@env).date + when /^@publisher:\s+(.+)/m #% * header metadata - publisher @publisher=Md.new($1.strip,@opt,@env).current_publisher @current_publisher=@publisher - when /^@original:(.+)/m + when /^@rights:(.+)/m; #% * header metadata - rights + @rights=Md.new($1.strip,@opt,@env).rights + when /^@classify:(.+)/m; classify=$1 #% * header metadata - classify + @classify=Md.new($1.strip,@opt,@env).classify + when /^@original:(.+)/m #% * header metadata - original (document) @original=Md.new($1.strip,@opt,@env).original @source=@original.source - when /^@writing_focus[:.]nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law) - when /^@date:(.+)/m #% metainfo DC - @date=Md.new($1.strip,@opt,@env).date - when /^@rights:(.+)/m; #@rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,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 \ @@ -1034,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~/ @@ -1058,7 +1049,7 @@ module SiSU_Param @lv4 ||=/^4~/ @lv5 ||=/^5~/ @lv6 ||=/^6~/ - else #% + else #% * case para when /^:?A~/ @lvs[1]=1 @@ -1073,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 @@ -1093,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 @@ -1149,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! @@ -1362,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 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 a1fb3e72..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</a>#{@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}") @@ -972,7 +974,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/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/ |