From 62c48aca4793f8f9b9af4114a6ba84a0a477f789 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 12 May 2014 22:56:57 -0400 Subject: v6: texpdf, urls in creator cause breakage * (Closes: #744541) --- data/doc/sisu/CHANGELOG_v6 | 3 +++ lib/sisu/v6/texpdf_format.rb | 33 ++++++++++++++++++++++++--------- sisu.org | 6 +++++- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 445328ab..d2bcea38 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -78,6 +78,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.5.orig.tar.xz * texpdf, mailto markup links set for normal text objects (Closes: #744357) but testing required +* texpdf, urls in creator cause breakage + (Closes: #744541) + * texpdf, & in heading breaks toc, now & is removed from toc not heading, broken diff --git a/lib/sisu/v6/texpdf_format.rb b/lib/sisu/v6/texpdf_format.rb index a0955478..e680bc00 100644 --- a/lib/sisu/v6/texpdf_format.rb +++ b/lib/sisu/v6/texpdf_format.rb @@ -1051,13 +1051,18 @@ module SiSU_TeX_Pdf end end def tex_head_pdftex + author=if defined? @md.creator.author \ + and @md.creator.author=~/\S+/ + SiSU_TeX_Pdf::SpecialCharacters.new(@md,@md.creator.author).special_characters_safe_no_urls + else '' + end <<-WOK \\usepackage{alltt} \\usepackage{thumbpdf} \\usepackage[#{@tex2pdf}, #{hyperlinks_color?.strip} pdftitle={#{@txt}}, - pdfauthor={#{@author}}, + pdfauthor={#{author}}, pdfsubject={#{@subject}}, pdfkeywords={#{@keywords}}, pageanchor=true, @@ -1341,14 +1346,17 @@ module SiSU_TeX_Pdf gsub(/§/u,'\S'). #latex: space between next character not preserved? #str.gsub(/§ /,'\S ') gsub(/£/u,'\pounds'). gsub(//,' '). - gsub(/<\/a>/,' '). - gsub(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3'). #special case \{ e.g. \}http://url - gsub(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/, - '\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url - gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration - unless is==:code + gsub(/<\/a>/,' ') + unless is==:no_urls + str=str.gsub(/((?:^|\s)#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, + '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3'). #special case \{ e.g. \}http://url + gsub(/#{Mx[:url_o]}\\_(\S+?)#{Mx[:url_c]}/, + '\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url + gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, + '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration + end + if is !=:code \ + and is !=:no_urls str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start end @@ -1438,6 +1446,13 @@ module SiSU_TeX_Pdf str=special_characters_safe_close(str) unless str.nil? @txt=str end + def special_characters_safe_no_urls + str,is=@txt,:no_urls + str=xetex_special_characters_1(str,is) unless str.nil? + str=xetex_special_characters_2(str,is) unless str.nil? # remove this to start with, causes issues + str=special_characters_safe_close(str) unless str.nil? + @txt=str + end def characters_code_listings #special characters - some substitutions are sequence sensitive, rearrange with care. str,is=@txt,@is str=xetex_code_listings(str,is) unless str.nil? diff --git a/sisu.org b/sisu.org index 950d0514..bf474691 100644 --- a/sisu.org +++ b/sisu.org @@ -1885,7 +1885,7 @@ be automatically transformed into a link within the output (html). Regards, Daniel -**** TODO [#C] #744541 [w|u] sisu: urls in @creator broken +**** DONE (6.0.5) [#C] #744541 [w|u] sisu: urls in @creator broken From: Daniel Baumann @@ -1913,6 +1913,10 @@ transformed into a link in the output format (pdf). Regards, Daniel +***** NOTES/COMMENTS + +pdf, fix + **** TODO [#C] #744685 [w|u] sisu output: copy&past-able wrapped code blocks -- cgit v1.2.3