From 87a7cfcd56eed6746b1500c88df3fc3e76a81668 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Sep 2008 21:52:19 -0400 Subject: various small fixes * html segments, name more accurately * rough description of how book index markup works * clean out book index from these outputs * book markup sample, free as in freedom, start doing book index, only letter "A" done so far * texpdf, url matching, special characters * # Please enter the commit message for your changes. --- lib/sisu/v0/texpdf_format.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'lib/sisu/v0/texpdf_format.rb') diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 58a057d8..5c2b7ec5 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -1100,16 +1100,22 @@ WOK #string.gsub!(/<=lt>/,'\<') #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') - string.gsub!(/((?:\\href|\\url)\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + while string =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') + end string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') #string.gsub!(/<=caret>/,'\^{}') string.gsub!(/<=exclaim>/,'\Verbatim{!}') + string.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text string.gsub!(/<=hash>/,'{\#}') #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') #string.gsub!(/<=slash>/,'{\slash}') string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 + while string =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') + end string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') string.gsub!(/<=slash>/,'{/}') @@ -1202,7 +1208,8 @@ WOK elsif string=~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/; @@flag_code=false end if @@flag_code; string.gsub!(/&/,'{\\\&}') - else string.gsub!(/(\s+&\s+)/,' and ') + else string.gsub!(/&/,'<=amp>') + #else string.gsub!(/(\s+&\s+)/,' and ') end string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ') string.gsub!(/£/u,'\pounds') @@ -1271,16 +1278,22 @@ WOK #string.gsub!(/<=lt>/,'\<') #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') - string.gsub!(/((?:\\href|\\url)?\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + while string =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') + end string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') #string.gsub!(/<=caret>/,'\^{}') string.gsub!(/<=exclaim>/,'\Verbatim{!}') + string.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text string.gsub!(/<=hash>/,'{\#}') #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') #string.gsub!(/<=slash>/,'{\slash}') string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 + while string =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') + end string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') string.gsub!(/<=slash>/,'{/}') -- cgit v1.2.3