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.
280
281
282
283
284
285
286
287
288
289
290
291
292
|
# File 'lib/sisu/xml_format.rb', line 280
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.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def banner
@banner
end
|
#dob ⇒ Object
Returns the value of attribute dob.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def dob
@dob
end
|
#font ⇒ Object
Returns the value of attribute font.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def font
@font
end
|
Returns the value of attribute format.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def format
@format
end
|
#headname ⇒ Object
Returns the value of attribute headname.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def headname
@headname
end
|
#link ⇒ Object
Returns the value of attribute link.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def link
@link
end
|
#linkname ⇒ Object
Returns the value of attribute linkname.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def linkname
@linkname
end
|
#md ⇒ Object
Returns the value of attribute md.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def md
@md
end
|
#ocn ⇒ Object
Returns the value of attribute ocn.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def ocn
@ocn
end
|
#p_num ⇒ Object
Returns the value of attribute p_num.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def p_num
@p_num
end
|
#para_id ⇒ Object
Returns the value of attribute para_id.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def para_id
@para_id
end
|
#paranum ⇒ Object
Returns the value of attribute paranum.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def paranum
@paranum
end
|
#table ⇒ Object
Returns the value of attribute table.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def table
@table
end
|
#txt ⇒ Object
Returns the value of attribute txt.
279
280
281
|
# File 'lib/sisu/xml_format.rb', line 279
def txt
@txt
end
|
#url ⇒ Object
Returns the value of attribute url.
398
399
400
|
# File 'lib/sisu/xml_format.rb', line 398
def url
@url
end
|
Instance Method Details
#bold ⇒ Object
489
490
491
|
# File 'lib/sisu/xml_format.rb', line 489
def bold
para_form_css('p','bold')
end
|
599
600
601
602
603
604
605
606
607
608
|
# File 'lib/sisu/xml_format.rb', line 599
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
590
591
592
593
594
595
596
597
598
|
# File 'lib/sisu/xml_format.rb', line 590
def bold_para
%{#{the_margin.txt_0}
<p class="bold">
#{@txt}
</p>
#{the_margin.num_css}
#{the_table_close}}
end
|
#bullet ⇒ Object
492
493
494
|
# File 'lib/sisu/xml_format.rb', line 492
def bullet
para_form_css('li','bullet')
end
|
#center ⇒ Object
486
487
488
|
# File 'lib/sisu/xml_format.rb', line 486
def center
para_form_css('p','center')
end
|
#center_bold ⇒ Object
618
619
620
|
# File 'lib/sisu/xml_format.rb', line 618
def center_bold
%{<p class="centerbold">#{@txt}</p>\n}
end
|
#code ⇒ Object
483
484
485
|
# File 'lib/sisu/xml_format.rb', line 483
def code
para_form_css('p','code')
end
|
#dl ⇒ Object
566
567
568
|
# File 'lib/sisu/xml_format.rb', line 566
def dl "<dl><b>#{@txt}</b> #{@trailer}</dl>"
end
|
#endnote_body ⇒ Object
444
445
446
447
448
449
450
|
# File 'lib/sisu/xml_format.rb', line 444
def endnote_body
%{
<p class="endnote">
#{@txt}
</p>
}
end
|
#endnote_body_indent ⇒ Object
451
452
453
454
455
456
457
|
# File 'lib/sisu/xml_format.rb', line 451
def endnote_body_indent
%{
<p class="endnote_indent">
#{@txt}
</p>
}
end
|
#gsub_body ⇒ Object
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
# File 'lib/sisu/xml_format.rb', line 574
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
508
509
510
|
# File 'lib/sisu/xml_format.rb', line 508
def heading_body
heading_normal('p','norm')
end
|
#heading_body0 ⇒ Object
511
512
513
|
# File 'lib/sisu/xml_format.rb', line 511
def heading_body0
heading_normal('h1','norm')
end
|
#heading_body1 ⇒ Object
514
515
516
|
# File 'lib/sisu/xml_format.rb', line 514
def heading_body1
heading_normal('h1','norm')
end
|
#heading_body2 ⇒ Object
517
518
519
|
# File 'lib/sisu/xml_format.rb', line 517
def heading_body2
heading_normal('h2','norm')
end
|
#heading_body3 ⇒ Object
520
521
522
|
# File 'lib/sisu/xml_format.rb', line 520
def heading_body3
heading_normal('h3','norm')
end
|
#heading_body4 ⇒ Object
523
524
525
|
# File 'lib/sisu/xml_format.rb', line 523
def heading_body4
heading_normal('h4','norm')
end
|
#heading_body5 ⇒ Object
526
527
528
|
# File 'lib/sisu/xml_format.rb', line 526
def heading_body5
heading_normal('h5','norm')
end
|
#heading_body6 ⇒ Object
529
530
531
|
# File 'lib/sisu/xml_format.rb', line 529
def heading_body6
heading_normal('h6','norm')
end
|
#heading_body7 ⇒ Object
532
533
534
|
# File 'lib/sisu/xml_format.rb', line 532
def heading_body7
heading_normal('h7','norm')
end
|
#heading_normal(tag, attrib) ⇒ Object
498
499
500
501
502
503
504
505
506
507
|
# File 'lib/sisu/xml_format.rb', line 498
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
458
459
460
461
462
463
464
465
466
467
|
# File 'lib/sisu/xml_format.rb', line 458
def no_paranum
%{
<div class="substance">
<label class="ocn"> </label>
<p class="norm">
#{@txt}
</p>
</div>
}
end
|
#para ⇒ Object
480
481
482
|
# File 'lib/sisu/xml_format.rb', line 480
def para
para_form_css('p','norm')
end
|
regular paragraphs shaped here
468
469
470
471
472
473
474
475
476
477
478
479
|
# File 'lib/sisu/xml_format.rb', line 468
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
293
294
295
|
# File 'lib/sisu/xml_format.rb', line 293
def scr_endnote_body
"<endnote>#{@txt}</endnote> "
end
|
#table_css_end ⇒ Object
569
570
571
572
573
|
# File 'lib/sisu/xml_format.rb', line 569
def table_css_end '</table>
</p>
</div>'
end
|
535
536
537
538
539
540
541
542
543
|
# File 'lib/sisu/xml_format.rb', line 535
def (tag,attrib)
%{
<div class="content">
<#{tag} class="#{attrib}">
#{@txt}
</#{tag}>
</div>
}
end
|
544
545
546
|
# File 'lib/sisu/xml_format.rb', line 544
def
('h1','tiny')
end
|
547
548
549
|
# File 'lib/sisu/xml_format.rb', line 547
def
('h2','tiny')
end
|
550
551
552
|
# File 'lib/sisu/xml_format.rb', line 550
def
('h3','tiny')
end
|
553
554
555
|
# File 'lib/sisu/xml_format.rb', line 553
def
''
end
|
556
557
558
559
560
561
562
563
564
565
|
# File 'lib/sisu/xml_format.rb', line 556
def
%{
<div class="substance">
<label class="ocn"> </label>
<h4 class="banner">
#{@txt}
</h4>
</div>
}
end
|
#toc_head_copy_at ⇒ Object
609
610
611
|
# File 'lib/sisu/xml_format.rb', line 609
def toc_head_copy_at
%{<p class="center">#{@txt}</p>\n}
end
|