class SiSU_XHTML_EPUB2_Format::FormatTextObject
Attributes
format[RW]
headname[RW]
link[RW]
linkname[RW]
md[RW]
ocn[RW]
p_num[RW]
paranum[RW]
t_o[RW]
table[RW]
txt[RW]
url[RW]
Public Class Methods
new(md,t_o)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1863 def initialize(md,t_o) @md,@t_o=md,t_o if t_o.is_a?(Hash) @txt =t_o[:txt] || nil @ocn =t_o[:ocn] || nil @ocn_display =t_o[:ocn_display] || nil @headname =t_o[:headname] || nil @trailer =t_o[:trailer] || nil @endnote_part_a =t_o[:endnote_part_a] || nil @endnote_part_b =t_o[:endnote_part_b] || nil @lnk_url =t_o[:lnk_url] || nil @lnk_txt =t_o[:lnk_txt] || nil @format =t_o[:format] || nil @target =t_o[:target] || nil #occasionally passed but not used if @format and not @format.empty? if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/ headname=$1 #format[/\d~(\S+)/m,1] @headname=(headname =~/^[a-zA-Z]/) \ ? %{<id="#{headname}">} : %{<id="h#{headname}"></a>} @headname=(headname =~/^[a-zA-Z]/) \ ? %{<a name="#{headname}" id="#{headname}"></a>} : %{<a name="h#{headname}" id="h#{headname}"></a>} end end elsif t_o.class.inspect =~/Object/ @dob=t_o if defined? t_o.is @named=nametags_seg(@dob) @txt=((defined? t_o.obj) ? t_o.obj : nil) @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil) @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else if @md.opt.act[:maintenance][:set]==:on p __FILE__ << ':' << __LINE__.to_s p t_o.class p caller end end if @txt and not @txt.empty? @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) end
Public Instance Methods
alt()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1961 def alt para_form_css('p','alt',@txt) end
block()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1958 def block para_form_css('p','block',@txt) end
bold()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1973 def bold para_form_css('p','bold',@txt) end
bold_heading()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2089 def bold_heading #unused @txt=@txt.gsub(/[1-9]~\S+/,''). gsub(/[1-9]~/,'') %{<p class="bold"> #{@txt} </p> #{the_margin.num_css} #{$ep[:hsp]*3} #{the_table_close}} end
bold_para()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2080 def bold_para %{#{the_margin.txt_0} <p class="bold"> #{@txt} </p> #{the_margin.num_css} #{$ep[:hsp]*3} #{the_table_close}} end
break()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1987 def break @txt=@txt.gsub(/#{Mx[:br_page_new]}|#{Mx[:br_page]}|#{Mx[:br_page_line]}/,'<hr /><br />'). gsub(/#{Mx[:br_obj]}/,'<hr style="width:30%" /><br />') para_form_css('p','norm',@txt) end
bullet()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1976 def bullet para_form_css('li','bullet',@txt) end
center()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1970 def center para_form_css('p','center',@txt) end
center_bold()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2111 def center_bold @txt=SanitizeXML.xml(@txt) %{<p class="centerbold">#{@txt}</p>\n} end
code()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1967 def code para_form_css('p','code',@txt) end
dl()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2057 def dl #check :trailer "<dl><b>#{@txt}</b> #{@trailer}</dl>" end
endnote_body()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1916 def endnote_body %{ <p class="endnote"> #{@txt} </p> } end
endnote_body_indent()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1923 def endnote_body_indent %{ <p class="endnote_indent"> #{@txt} </p> } end
group()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1955 def group para_form_css('p','group',@txt) end
gsub_body()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2065 def gsub_body #unused @txt=case @txt when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/ @txt.gsub(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'<b>(\1)</b>'). gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1<b>(\2)</b>') when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/ @txt.gsub(/^\((\d+|[a-z])+\)/,'<b>(\1)</b>'). gsub(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1<b>(\2)</b>') when /^\s*\d{1,3}\.\s/ @txt.gsub(/^\s*(\d+\.)/,'<b>\1</b>') when /^\s*[A-Z]\.\s/ @txt.gsub(/^\s*([A-Z]\.)/,'<b>\1</b>') else @txt end end
no_paranum()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1930 def no_paranum %{ <div class="substance"> <label class="ocn">#{$ep[:hsp]}</label> <p class="norm"> #{@txt} </p> </div> } end
para()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1952 def para para_form_css('p','norm',@txt) end
para_form_css(tag,attrib,txt)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1940 def para_form_css(tag,attrib,txt) # regular paragraphs shaped here ul=ulc='' ul,ulc="<ul>\n ","\n </ul>" if @tag =~/li/ %{ <div class="substance"> #{@p_num.ocn_display} #{ul}<#{tag} class="#{attrib}" #{@p_num.id}> #{@named}#{txt} </#{tag}>#{ulc} </div> } end
seg_heading4()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2038 def seg_heading4 %{ <div class="substance"> #{@p_num.ocn_display} <h1 class="norm" #{@p_num.id}> #{@txt} </h1> </div> } end
seg_heading5()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2048 def seg_heading5 seg_heading_sub('p','bold',@txt) end
seg_heading6()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2051 def seg_heading6 seg_heading_sub('p','bold',@txt) end
seg_heading7()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2054 def seg_heading7 seg_heading_sub('p','bold',@txt) end
seg_heading_sub(tag,attrib,txt)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2027 def seg_heading_sub(tag,attrib,txt) txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') %{ <div class="substance"> #{@p_num.ocn_display} <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #{@named}#{@txt} </#{tag}> </div> } end
table_css_end()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2060 def table_css_end '</table> </p> </div>' end
title_heading(tag,attrib)
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1995 def title_heading(tag,attrib) %{ <div class="content"> <#{tag} class="#{attrib}"> #{@named}#{@txt} </#{tag}> </div> } end
title_heading0()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2004 def title_heading0 DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h1','tiny') end
title_heading1()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2009 def title_heading1 DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h1','tiny') end
title_heading2()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2014 def title_heading2 DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h2','tiny') end
title_heading3()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2019 def title_heading3 DISABLE[:epub][:per_section_title] \ ? '' : title_heading('h3','tiny') end
title_heading4()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2024 def title_heading4 '' end
toc_head_copy_at()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 2099 def toc_head_copy_at @txt=SanitizeXML.xml(@txt) %{<p class="center">#{@txt}</p>\n} end
verse()
click to toggle source
# File lib/sisu/xhtml_epub2_format.rb, line 1964 def verse para_form_css('p','verse',@txt) end