aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/texpdf_format.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2008-09-15 21:52:19 -0400
committerRalph Amissah <ralph@amissah.com>2008-09-15 21:52:19 -0400
commit87a7cfcd56eed6746b1500c88df3fc3e76a81668 (patch)
tree9e653d09f0e8c130273ef5ef3e7be0daf12d6007 /lib/sisu/v0/texpdf_format.rb
parentdal_idx, and concordance, letter list for navigation (diff)
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.
Diffstat (limited to 'lib/sisu/v0/texpdf_format.rb')
-rw-r--r--lib/sisu/v0/texpdf_format.rb19
1 files changed, 16 insertions, 3 deletions
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>/,'{/}')