diff options
Diffstat (limited to 'lib/sisu/v0/texpdf_format.rb')
-rw-r--r-- | lib/sisu/v0/texpdf_format.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 47b66729..ba84f323 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -287,7 +287,7 @@ WOK def longtable_landscape @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/] + if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/u] no_of_cols,cols_width,ocn=$1,$2,$3 tw=case @md.papersize when /a4/i; @tx.a4.landscape.w #European default, SiSU default @@ -313,24 +313,24 @@ WOK @colW=@colW.join @start_table="<~#{ocn}>\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/,@start_table) + @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/u,@start_table) end if @string =~/<!TZ!>/ @string.gsub!(/<!TZ!>/," #@end_table\n\\end{tiny}") end - @string.gsub!(/<!¡/,'') + @string.gsub!(/<!¡/u,'') if @@tableheader[:l] == 1 - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\bfseries \1&') + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\bfseries \1&') @string.gsub!(/&>\s*$/," #@row_break \\hline\\endhead #@row_break") @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[:l],@@number_of_cols=0,0 end else - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\1&') + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\1&') @string.gsub!(/&>\s*$/," #@row_break") end end @@ -341,7 +341,7 @@ WOK def longtable_portrait @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/] + if @string[/<!Th?¡\s+c(\d+);(.+?)!\\~(\d+;\w\d+;\w\d+)>/u] no_of_cols,cols_width,ocn=$1,$2,$3 tw=case @md.papersize when /a4/i; @tx.a4.portrait.w #European default, SiSU default @@ -368,24 +368,24 @@ WOK @colW=@colW.join @start_table="<~#{ocn}>\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/,"#@start_table") + @string.gsub!(/<!Th?¡\s+c\d+?;.+!\\~\d+;\w\d+;\w\d+>/u,"#@start_table") end if @string =~/<!TZ!>/ @string.gsub!(/<!TZ!>/," #@end_table\n\\end{tiny}") end - @string.gsub!(/<!¡/,'') + @string.gsub!(/<!¡/u,'') if @@tableheader[:p] == 1 - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\bfseries \1&') + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\bfseries \1&') @string.gsub!(/&>\s*$/," #@row_break \\hline\\endhead #@row_break") @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[:p],@@number_of_cols=0,0 end else - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,'\1&') + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,'\1&') @string.gsub!(/&>\s*$/," #@row_break") end end @@ -399,7 +399,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @string[/<!Th?¡\s+c(\d+);(.+?)!>/] + if @string[/<!Th?¡\s+c(\d+);(.+?)!>/u] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s*/) @colW=[] @@ -408,25 +408,25 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @start_table="\\begin{tabular}{#@colW}\n" - @string.gsub!(/<!Th?¡\s+c\d+?;.+!>/,"#@start_table}") + @string.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#@start_table}") end if @string =~/<!TZ!>/ @string.gsub!(/<!TZ!>/,"#@end_table") @@table_pg_break_counter=1 end - if @string =~/<!¡/ + if @string =~/<!¡/u if @@table_pg_break_counter == 28 # taken from 34 ideal for portrait to 28 which suits landscape @string="\n\n#@end_table \n#@break_page#@start_table\n" @@table_pg_break_counter=1 else - @string.gsub!(/<!¡/,'') + @string.gsub!(/<!¡/u,'') @@table_pg_break_counter+=1 tablefoot=@string[/\<!f(.+?)!\>/,1] @string.gsub!(/\<!f(.+?)!\>/,'') end end - if @string =~/¡\d+?¡(.+?)(?:¡|!)/ - @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/,"\\1&") + if @string =~/¡\d+?¡(.+?)(?:¡|!)/u + @string.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\1&") @string.gsub!(/&>\s*$/,"#@row_break") end @string @@ -438,7 +438,7 @@ WOK para_array=[] if word word.each do |w| # _ - / # | : ! ^ ~ - unless para =~/^(?:0~|%+ |<!Th?¡ )/m + unless para =~/^(?:0~|%+ |<!Th?¡ )/um w.gsub!(/[\\]?~/,'<=tilde>') unless w=~/^[1-6]~|~\{|\}~|~\[|\]~|^\^~\s|~\^|\*~\S+|~#|\{t~|<~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+>/ w.gsub!(/&#(?:126|152);/,'<=tilde>') #126 usual #w.gsub!(/&#(?:126|152);/,'<=tilde>') unless w=~/https?:\/\/\S+/ #126 usual @@ -501,8 +501,8 @@ WOK if @@flag_code; @string.gsub!(/&/,'{\\\&}') else @string.gsub!(/(\s+&\s+)/,' and ') end - @string.gsub!(/§/,'\S') #latex: space between next character not preserved? #@string.gsub!(/§ /,'\S ') - @string.gsub!(/£/,'\pounds') + @string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #@string.gsub!(/§ /,'\S ') + @string.gsub!(/£/u,'\pounds') @string.gsub!(/&\S+?;/,' ') @string.gsub!(/<a href=".+?">/,' ') @string.gsub!(/<\/a>/,' ') |