Class: SiSU_XML_Format::FormatTextObject

Inherits:
Object
  • Object
show all
Includes:
SiSU_Parts_XML
Defined in:
lib/sisu/xml_format.rb,
lib/sisu/xml_format.rb

Direct Known Subclasses

FormatScroll, FormatSeg, FormatToc

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SiSU_Parts_XML

#_url_path_image_base, #band1, #band2, #banner_band, #black, #blue_ink, #blue_tinge, #grey, #grey_medium, #grey_pale, #home_button_only, #ico, #png_home, #png_home_button, #set_face, #set_fonts, #table1, #table2, #the_banner, #the_color, #the_font, #the_line_break, #the_png, #the_table_close, #the_url_decoration, #txt_close, #txt_open, #white, #xml_close, #xml_open, #yellow_light

Methods included from SiSU_Parts_Generic

#footer_signature, #home, #home_txt, #i_choice, #i_home_button, #i_ico, #i_new, #rl_root, #root_http, #sisu, #sisu_txt, #sisudoc, #site, #the_icon, #the_text, #the_url, #txt_home, #txt_hp, #txt_hp_alias, #txt_signature, #urify, #url_close, #url_open

Constructor Details

#initialize(md, t_o) ⇒ FormatTextObject

Returns a new instance of FormatTextObject.



278
279
280
281
282
283
284
285
286
287
288
289
290
# 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

Instance Attribute Details

Returns the value of attribute banner.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def banner
  @banner
end

#dobObject

Returns the value of attribute dob.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def dob
  @dob
end

#fontObject

Returns the value of attribute font.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def font
  @font
end

#format(tag, attrib) ⇒ Object

Returns the value of attribute format.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def format
  @format
end

#headnameObject

Returns the value of attribute headname.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def headname
  @headname
end

Returns the value of attribute link.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def link
  @link
end

#linknameObject

Returns the value of attribute linkname.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def linkname
  @linkname
end

#mdObject

Returns the value of attribute md.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def md
  @md
end

#ocnObject

Returns the value of attribute ocn.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def ocn
  @ocn
end

#p_numObject

Returns the value of attribute p_num.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def p_num
  @p_num
end

#para_idObject

Returns the value of attribute para_id.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def para_id
  @para_id
end

#paranumObject

Returns the value of attribute paranum.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def paranum
  @paranum
end

#tableObject

Returns the value of attribute table.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def table
  @table
end

#txtObject

Returns the value of attribute txt.



277
278
279
# File 'lib/sisu/xml_format.rb', line 277

def txt
  @txt
end

#urlObject

Returns the value of attribute url.



396
397
398
# File 'lib/sisu/xml_format.rb', line 396

def url
  @url
end

Instance Method Details

#boldObject



487
488
489
# File 'lib/sisu/xml_format.rb', line 487

def bold
  para_form_css('p','bold')
end

#bold_headerObject



597
598
599
600
601
602
603
604
605
606
# 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_paraObject



588
589
590
591
592
593
594
595
596
# 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

#bulletObject



490
491
492
# File 'lib/sisu/xml_format.rb', line 490

def bullet
  para_form_css('li','bullet')
end

#centerObject



484
485
486
# File 'lib/sisu/xml_format.rb', line 484

def center
  para_form_css('p','center')
end

#center_boldObject



616
617
618
# File 'lib/sisu/xml_format.rb', line 616

def center_bold
  %{<p class="centerbold">#{@txt}</p>\n}
end

#codeObject



481
482
483
# File 'lib/sisu/xml_format.rb', line 481

def code
  para_form_css('p','code')
end

#dlObject

check :trailer



564
565
566
# File 'lib/sisu/xml_format.rb', line 564

def dl #check :trailer
  "<dl><b>#{@txt}</b> #{@trailer}</dl>"
end

#endnote_bodyObject



442
443
444
445
446
447
448
# File 'lib/sisu/xml_format.rb', line 442

def endnote_body
  %{
<p class="endnote">
  #{@txt}
</p>
}
end

#endnote_body_indentObject



449
450
451
452
453
454
455
# File 'lib/sisu/xml_format.rb', line 449

def endnote_body_indent
  %{
  <p class="endnote_indent">
#{@txt}
  </p>
}
end

#gsub_bodyObject



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# 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_bodyObject



506
507
508
# File 'lib/sisu/xml_format.rb', line 506

def heading_body
  heading_normal('p','norm')
end

#heading_body0Object



509
510
511
# File 'lib/sisu/xml_format.rb', line 509

def heading_body0
  heading_normal('h1','norm')
end

#heading_body1Object



512
513
514
# File 'lib/sisu/xml_format.rb', line 512

def heading_body1
  heading_normal('h1','norm')
end

#heading_body2Object



515
516
517
# File 'lib/sisu/xml_format.rb', line 515

def heading_body2
  heading_normal('h2','norm')
end

#heading_body3Object



518
519
520
# File 'lib/sisu/xml_format.rb', line 518

def heading_body3
  heading_normal('h3','norm')
end

#heading_body4Object



521
522
523
# File 'lib/sisu/xml_format.rb', line 521

def heading_body4
  heading_normal('h4','norm')
end

#heading_body5Object



524
525
526
# File 'lib/sisu/xml_format.rb', line 524

def heading_body5
  heading_normal('h5','norm')
end

#heading_body6Object



527
528
529
# File 'lib/sisu/xml_format.rb', line 527

def heading_body6
  heading_normal('h6','norm')
end

#heading_body7Object



530
531
532
# File 'lib/sisu/xml_format.rb', line 530

def heading_body7
  heading_normal('h7','norm')
end

#heading_normal(tag, attrib) ⇒ Object



496
497
498
499
500
501
502
503
504
505
# 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_paranumObject



456
457
458
459
460
461
462
463
464
465
# 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

#paraObject



478
479
480
# File 'lib/sisu/xml_format.rb', line 478

def para
  para_form_css('p','norm')
end

#para_form_css(tag, attrib) ⇒ Object

regular paragraphs shaped here



466
467
468
469
470
471
472
473
474
475
476
477
# 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_bodyObject



291
292
293
# File 'lib/sisu/xml_format.rb', line 291

def scr_endnote_body
  "<endnote>#{@txt}</endnote> "
end

#table_css_endObject

<!TZ!>



567
568
569
570
571
# File 'lib/sisu/xml_format.rb', line 567

def table_css_end      #<!TZ!>
  '</table>
</p>
  </div>'
end

#title_header(tag, attrib) ⇒ Object



533
534
535
536
537
538
539
540
541
# File 'lib/sisu/xml_format.rb', line 533

def title_header(tag,attrib)
  %{
<div class="content">
<#{tag} class="#{attrib}">
#{@txt}
  </#{tag}>
</div>
}
end

#title_header1Object



542
543
544
# File 'lib/sisu/xml_format.rb', line 542

def title_header1
  title_header('h1','tiny')
end

#title_header2Object



545
546
547
# File 'lib/sisu/xml_format.rb', line 545

def title_header2
  title_header('h2','tiny')
end

#title_header3Object



548
549
550
# File 'lib/sisu/xml_format.rb', line 548

def title_header3
  title_header('h3','tiny')
end

#title_header4Object



551
552
553
# File 'lib/sisu/xml_format.rb', line 551

def title_header4
  ''
end

#title_header4_oldObject



554
555
556
557
558
559
560
561
562
563
# 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_atObject



607
608
609
# File 'lib/sisu/xml_format.rb', line 607

def toc_head_copy_at
  %{<p class="center">#{@txt}</p>\n}
end