aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-05-12 22:56:57 -0400
committerRalph Amissah <ralph@amissah.com>2014-05-12 22:56:57 -0400
commit62c48aca4793f8f9b9af4114a6ba84a0a477f789 (patch)
tree31ca4f44bf8eb33d81f2e12252bc523fd6e6fcee /lib/sisu
parentv6: texpdf, mailto markup links set for normal text objects (diff)
v6: texpdf, urls in creator cause breakage
* (Closes: #744541)
Diffstat (limited to 'lib/sisu')
-rw-r--r--lib/sisu/v6/texpdf_format.rb33
1 files changed, 24 insertions, 9 deletions
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(/<a href=".+?">/,' ').
- 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 <url> 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?