From 221cc9595963f8fe1ec92fdc6d7d3e0d429bb7c6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 May 2010 12:22:46 -0400 Subject: texpdf, special word and number optional break points --- lib/sisu/v2/param.rb | 2 +- lib/sisu/v2/shared_metadata.rb | 16 ++++++++++++++-- lib/sisu/v2/texpdf_format.rb | 25 ++++++++++++++++++------- 3 files changed, 33 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 3db97340..285859d7 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -857,7 +857,7 @@ module SiSU_Param end @txt_path=@txt_path ||= @env.path.output @stmp=%{#{@fns}}[/^(.+?)\..*/m,1] - @fnstex=@fns.gsub(/_/,'\_') + @fnstex=@fns.gsub(/_/,'\_\-').gsub(/\./,'.\-') @flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false @flag_separate_endnotes_make=true regx_date=/^\d{4}(?:-(?:[0][0-9]|1[0-2])(-(?:[0-2][0-9]|3[01]))?)?$/ diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb index bd1fe73a..dac6f914 100644 --- a/lib/sisu/v2/shared_metadata.rb +++ b/lib/sisu/v2/shared_metadata.rb @@ -533,6 +533,12 @@ WOK def spec_char(inf) SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_characters end + def word_break_points(inf) + SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_word_break_points + end + def number_break_points(inf) + SiSU_TeX_Pdf::Special_characters.new(@md,inf).special_number_break_points + end def metadata_tex meta=[] dir=SiSU_Env::Info_env.new(@md.fns) @@ -636,6 +642,7 @@ WOK if defined? @md.classify.topic_register \ and @md.classify.topic_register=~/\S+/ tag,inf=tr.topic_register,@md.classify.topic_register + inf=word_break_points(inf) meta << meta_para(tag,inf) end if defined? @md.classify.loc \ @@ -722,6 +729,7 @@ WOK if defined? @md.fns \ and @md.fns=~/\S+/ fn=spec_char(@md.fns) + fn=word_break_points(fn) fn="\\begin\{footnotesize\}#{fn}\\end\{footnotesize\}" tag,inf=tr.sourcefile,fn meta << meta_para(tag,inf,false) @@ -734,13 +742,17 @@ WOK if defined? @md.dgst \ and @md.dgst.class==Array hash_of=spec_char(@md.dgst[0]) - tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\} #{@br}#{@md.dgst[1]}" + hash_of=word_break_points(hash_of) + dgst=number_break_points(@md.dgst[1]) + tag,inf='Source Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-#{dgst}" meta << meta_para(tag,inf,false) end if defined? @md.dgst_skin \ and @md.dgst_skin.class==Array hash_of=spec_char(@md.dgst_skin[0]) - tag,inf='Skin Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\} #{@br}#{@md.dgst_skin[1]}" + hash_of=word_break_points(hash_of) + dgst=number_break_points(@md.dgst_skin[1]) + tag,inf='Skin Digest',"\\begin\{footnotesize\}#{hash_of}\\end\{footnotesize\}\\-#{dgst}" meta << meta_para(tag,inf,false) end meta << %{#{@br}\\begin\{bfseries\}Generated \\end\{bfseries\}} diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 2d81f40c..2beb49b0 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -1098,6 +1098,17 @@ WOK str=xetex_special_characters_3(str) unless str.nil? @txt=str end + def special_word_break_points + str=@txt + str.gsub!(/([_,.;:\/|=])/,'\1\-') + #str.gsub!(/([_,.;:|=])/,'\1\-') + @txt=str + end + def special_number_break_points + str=@txt + str=str.gsub(/([0-9a-f]{8})/i,'\1\-') + @txt=str + end def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care. str,is=@txt,@is str=xetex_special_characters_1(str,is) unless str.nil? @@ -1271,20 +1282,20 @@ WOK \\\\ Generated by \\href{http://www.jus.uio.no/sisu/}{SiSU} found at \\href{http://www.jus.uio.no/sisu/}{www.jus.uio.no/sisu} \\begin{tiny}[ #{v[:project]} #{v[:version]} #{v[:date_stamp]} ]\\end{tiny} \\href{http://www.sisudoc.org}{www.sisudoc.org}. SiSU is software for document structuring, publishing and search (using SiSU: object citation numbering, markup, meta-markup, and system) Copyright #{@copymark} 1997, current #{@date.year_static} Ralph Amissah, All Rights Reserved. \\\\ SiSU is released under \\href{http://www.fsf.org/licenses/gpl.html}{GPL 3 } or later (\\href{http://www.fsf.org/licenses/gpl.html}{www.fsf.org/licenses/gpl.html}). {\\end{footnotesize} {\\begin{small} -\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{bfseries}#{site}\\end{bfseries} \\\\ \\\\ #{@md.title.full} \\textbf{pdf} versions can be found at: \\\\ +\\\\ W3 since October 3 1993 \\href{http://www.jus.uio.no/sisu/}{#{sisu_ico}}SiSU 1997, current #{@date.year_static}. \\\\ #{sitename} presentations at \\begin{scriptsize}#{site}\\end{scriptsize} \\\\ \\\\ #{@md.title.full} \\textbf{pdf} versions can be found at: \\\\ {\\end{small} -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize} \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize} \\\\ +\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_p]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ +#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:pdf_l]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ \\\\\n#{@md.title.full} \\textbf{html} versions may be found at: \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize} or \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize} +#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:toc]}}\\end{scriptsize}#{@brace_url.tex_close} or \\\\ +#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:doc]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ \\\\ \\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{SiSU Manifest} of document output and metadata may be found at: \\\\ -\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}{#{@vz.url_root_http}/#{url}/#{@md.fnl[:pre]}sisu\\_manifest#{@md.fnl[:mid]}.html#{@md.fnl[:post]}}\\end{scriptsize} +#{@brace_url.tex_open}\\begin{scriptsize}\\url{#{@vz.url_root_http}/#{url}/#{@md.fn[:manifest]}}\\end{scriptsize}#{@brace_url.tex_close} \\\\ \\\\ - #{sitename} found at: \\begin{bfseries}#{site}\\end{bfseries}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} + #{sitename} found at: \\begin{scriptsize}#{site}\\end{scriptsize}\\subsubsection*{Links that may be of interest at #{@vz.txt_home} and elsewhere:} \\addcontentsline{toc}{subsection}{Links that may be of interest} WOK end -- cgit v1.2.3