Class: SiSU_XML_Format::FormatTextObject
- Inherits:
-
Object
- Object
- SiSU_XML_Format::FormatTextObject
show all
- Includes:
- SiSU_Parts_XML
- Defined in:
- lib/sisu/xml_format.rb,
lib/sisu/xml_format.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#_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
#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
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}/ @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
#banner ⇒ Object
Returns the value of attribute banner.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def banner
@banner
end
|
#dob ⇒ Object
Returns the value of attribute dob.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def dob
@dob
end
|
#font ⇒ Object
Returns the value of attribute font.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def font
@font
end
|
Returns the value of attribute format.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def format
@format
end
|
#headname ⇒ Object
Returns the value of attribute headname.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def headname
@headname
end
|
#link ⇒ Object
Returns the value of attribute link.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def link
@link
end
|
#linkname ⇒ Object
Returns the value of attribute linkname.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def linkname
@linkname
end
|
#md ⇒ Object
Returns the value of attribute md.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def md
@md
end
|
#ocn ⇒ Object
Returns the value of attribute ocn.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def ocn
@ocn
end
|
#p_num ⇒ Object
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_id ⇒ Object
Returns the value of attribute para_id.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def para_id
@para_id
end
|
#paranum ⇒ Object
Returns the value of attribute paranum.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def paranum
@paranum
end
|
#table ⇒ Object
Returns the value of attribute table.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def table
@table
end
|
#txt ⇒ Object
Returns the value of attribute txt.
277
278
279
|
# File 'lib/sisu/xml_format.rb', line 277
def txt
@txt
end
|
#url ⇒ Object
Returns the value of attribute url.
396
397
398
|
# File 'lib/sisu/xml_format.rb', line 396
def url
@url
end
|
Instance Method Details
#bold ⇒ Object
487
488
489
|
# File 'lib/sisu/xml_format.rb', line 487
def bold
para_form_css('p','bold')
end
|
597
598
599
600
601
602
603
604
605
606
|
# File 'lib/sisu/xml_format.rb', line 597
def
@txt=@txt.gsub(/[1-9]~(\S+)/,'<a name="\1"></a>').
gsub(/[1-9]~/,'')
%{<p class="bold">
#{@txt}
</p>
#{the_margin.num_css}
#{the_table_close}}
end
|
#bold_para ⇒ Object
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}
#{the_table_close}}
end
|
#bullet ⇒ Object
490
491
492
|
# File 'lib/sisu/xml_format.rb', line 490
def bullet
para_form_css('li','bullet')
end
|
#center ⇒ Object
484
485
486
|
# File 'lib/sisu/xml_format.rb', line 484
def center
para_form_css('p','center')
end
|
#center_bold ⇒ Object
616
617
618
|
# File 'lib/sisu/xml_format.rb', line 616
def center_bold
%{<p class="centerbold">#{@txt}</p>\n}
end
|
#code ⇒ Object
481
482
483
|
# File 'lib/sisu/xml_format.rb', line 481
def code
para_form_css('p','code')
end
|
#dl ⇒ Object
564
565
566
|
# File 'lib/sisu/xml_format.rb', line 564
def dl "<dl><b>#{@txt}</b> #{@trailer}</dl>"
end
|
#endnote_body ⇒ Object
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_indent ⇒ Object
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_body ⇒ Object
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
@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 ⇒ Object
506
507
508
|
# File 'lib/sisu/xml_format.rb', line 506
def heading_body
heading_normal('p','norm')
end
|
#heading_body0 ⇒ Object
509
510
511
|
# File 'lib/sisu/xml_format.rb', line 509
def heading_body0
heading_normal('h1','norm')
end
|
#heading_body1 ⇒ Object
512
513
514
|
# File 'lib/sisu/xml_format.rb', line 512
def heading_body1
heading_normal('h1','norm')
end
|
#heading_body2 ⇒ Object
515
516
517
|
# File 'lib/sisu/xml_format.rb', line 515
def heading_body2
heading_normal('h2','norm')
end
|
#heading_body3 ⇒ Object
518
519
520
|
# File 'lib/sisu/xml_format.rb', line 518
def heading_body3
heading_normal('h3','norm')
end
|
#heading_body4 ⇒ Object
521
522
523
|
# File 'lib/sisu/xml_format.rb', line 521
def heading_body4
heading_normal('h4','norm')
end
|
#heading_body5 ⇒ Object
524
525
526
|
# File 'lib/sisu/xml_format.rb', line 524
def heading_body5
heading_normal('h5','norm')
end
|
#heading_body6 ⇒ Object
527
528
529
|
# File 'lib/sisu/xml_format.rb', line 527
def heading_body6
heading_normal('h6','norm')
end
|
#heading_body7 ⇒ Object
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_paranum ⇒ Object
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"> </label>
<p class="norm">
#{@txt}
</p>
</div>
}
end
|
#para ⇒ Object
478
479
480
|
# File 'lib/sisu/xml_format.rb', line 478
def para
para_form_css('p','norm')
end
|
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) 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 ⇒ Object
291
292
293
|
# File 'lib/sisu/xml_format.rb', line 291
def scr_endnote_body
"<endnote>#{@txt}</endnote> "
end
|
#table_css_end ⇒ Object
567
568
569
570
571
|
# File 'lib/sisu/xml_format.rb', line 567
def table_css_end '</table>
</p>
</div>'
end
|
533
534
535
536
537
538
539
540
541
|
# File 'lib/sisu/xml_format.rb', line 533
def (tag,attrib)
%{
<div class="content">
<#{tag} class="#{attrib}">
#{@txt}
</#{tag}>
</div>
}
end
|
542
543
544
|
# File 'lib/sisu/xml_format.rb', line 542
def
('h1','tiny')
end
|
545
546
547
|
# File 'lib/sisu/xml_format.rb', line 545
def
('h2','tiny')
end
|
548
549
550
|
# File 'lib/sisu/xml_format.rb', line 548
def
('h3','tiny')
end
|
551
552
553
|
# File 'lib/sisu/xml_format.rb', line 551
def
''
end
|
554
555
556
557
558
559
560
561
562
563
|
# File 'lib/sisu/xml_format.rb', line 554
def
%{
<div class="substance">
<label class="ocn"> </label>
<h4 class="banner">
#{@txt}
</h4>
</div>
}
end
|
#toc_head_copy_at ⇒ Object
607
608
609
|
# File 'lib/sisu/xml_format.rb', line 607
def toc_head_copy_at
%{<p class="center">#{@txt}</p>\n}
end
|