Class: SiSU_JSON_Format::FormatTextObject
- Inherits:
-
Object
- Object
- SiSU_JSON_Format::FormatTextObject
show all
- Includes:
- SiSU_Parts_JSON
- Defined in:
- lib/sisu/json_format.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#the_line_break, #the_table_close, #the_url_decoration, #txt_close, #txt_open, #xml_close, #xml_open
#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.
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/sisu/json_format.rb', line 312
def initialize(md,t_o)
@md,@t_o=md,t_o
if t_o.class.inspect =~/Object/
@txt=if defined? t_o.obj; t_o.obj
else nil
end
@ocn=if defined? t_o.ocn; t_o.ocn.to_s
else nil
end
@headname=if t_o.is==:heading and defined? t_o.name; t_o.name
else nil
end
else
if @md.opt.act[:maintenance][:set]==:on
p __FILE__ << ':' << __LINE__.to_s
p t_o.class
p caller
end
end
if defined? @t_o.ocn
ocn=((@t_o.ocn.to_s =~/\d+/) ? @t_o.ocn : nil)
@p_num=ParagraphNumber.new(@md,ocn)
end
if @format and not @format.empty?
if @format=~/^\d:(\S+)/ headname=$1 @headname=if headname =~/^[a-zA-Z]/; %{<a name="#{headname}" id="#{headname}"></a>} else %{<a name="h#{headname}" id="h#{headname}"></a>}
end
end
end
@dob=t_o if defined? t_o.is
end
|
Instance Attribute Details
#banner ⇒ Object
Returns the value of attribute banner.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def banner
@banner
end
|
#dob ⇒ Object
Returns the value of attribute dob.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def dob
@dob
end
|
Returns the value of attribute format.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def format
@format
end
|
#headname ⇒ Object
Returns the value of attribute headname.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def headname
@headname
end
|
#link ⇒ Object
Returns the value of attribute link.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def link
@link
end
|
#linkname ⇒ Object
Returns the value of attribute linkname.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def linkname
@linkname
end
|
#md ⇒ Object
Returns the value of attribute md.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def md
@md
end
|
#ocn ⇒ Object
Returns the value of attribute ocn.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def ocn
@ocn
end
|
#p_num ⇒ Object
Returns the value of attribute p_num.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def p_num
@p_num
end
|
#paranum ⇒ Object
Returns the value of attribute paranum.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def paranum
@paranum
end
|
#table ⇒ Object
Returns the value of attribute table.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def table
@table
end
|
#txt ⇒ Object
Returns the value of attribute txt.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def txt
@txt
end
|
#url ⇒ Object
Returns the value of attribute url.
311
312
313
|
# File 'lib/sisu/json_format.rb', line 311
def url
@url
end
|
Instance Method Details
#bold ⇒ Object
354
355
356
|
# File 'lib/sisu/json_format.rb', line 354
def bold
para_form_css('p','bold')
end
|
454
455
456
457
458
459
460
461
462
463
|
# File 'lib/sisu/json_format.rb', line 454
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
445
446
447
448
449
450
451
452
453
|
# File 'lib/sisu/json_format.rb', line 445
def bold_para
%{#{the_margin.txt_0}
<p class="bold">
#{@txt}
</p>
#{the_margin.num_css}
#{the_table_close}}
end
|
#bullet ⇒ Object
357
358
359
|
# File 'lib/sisu/json_format.rb', line 357
def bullet
para_form_css('li','bullet')
end
|
#center ⇒ Object
351
352
353
|
# File 'lib/sisu/json_format.rb', line 351
def center
para_form_css('p','center')
end
|
#center_bold ⇒ Object
473
474
475
|
# File 'lib/sisu/json_format.rb', line 473
def center_bold
%{<p class="centerbold">#{@txt}</p>\n}
end
|
#code ⇒ Object
348
349
350
|
# File 'lib/sisu/json_format.rb', line 348
def code
para_form_css('p','code')
end
|
#dl ⇒ Object
421
422
423
|
# File 'lib/sisu/json_format.rb', line 421
def dl "<dl><b>#{@txt}</b> #{@trailer}</dl>"
end
|
#gsub_body ⇒ Object
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
# File 'lib/sisu/json_format.rb', line 429
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
373
374
375
|
# File 'lib/sisu/json_format.rb', line 373
def heading_body
heading_normal('p','norm')
end
|
#heading_body0 ⇒ Object
376
377
378
|
# File 'lib/sisu/json_format.rb', line 376
def heading_body0
heading_normal('h1','norm')
end
|
#heading_body1 ⇒ Object
379
380
381
|
# File 'lib/sisu/json_format.rb', line 379
def heading_body1
heading_normal('h1','norm')
end
|
#heading_body2 ⇒ Object
382
383
384
|
# File 'lib/sisu/json_format.rb', line 382
def heading_body2
heading_normal('h2','norm')
end
|
#heading_body3 ⇒ Object
385
386
387
|
# File 'lib/sisu/json_format.rb', line 385
def heading_body3
heading_normal('h3','norm')
end
|
#heading_body4 ⇒ Object
388
389
390
|
# File 'lib/sisu/json_format.rb', line 388
def heading_body4
heading_normal('h4','norm')
end
|
#heading_body5 ⇒ Object
391
392
393
|
# File 'lib/sisu/json_format.rb', line 391
def heading_body5
heading_normal('h5','norm')
end
|
#heading_body6 ⇒ Object
394
395
396
|
# File 'lib/sisu/json_format.rb', line 394
def heading_body6
heading_normal('h6','norm')
end
|
#heading_body7 ⇒ Object
397
398
399
|
# File 'lib/sisu/json_format.rb', line 397
def heading_body7
heading_normal('h7','norm')
end
|
#heading_normal(tag, attrib) ⇒ Object
363
364
365
366
367
368
369
370
371
372
|
# File 'lib/sisu/json_format.rb', line 363
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
|
#para ⇒ Object
345
346
347
|
# File 'lib/sisu/json_format.rb', line 345
def para
para_form_css('p','norm')
end
|
#table_css_end ⇒ Object
424
425
426
427
428
|
# File 'lib/sisu/json_format.rb', line 424
def table_css_end '</table>
</p>
</div>'
end
|
400
401
402
403
404
405
406
407
408
|
# File 'lib/sisu/json_format.rb', line 400
def (tag,attrib)
%{
<div class="content">
<#{tag} class="#{attrib}">
#{@txt}
</#{tag}>
</div>
}
end
|
409
410
411
|
# File 'lib/sisu/json_format.rb', line 409
def
('h1','tiny')
end
|
412
413
414
|
# File 'lib/sisu/json_format.rb', line 412
def
('h2','tiny')
end
|
415
416
417
|
# File 'lib/sisu/json_format.rb', line 415
def
('h3','tiny')
end
|
418
419
420
|
# File 'lib/sisu/json_format.rb', line 418
def
''
end
|
#toc_head_copy_at ⇒ Object
464
465
466
|
# File 'lib/sisu/json_format.rb', line 464
def toc_head_copy_at
%{<p class="center">#{@txt}</p>\n}
end
|