diff options
Diffstat (limited to 'lib/sisu/v0/texinfo_format.rb')
-rw-r--r-- | lib/sisu/v0/texinfo_format.rb | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index 5bcdf04d..42d62960 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -237,7 +237,7 @@ WOK "@bye" end def clean(para) - para.gsub!(/<\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'<\1>') + para.gsub!(/#{Mx[:id_o]}\\~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'<\1>') para.gsub!(/\s*[,:]\s*/,' - ') para.gsub!(/<:#>/,'') para.strip! @@ -249,21 +249,21 @@ WOK "* #{para}::" end def level1 - @para.gsub!(/[1]\\+~/,'') + @para.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level2 - @para.gsub!(/[2]\\+~/,'') + @para.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level3 - @para.gsub!(/[3]\\+\~/,'') + @para.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') #para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,"\\1 \\3\n\\2") @@ -272,21 +272,21 @@ WOK @para.gsub!(/.+/,"#{para}") end def level4 - @para.gsub!(/[4]\\+~\S+/,'') + @para.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level5 - @para.gsub!(/[5]\\+~\S+/,'') + @para.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @para.gsub!(/.+/,"#{para}") end def level6 - @para.gsub!(/[6]\\+~\S+/,'') + @para.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'') para=clean(@para) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" @@ -313,16 +313,16 @@ WOK @para.gsub!(/<:i2>(.*)/,'\1') end def spec_char # special characters - @para.gsub!(/<EOF>/i,'') - @para.gsub!(/©/,'(c)') - @para.gsub!(/&(lt|#060);/,'<'); @para.gsub!(/&(gt|#062);/,'>') - @para.gsub!(/{/,'{'); @para.gsub!(/}/,'}') - @para.gsub!(/&#(126|152);/i,'~') - @para.gsub!(/!/,'!') - @para.gsub!(/#/,'#') - @para.gsub!(/*/,'*') - @para.gsub!(///,'/') - @para.gsub!(/_/,'_') + @para.gsub!(/#{Mx[:br_eof]}/i,'') + @para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)') + @para.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); @para.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>') + @para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); @para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') + @para.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') + @para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') + @para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') + @para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') + @para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') + @para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') @para.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ') @para.gsub!(/\\/,'\\backslash ') @para.gsub!(/<:pb>/,'\\newpage') @@ -375,9 +375,9 @@ WOK def longtable @end_table="\\end{longtable}" @row_break='\\\\\\' - if @para[/<!Th?¡\s+c(\d+);(.+?)!>/ui] + if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure no_of_cols,cols_width=$1,$2 - @@tableheader=1 if @para =~ /<!Th/i + @@tableheader=1 if @para =~ /#{Mx[:gr_o]}Th/i @w=cols_width.split(/;\s+/) @@number_of_cols=no_of_cols @colW=[] @@ -390,17 +390,17 @@ WOK @colW=@colW.join @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{longtable}[hb]#@colW\n" - @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#{@@start_table}") + @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~/<!TZ!>/ - @para.gsub!(/<!TZ!>/," #@end_table") + if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table") end - @para.gsub!(/<!¡/u,'') + @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') if @@tableheader==1 - if @para =~/¡\d+?¡(.+?)(?:¡|!)/u + if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u tablefoot=para[/\<!f(.+?)!\>/,1] @para.gsub!(/\<!f(.+?)!\>/,'') - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u, + @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u, "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&") @para.gsub!(/&>\s*$/, " #@row_break \\hline\\endhead #@row_break") @@ -409,8 +409,8 @@ WOK @@number_of_cols=0 end else - if @para =~/¡\d+?¡(.+?)(?:¡|!)/u - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\begin{tiny}\\1\\end{tiny}&") + if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") @para.gsub!(/&>\s*$/," #@row_break") end end @@ -423,7 +423,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @para[/<!Th?¡\s+c(\d+);(.+?)!>/ui] + if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s+/) @colW=[] @@ -432,13 +432,13 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @@start_table="\\begin{tabular}{#@colW}\n" - @para.gsub!(/<!Th?¡\s+c\d+?;.+!>/u,"#{@@start_table}") + @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~/<!TZ!>/ - @para.gsub!(/<!TZ!>/,"#@end_table") + if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") @@table_pg_break_counter=1 end - if @para =~/<!¡/u + if @para =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape @para = "\n\n#@end_table \n" + @@ -446,14 +446,14 @@ WOK "#{@@start_table}\n" @@table_pg_break_counter=1 else - @para.gsub!(/<!¡/u,'') + @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') @@table_pg_break_counter+=1 tablefoot=@para[/\<!f(.+?)!\>/] @para.gsub!(/\<!f(.+?)!\>/,'') end end - if @para =~/¡\d+?¡(.+?)(?:¡|!)/u - @para.gsub!(/¡\d+?¡(.+?)(?:¡|!)/u,"\\begin{tiny}\\1\\end{tiny}&") + if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") @para.gsub!(/&>\s*$/,"#@row_break") end @para |