aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/texinfo_format.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/texinfo_format.rb')
-rw-r--r--lib/sisu/v0/texinfo_format.rb329
1 files changed, 171 insertions, 158 deletions
diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb
index 42d62960..22fd7a84 100644
--- a/lib/sisu/v0/texinfo_format.rb
+++ b/lib/sisu/v0/texinfo_format.rb
@@ -58,7 +58,7 @@
** Description: texinfo formatting template
=end
-module TexInfoFormat
+module SiSU_Texinfo_format
@@table_pg_break_counter=1
require "#{SiSU_lib}/param"
include SiSU_Param
@@ -69,9 +69,19 @@ module TexInfoFormat
@@tabular="{tabular}"
@@tex_pattern_margin_number="\\\\marginpar.+?\s+"
@@dp=nil
- def initialize(data=nil,md=nil,three=nil)
- @para=@one=data
- @md=md
+ def initialize(md,t_o)
+ @md,@t_o=md,t_o
+ if t_o.class == Hash
+ @txt =t_o[:txt] || nil
+ #@h_name =t_o[:h_name] || nil
+ #elsif t_o.class == Array
+ # @txt =txt[0]
+ #elsif t_o.class == String
+ # @txt =txt
+ else
+ p t_o.class
+ p caller
+ end
@vz=SiSU_Env::Get_init.instance.skin
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
end
@@ -79,12 +89,12 @@ module TexInfoFormat
t=Time.now
year=t.year
filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1]
- title=Texinfo.new(@md.title).spec_char
+ title=spec_char_string(@md.title)
title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
title.gsub!(/\$/,"\\$")
title.gsub!(/[,]\s*/,' - ')
if @md.subtitle
- subtitle=Texinfo.new(@md.subtitle).spec_char
+ subtitle=spec_char_string(@md.subtitle)
subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
subtitle.gsub!(/\$/,"\\$")
subtitle.gsub!(/[,]\s*/,' - ')
@@ -150,42 +160,42 @@ WOK
"#{head}#{titlepage}"
end
def topnode
- @one=Texinfo.new(@one).spec_char
- @one=@one.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
- @one.gsub!(/\$/,"\\$")
- @one.gsub!(/[,]\s*/,' - ')
+ txt=spec_char_string(@txt)
+ txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ")
+ txt.gsub!(/\$/,"\\$")
+ txt.gsub!(/[,]\s*/,' - ')
"@c %% 4\n" +
"@ifnottex\n" +
"@node Top\n" +
- "@top #@one\n\n" +
+ "@top #{txt}\n\n" +
"@insertcopying\n" +
"@end ifnottex\n\n" +
"@menu\n"
end
def dublincore
- title=Texinfo.new(@md.title).spec_char if @md.title
- subtitle=Texinfo.new(@md.subtitle).spec_char if @md.subtitle
+ title=spec_char_string(@md.title) if @md.title
+ subtitle=spec_char_string(@md.subtitle) if @md.subtitle
dc_title="#{title} - #{subtitle}"
- dc_creator=Texinfo.new(@md.dc_creator).spec_char if @md.dc_creator
- dc_subject=Texinfo.new(@md.dc_subject).spec_char if @md.dc_subject
- dc_description=Texinfo.new(@md.dc_description).spec_char if @md.dc_description
- dc_publisher=Texinfo.new(@md.dc_publisher).spec_char if @md.dc_publisher
- dc_contributor=Texinfo.new(@md.dc_contributor).spec_char if @md.dc_contributor
- dc_date=Texinfo.new(@md.dc_date).spec_char if @md.dc_date
- dc_date_created=Texinfo.new(@md.dc_date_created).spec_char if @md.dc_date_created
- dc_date_issued=Texinfo.new(@md.dc_date_issued).spec_char if @md.dc_date_issued
- dc_date_available=Texinfo.new(@md.dc_date_available).spec_char if @md.dc_date_available
- dc_date_valid=Texinfo.new(@md.dc_date_valid).spec_char if @md.dc_date_valid
- dc_date_modified=Texinfo.new(@md.dc_date_modified).spec_char if @md.dc_date_modified
- dc_type=Texinfo.new(@md.dc_type).spec_char if @md.dc_type
- dc_format=Texinfo.new(@md.dc_format).spec_char if @md.dc_format
- dc_identifier=Texinfo.new(@md.dc_identifier).spec_char if @md.dc_identifier
- dc_source=Texinfo.new(@md.dc_source).spec_char if @md.dc_source
- dc_language=Texinfo.new(@md.dc_language[:name]).spec_char if @md.dc_language[:name]
- #language_original=Texinfo.new(@md.language_original[:name]).spec_char if @md.language_original[:name]
- dc_relation=Texinfo.new(@md.dc_relation).spec_char if @md.dc_relation
- dc_coverage=Texinfo.new(@md.dc_coverage).spec_char if @md.dc_coverage
- dc_rights=Texinfo.new(@md.dc_rights).spec_char if @md.dc_rights
+ dc_creator=spec_char_string(@md.dc_creator) if @md.dc_creator
+ dc_subject=spec_char_string(@md.dc_subject) if @md.dc_subject
+ dc_description=spec_char_string(@md.dc_description) if @md.dc_description
+ dc_publisher=spec_char_string(@md.dc_publisher) if @md.dc_publisher
+ dc_contributor=spec_char_string(@md.dc_contributor) if @md.dc_contributor
+ dc_date=spec_char_string(@md.dc_date) if @md.dc_date
+ dc_date_created=spec_char_string(@md.dc_date_created) if @md.dc_date_created
+ dc_date_issued=spec_char_string(@md.dc_date_issued) if @md.dc_date_issued
+ dc_date_available=spec_char_string(@md.dc_date_available) if @md.dc_date_available
+ dc_date_valid=spec_char_string(@md.dc_date_valid) if @md.dc_date_valid
+ dc_date_modified=spec_char_string(@md.dc_date_modified) if @md.dc_date_modified
+ dc_type=spec_char_string(@md.dc_type) if @md.dc_type
+ dc_format=spec_char_string(@md.dc_format) if @md.dc_format
+ dc_identifier=spec_char_string(@md.dc_identifier) if @md.dc_identifier
+ dc_source=spec_char_string(@md.dc_source) if @md.dc_source
+ dc_language=spec_char_string(@md.dc_language[:name]) if @md.dc_language[:name]
+ #language_original=spec_char_string(@md.language_original[:name]) if @md.language_original[:name]
+ dc_relation=spec_char_string(@md.dc_relation) if @md.dc_relation
+ dc_coverage=spec_char_string(@md.dc_coverage) if @md.dc_coverage
+ dc_rights=spec_char_string(@md.dc_rights) if @md.dc_rights
dc_title="Title: #{dc_title}\n\n" if dc_title
dc_creator="Creator: #{dc_creator}\n\n" if dc_creator
dc_subject="Subject: #{dc_subject}\n\n" if dc_subject
@@ -244,140 +254,143 @@ WOK
para
end
def menu
- para=clean(@para)
+ para=clean(@txt)
para=para.gsub(/@footnote\{.+?\}\s+/,'')
"* #{para}::"
end
def level1
- @para.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@para)
+ @txt.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'')
+ para=clean(@txt)
nd=para.gsub(/@footnote\{.+?\}\s+/,'')
para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @para.gsub!(/.+/,"#{para}")
+ @txt.gsub!(/.+/,"#{para}")
end
def level2
- @para.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@para)
+ @txt.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'')
+ para=clean(@txt)
nd=para.gsub(/@footnote\{.+?\}\s+/,'')
para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @para.gsub!(/.+/,"#{para}")
+ @txt.gsub!(/.+/,"#{para}")
end
def level3
- @para.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@para)
+ @txt.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'')
+ para=clean(@txt)
nd=para.gsub(/@footnote\{.+?\}\s+/,'')
#para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,"\\1 \\3\n\\2")
#para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,'\1 \3 \2')
para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @para.gsub!(/.+/,"#{para}")
+ @txt.gsub!(/.+/,"#{para}")
end
def level4
- @para.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'')
- para=clean(@para)
+ @txt.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'')
+ para=clean(@txt)
nd=para.gsub(/@footnote\{.+?\}\s+/,'')
para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @para.gsub!(/.+/,"#{para}")
+ @txt.gsub!(/.+/,"#{para}")
end
def level5
- @para.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@para)
+ @txt.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'')
+ para=clean(@txt)
nd=para.gsub(/@footnote\{.+?\}\s+/,'')
para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @para.gsub!(/.+/,"#{para}")
+ @txt.gsub!(/.+/,"#{para}")
end
def level6
- @para.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'')
- para=clean(@para)
+ @txt.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'')
+ para=clean(@txt)
nd=para.gsub(/@footnote\{.+?\}\s+/,'')
para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n"
- @para.gsub!(/.+/,"#{para}")
+ @txt.gsub!(/.+/,"#{para}")
end
def submenu
- @para=@para.join("\n")
- @para.gsub!(/[5]\\+~\S+/,'')
- para=clean(@para)
+ @txt=@txt.join("\n")
+ @txt.gsub!(/[5]\\+~\S+/,'')
+ para=clean(@txt)
para="@menu\n#{para}\n@end menu\n\n"
- @para.gsub!(/.+/m,"#{para}")
+ @txt.gsub!(/.+/m,"#{para}")
end
def subsubmenu
- @para=@para.join("\n")
- @para.gsub!(/[6]\\+~\S+/,'')
- para=clean(@para)
+ @txt=@txt.join("\n")
+ @txt.gsub!(/[6]\\+~\S+/,'')
+ para=clean(@txt)
para="@menu\n#{para}\n@end menu\n\n"
- @para.gsub!(/.+/m,"#{para}")
+ @txt.gsub!(/.+/m,"#{para}")
end
def indent1
- @para.gsub!(/<:i1>(.*)/,'\1')
+ @txt.gsub!(/<:i1>(.*)/,'\1')
end
def indent2
- @para.gsub!(/<:i2>(.*)/,'\1')
+ @txt.gsub!(/<:i2>(.*)/,'\1')
+ end
+ def spec_char_string(txt) # special characters
+ txt_obj={:txt =>txt}
+ SiSU_Texinfo_format::Texinfo.new(@md,txt_obj).spec_char
end
def spec_char # special characters
- @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')
- @para.gsub!(/\\backslash copyright/,'\\copyright ')
- @para.gsub!(/\^/,'\\wedge ')
- @para.gsub!(/(\$)/,"\\$")
- @para.gsub!(/\~/,'\\~')
- @para.gsub!(/%/,"\\%")
- #if @para !~ /^\s*<:image|\}:image\s/
- # @para.gsub!(/_/,'\_')
+ @txt.gsub!(/#{Mx[:br_eof]}/i,'')
+ @txt.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)')
+ @txt.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); @txt.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>')
+ @txt.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); @txt.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
+ @txt.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
+ @txt.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
+ @txt.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
+ @txt.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
+ @txt.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
+ @txt.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
+ @txt.gsub!(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' ')
+ @txt.gsub!(/\\/,'\\backslash ')
+ @txt.gsub!(/<:pb>/,'\\newpage')
+ @txt.gsub!(/\\backslash copyright/,'\\copyright ')
+ @txt.gsub!(/\^/,'\\wedge ')
+ @txt.gsub!(/(\$)/,"\\$")
+ @txt.gsub!(/\~/,'\\~')
+ @txt.gsub!(/%/,"\\%")
+ #if @txt !~ /^\s*<:image|\}:image\s/
+ # @txt.gsub!(/_/,'\_')
#end
- @para.gsub!(/_(https?:\/\/)/,'\1')
- @para.gsub!(/§/i,'\S')
- @para.gsub!(/£/i,'\pounds')
- @para.gsub!(/å/i,'\aa')
- @para.gsub!(/æ/i,'\ae')
- @para.gsub!(/ø/i,'\o')
- @para.gsub!(/Å/i,'\AA')
- @para.gsub!(/Æ/i,'\AE')
- @para.gsub!(/Ø/i,'\O')
- @para.gsub!(/<a href=".+?">/i,' ')
- @para.gsub!(/<\/a>/i,' ')
- @para.gsub!(/<:ee>/i,'')
- @para.gsub!(/<!>/i,' ')
- @para.gsub!(/<b>(.+?)<\/b>/,'\*\1\*')
- @para.gsub!(/<i>(.+?)<\/i>/,'\/\1\/')
- @para.gsub!(/<u>(.+?)<\/u>/,'\_\1\_')
- @para.gsub!(/@/i,'@@')
- @para.gsub!(/\{/,'@{'); @para.gsub!(/\}/,'@}')
- #@para.gsub!(/(^|[\s*!\/#_-])\{/,'\1@{'); @para.gsub!(/\}([\s*!\/#_-]|$)/,'@}\1')
- @para.gsub!(/&nbsp;&nbsp;/,' ') # ~ character for hardspace
- @para.gsub!(/&nbsp;/,' ') # ~ character for hardspace
- @para.gsub!(/&(\S+?);/,' ')
- @para.gsub!(/&/,'<=and>')
- @para.gsub!(/(\s+&\s+)/,' and ')
- @para.gsub!(/(\&)/,"\\&")
- @para.gsub!(/"(.+?)"/,"`\\1'") # open & close "
- @para.gsub!(/\s+"/," `") # open "
- @para.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open "
- @para.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close "
- @para.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close "
- @para.gsub!(/"(\.|,)/,"'") # close "
- @para.gsub!(/\s+'/," `") # open '
- @para.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open '
- @para.gsub!(/(<font.*?>|<\/font>)/,'')
- @para.gsub!(/\s*<sup>(\S+?)<\/sup>/,'^\1')
- @para.gsub!(/(<sup>|<\/sup>)/,'')
- @para
+ @txt.gsub!(/_(https?:\/\/)/,'\1')
+ @txt.gsub!(/§/i,'\S')
+ @txt.gsub!(/£/i,'\pounds')
+ @txt.gsub!(/å/i,'\aa')
+ @txt.gsub!(/æ/i,'\ae')
+ @txt.gsub!(/ø/i,'\o')
+ @txt.gsub!(/Å/i,'\AA')
+ @txt.gsub!(/Æ/i,'\AE')
+ @txt.gsub!(/Ø/i,'\O')
+ @txt.gsub!(/<a href=".+?">/i,' ')
+ @txt.gsub!(/<\/a>/i,' ')
+ @txt.gsub!(/<:ee>/i,'')
+ @txt.gsub!(/<!>/i,' ')
+ @txt.gsub!(/<b>(.+?)<\/b>/,'\*\1\*')
+ @txt.gsub!(/<i>(.+?)<\/i>/,'\/\1\/')
+ @txt.gsub!(/<u>(.+?)<\/u>/,'\_\1\_')
+ @txt.gsub!(/@/i,'@@')
+ @txt.gsub!(/\{/,'@{'); @txt.gsub!(/\}/,'@}')
+ #@txt.gsub!(/(^|[\s*!\/#_-])\{/,'\1@{'); @txt.gsub!(/\}([\s*!\/#_-]|$)/,'@}\1')
+ @txt.gsub!(/(?:&nbsp;|#{Mx[:nbsp]})+/,' ') # ~ character for hardspace
+ @txt.gsub!(/&(\S+?);/,' ')
+ @txt.gsub!(/&/,'<=and>')
+ @txt.gsub!(/(\s+&\s+)/,' and ')
+ @txt.gsub!(/(\&)/,"\\&")
+ @txt.gsub!(/"(.+?)"/,"`\\1'") # open & close "
+ @txt.gsub!(/\s+"/," `") # open "
+ @txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open "
+ @txt.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close "
+ @txt.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close "
+ @txt.gsub!(/"(\.|,)/,"'") # close "
+ @txt.gsub!(/\s+'/," `") # open '
+ @txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open '
+ @txt.gsub!(/(<font.*?>|<\/font>)/,'')
+ @txt.gsub!(/\s*<sup>(\S+?)<\/sup>/,'^\1')
+ @txt.gsub!(/(<sup>|<\/sup>)/,'')
+ @txt
end
def longtable
@end_table="\\end{longtable}"
@row_break='\\\\\\'
- if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure
+ if @txt[/#{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 =~ /#{Mx[:gr_o]}Th/i
+ @@tableheader=1 if @txt =~ /#{Mx[:gr_o]}Th/i
@w=cols_width.split(/;\s+/)
@@number_of_cols=no_of_cols
@colW=[]
@@ -390,31 +403,31 @@ WOK
@colW=@colW.join
@@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" +
"\\begin{longtable}[hb]#@colW\n"
- @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}")
+ @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}")
end
- if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table")
+ if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
+ @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table")
end
- @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
+ @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
if @@tableheader==1
- if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
+ if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
tablefoot=para[/\<!f(.+?)!\>/,1]
- @para.gsub!(/\<!f(.+?)!\>/,'')
- @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,
+ @txt.gsub!(/\<!f(.+?)!\>/,'')
+ @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,
"{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&")
- @para.gsub!(/&>\s*$/,
+ @txt.gsub!(/&>\s*$/,
" #@row_break \\hline\\endhead #@row_break")
- @para="#@para \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
+ @txt="#{@txt} \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot
@@tableheader=0
@@number_of_cols=0
end
else
- 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")
+ if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
+ @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&")
+ @txt.gsub!(/&>\s*$/," #@row_break")
end
end
- @para
+ @txt
end
def scopedtable
# some features related to headers have been incorporated in longtable
@@ -423,7 +436,7 @@ WOK
@end_table="\\end{tabular}"
@row_break='\\\\\\\\'
@break_page="#@row_break\n#@row_break \n"
- if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui]
+ if @txt[/#{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,59 +445,59 @@ WOK
@colW << "p{#{col_w}cm}" if col_w
end
@@start_table="\\begin{tabular}{#@colW}\n"
- @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}")
+ @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}")
end
- if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
- @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table")
+ if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/
+ @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table")
@@table_pg_break_counter=1
end
- if @para =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u
+ if @txt =~/#{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 =
+ @txt =
"\n\n#@end_table \n" +
"#@break_page" +
"#{@@start_table}\n"
@@table_pg_break_counter=1
else
- @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
+ @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'')
@@table_pg_break_counter+=1
- tablefoot=@para[/\<!f(.+?)!\>/]
- @para.gsub!(/\<!f(.+?)!\>/,'')
+ tablefoot=@txt[/\<!f(.+?)!\>/]
+ @txt.gsub!(/\<!f(.+?)!\>/,'')
end
end
- 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")
+ if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u
+ @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&")
+ @txt.gsub!(/&>\s*$/,"#@row_break")
end
- @para
+ @txt
end
def graphics
dir=SiSU_Env::Info_env.new(@md.fns)
- @para.gsub!(/<::\s+(\S+?)\s+>/i, #watch
+ @txt.gsub!(/<::\s+(\S+?)\s+>/i, #watch
"\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}")
end
def image
dir=SiSU_Env::Info_env.new(@md.fns)
width="100"
- width=@para[/<:image.+?width=``(\d+)''.+?>/im,1]
+ width=@txt[/<:image.+?width=``(\d+)''.+?>/im,1]
width=width.to_i*0.4
- @para.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
+ @txt.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i,
"\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\2}}")
- @para.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i,
+ @txt.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i,
"\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\1}")
end
def png
# very messy clean up ! - work area, testing
- z=@para[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !
+ z=@txt[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile !
image,w,x,y=z.scan(/\S+/)
image.gsub!(/\\/,'')
- @para.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
+ @txt.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"<image #{image} not available>") # fragile match operator\\ fragile !
end
def http
# very messy clean up ! - work area, testing
- z=@para[/\\\{(.+?)\}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile !
- url=@para[/((?:https?|file|ftp):\S+)/im,1]
- if @para =~/\.(png|jpg|gif)/
+ z=@txt[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile !
+ url=@txt[/((?:https?|file|ftp):\S+)/im,1]
+ if @txt =~/\.(png|jpg|gif)/
image,w,x,y=z.scan(/\S+/)
image.gsub!(/\\/,'')
width=200
@@ -496,11 +509,11 @@ WOK
end
if image
dir=SiSU_Env::Info_env.new(@md.fns)
- @para.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile !
+ @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile !
"\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}")
else
link=z[/(.+?)\\/im,1]
- @para.gsub!(/\{.+?\}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
+ @txt.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile !
end
end
end