class SiSU_XML_Format::FormatTextObject

Attributes

banner[RW]
dob[RW]
font[RW]
format[RW]
headname[RW]
linkname[RW]
md[RW]
ocn[RW]
p_num[RW]
para_id[RW]
paranum[RW]
table[RW]
txt[RW]
url[RW]

Public Class Methods

new(md,dob) click to toggle source
# File lib/sisu/xml_format.rb, line 278
def initialize(md,dob)
  @md,@dob=md,dob
  if @dob[:ocn]=~/\d+/
    @paranum=/(\d+)/m.match(@dob[:ocn])[1]
    @headname=''
    @headname=%{<a name="h#{dob.name}"></a>} if defined? dob.name
    @p_num=SiSU_XML_Format::ParagraphNumber.new(@md,dob.ocn)
  end
  rgx=/^[1-6-]~{1,2}/ #watch
  @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx
  rgx=/~\{\d+\s+(.+?)\}~/
  @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx
end

Public Instance Methods

bold() click to toggle source
# File lib/sisu/xml_format.rb, line 487
def bold
  para_form_css('p','bold')
end
bold_header() click to toggle source
# File lib/sisu/xml_format.rb, line 597
    def bold_header
      @txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>').
        gsub(/[1-9]~/,'')
      %{<p class="bold">
    #{@txt}
  </p>
#{the_margin.num_css}
  &nbsp;&nbsp;&nbsp;
#{the_table_close}}
    end
bold_para() click to toggle source
# File lib/sisu/xml_format.rb, line 588
    def bold_para
      %{#{the_margin.txt_0}
  <p class="bold">
    #{@txt}
  </p>
#{the_margin.num_css}
  &nbsp;&nbsp;&nbsp;
#{the_table_close}}
    end
bullet() click to toggle source
# File lib/sisu/xml_format.rb, line 490
def bullet
  para_form_css('li','bullet')
end
center() click to toggle source
# File lib/sisu/xml_format.rb, line 484
def center
  para_form_css('p','center')
end
center_bold() click to toggle source
# File lib/sisu/xml_format.rb, line 616
def center_bold
  %{<p class="centerbold">#{@txt}</p>\n}
end
code() click to toggle source
# File lib/sisu/xml_format.rb, line 481
def code
  para_form_css('p','code')
end
dl() click to toggle source
# File lib/sisu/xml_format.rb, line 564
def dl #check :trailer
  "<dl><b>#{@txt}</b> #{@trailer}</dl>"
end
endnote_body() click to toggle source
# File lib/sisu/xml_format.rb, line 442
    def endnote_body
      %{
<p class="endnote">
  #{@txt}
</p>
}
    end
endnote_body_indent() click to toggle source
# File lib/sisu/xml_format.rb, line 449
    def endnote_body_indent
      %{
  <p class="endnote_indent">
    #{@txt}
  </p>
}
    end
gsub_body() click to toggle source
# File lib/sisu/xml_format.rb, line 572
    def gsub_body
#fix
      @txt=case @txt
      when /^\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 /^\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
heading_body() click to toggle source
# File lib/sisu/xml_format.rb, line 506
def heading_body
  heading_normal('p','norm')
end
heading_body0() click to toggle source
# File lib/sisu/xml_format.rb, line 509
def heading_body0
  heading_normal('h1','norm')
end
heading_body1() click to toggle source
# File lib/sisu/xml_format.rb, line 512
def heading_body1
  heading_normal('h1','norm')
end
heading_body2() click to toggle source
# File lib/sisu/xml_format.rb, line 515
def heading_body2
  heading_normal('h2','norm')
end
heading_body3() click to toggle source
# File lib/sisu/xml_format.rb, line 518
def heading_body3
  heading_normal('h3','norm')
end
heading_body4() click to toggle source
# File lib/sisu/xml_format.rb, line 521
def heading_body4
  heading_normal('h4','norm')
end
heading_body5() click to toggle source
# File lib/sisu/xml_format.rb, line 524
def heading_body5
  heading_normal('h5','norm')
end
heading_body6() click to toggle source
# File lib/sisu/xml_format.rb, line 527
def heading_body6
  heading_normal('h6','norm')
end
heading_body7() click to toggle source
# File lib/sisu/xml_format.rb, line 530
def heading_body7
  heading_normal('h7','norm')
end
heading_normal(tag,attrib) click to toggle source
# File lib/sisu/xml_format.rb, line 496
    def heading_normal(tag,attrib)
      %{
<div class="substance">
  #{@p_num.ocn_display}
  <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name}
    #{@headname}#{@txt}
  </#{tag}>
</div>
}
    end
no_paranum() click to toggle source
# File lib/sisu/xml_format.rb, line 456
    def no_paranum
      %{
<div class="substance">
  <label class="ocn">&nbsp;</label>
  <p class="norm">
    #{@txt}
  </p>
</div>
}
    end
para() click to toggle source
# File lib/sisu/xml_format.rb, line 478
def para
  para_form_css('p','norm')
end
para_form_css(tag,attrib) click to toggle source
# File lib/sisu/xml_format.rb, line 466
    def para_form_css(tag,attrib)                                                    # 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}>
    #{@txt}
  </#{tag}>#{ulc}
</div>
}
    end
scr_endnote_body() click to toggle source
# File lib/sisu/xml_format.rb, line 291
def scr_endnote_body
  "<endnote>#{@txt}</endnote> "
end
table_css_end() click to toggle source
# File lib/sisu/xml_format.rb, line 567
  def table_css_end      #<!TZ!>
    '</table>
  </p>
</div>'
  end
title_header(tag,attrib) click to toggle source
# File lib/sisu/xml_format.rb, line 533
    def title_header(tag,attrib)
      %{
<div class="content">
<#{tag} class="#{attrib}">
    #{@txt}
  </#{tag}>
</div>
}
    end
title_header1() click to toggle source
# File lib/sisu/xml_format.rb, line 542
def title_header1
  title_header('h1','tiny')
end
title_header2() click to toggle source
# File lib/sisu/xml_format.rb, line 545
def title_header2
  title_header('h2','tiny')
end
title_header3() click to toggle source
# File lib/sisu/xml_format.rb, line 548
def title_header3
  title_header('h3','tiny')
end
title_header4() click to toggle source
# File lib/sisu/xml_format.rb, line 551
def title_header4
  ''
end
title_header4_old() click to toggle source
# File lib/sisu/xml_format.rb, line 554
    def title_header4_old
      %{
<div class="substance">
  <label class="ocn">&nbsp;</label>
  <h4 class="banner">
    #{@txt}
  </h4>
</div>
}
    end
toc_head_copy_at() click to toggle source
# File lib/sisu/xml_format.rb, line 607
def toc_head_copy_at
  %{<p class="center">#{@txt}</p>\n}
end