aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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?