aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-06-11 21:55:00 -0400
committerRalph Amissah <ralph@amissah.com>2010-06-11 21:56:42 -0400
commitcb4968bec9b2e8a0ba75a9fa906f87791ba288ae (patch)
tree2b01a491ef2ced59794601027651b35d3d98f103
parentdal_syntax, apply fontfaces also to tables (diff)
texpdf_format: add fontface to tables
* tables add fontfaces (e.g. bold, italics, superscript)
-rw-r--r--lib/sisu/v2/texpdf_format.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb
index 87a946d0..e756aa03 100644
--- a/lib/sisu/v2/texpdf_format.rb
+++ b/lib/sisu/v2/texpdf_format.rb
@@ -107,6 +107,19 @@ module SiSU_TeX_Pdf
def ocn_display(dob)
"\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{dob.ocn}}\\end{tiny}}}" #ocn object citation numbering
end
+ def table_special_characters(r)
+ r.gsub!(/#{Mx[:tc_p]}|$/u,'&')
+ r.gsub!(/%/,'\%')
+ r.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}')
+ r.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}')
+ r.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\uline{\1}') # ulem
+ r.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,"``\\1''") # quote #CHECK
+ r.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\uline{\1}') # ulem
+ r.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\sout{\1}') # ulem
+ r.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$")
+ r.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$")
+ r
+ end
def longtable_landscape
end_table='\end{longtable}'
row_break='\\\\\\'
@@ -137,7 +150,7 @@ module SiSU_TeX_Pdf
rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
rows.each do |r|
- r.gsub!(/#{Mx[:tc_p]}|$/,'&')
+ r=table_special_characters(r)
r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
@@ -180,7 +193,7 @@ module SiSU_TeX_Pdf
rows[0].gsub!(/&\s*$/," #{row_break} \\hline\\endhead #{row_break}")
end
rows.each do |r|
- r.gsub!(/#{Mx[:tc_p]}|$/u,'&')
+ r=table_special_characters(r)
r.gsub!(/$/," #{row_break}\n") unless r =~/#{row_break*2}$/
if r=~/\<!f(.+?)!\>/ # not tested table footer if any
tablefoot=$1
@@ -942,6 +955,7 @@ WOK
para_array=[]
str=if word
word.each do |w| # _ - / # | : ! ^ ~
+ w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>')
w.gsub!(/[\\]?~/,'<=tilde>')
w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline ') #watch
w.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/,'<=tilde>') #126 usual