Class: SiSU_AO::Output
- Inherits:
-
Object
- Object
- SiSU_AO::Output
- Defined in:
- lib/sisu/ao.rb
Instance Method Summary collapse
- #hard_output ⇒ Object
- #idx_html_hard_output ⇒ Object
-
#initialize(fn, md, data) ⇒ Output
constructor
A new instance of Output.
- #make_marshal_content ⇒ Object
- #make_marshal_idx_html ⇒ Object
- #make_marshal_idx_sst_html_seg ⇒ Object
- #make_marshal_idx_sst_rel ⇒ Object
- #make_marshal_idx_xhtml ⇒ Object
- #make_marshal_map_name_ocn_htmlseg ⇒ Object
- #make_marshal_map_nametags ⇒ Object
- #make_marshal_metadata ⇒ Object
- #screen_dump(o) ⇒ Object
- #screen_output(data) ⇒ Object
- #screen_print(t_o) ⇒ Object
Constructor Details
Instance Method Details
#hard_output ⇒ Object
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/sisu/ao.rb', line 433 def hard_output if @md.opt.act[:maintenance][:set]==:on =@cf.. @data.each {|o| .puts o.inspect.sub(/:0x[0-9a-f]{8}\s/,': ')} #to make diffing easier filename_txt=@cf..file_txt @data.each do |o| if defined? o.ocn filename_txt.puts case o.is when :heading "[#{o.is.to_s} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}" else "[#{o.is.to_s} [#{o.ocn}]] #{o.obj}" end else filename_txt.puts case o.is when :meta "[m~#{o.tag}] #{o.obj}" else "[#{o.is.to_s}] #{o.obj}" end end end filename_debug=@cf.file_debug @data.each do |o| if defined? o.ocn case o.is when :heading filename_debug.puts "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" end end end else hard="#{@dir.processing_path.ao}/#{@md.fns}.meta" File.unlink(hard) if FileTest.file?(hard) hard="#{@dir.processing_path.ao}/#{@md.fns}.txt" File.unlink(hard) if FileTest.file?(hard) hard="#{@dir.processing_path.ao}/#{@md.fns}.debug.txt" File.unlink(hard) if FileTest.file?(hard) end end |
#idx_html_hard_output ⇒ Object
480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/sisu/ao.rb', line 480 def idx_html_hard_output if @md.book_idx \ and @md.opt.act[:maintenance][:set]==:on =@cf. if @data.is_a?(Array) @data.each {|s| p s.inspect + "\n" unless s.is_a?(String)} @data.each {|s| .puts s.strip + "\n" unless s.strip.empty?} end else hard_idx_html="#{@dir.processing_path.ao}/#{@md.fns}.idx.html" File.unlink(hard_idx_html) if FileTest.file?(hard_idx_html) end end |
#make_marshal_content ⇒ Object
472 473 474 475 |
# File 'lib/sisu/ao.rb', line 472 def make_marshal_content marshal_ao=@make.marshal.ao_content File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array) end |
#make_marshal_idx_html ⇒ Object
503 504 505 506 507 |
# File 'lib/sisu/ao.rb', line 503 def make_marshal_idx_html marshal_ao=@make.marshal.ao_idx_html File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \ if @data.is_a?(Array) end |
#make_marshal_idx_sst_html_seg ⇒ Object
493 494 495 496 497 |
# File 'lib/sisu/ao.rb', line 493 def make_marshal_idx_sst_html_seg marshal_ao=@make.marshal.ao_idx_sst_rel_html_seg File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \ if @data.is_a?(Array) end |
#make_marshal_idx_sst_rel ⇒ Object
498 499 500 501 502 |
# File 'lib/sisu/ao.rb', line 498 def make_marshal_idx_sst_rel marshal_ao=@make.marshal.ao_idx_sst_rel File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \ if @data.is_a?(Array) end |
#make_marshal_idx_xhtml ⇒ Object
508 509 510 511 512 |
# File 'lib/sisu/ao.rb', line 508 def make_marshal_idx_xhtml marshal_ao=@make.marshal.ao_idx_xhtml File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \ if @data.is_a?(Array) end |
#make_marshal_map_name_ocn_htmlseg ⇒ Object
518 519 520 521 522 |
# File 'lib/sisu/ao.rb', line 518 def make_marshal_map_name_ocn_htmlseg marshal_ao=@make.marshal.ao_map_ocn_htmlseg File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \ if @data.is_a?(Hash) end |
#make_marshal_map_nametags ⇒ Object
513 514 515 516 517 |
# File 'lib/sisu/ao.rb', line 513 def marshal_ao=@make.marshal. File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} \ if @data.is_a?(Hash) end |
#make_marshal_metadata ⇒ Object
476 477 478 479 |
# File 'lib/sisu/ao.rb', line 476 def marshal_ao=@make.marshal. File.open(marshal_ao,'w'){|f| Marshal.dump(@data,f)} if @data.is_a?(Array) end |
#screen_dump(o) ⇒ Object
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/sisu/ao.rb', line 399 def screen_dump(o) if defined? o.of print %{OF: #{o.of}; } end if defined? o.is print %{IS: #{o.is.to_s}; } end if defined? o.ocn print %{OCN: #{o.ocn}; } end if defined? o.node print %{NODE: #{o.node}; } end if defined? o.parent print %{Parent: #{o.parent}; } end if defined? o.obj and not o.obj.empty? puts %{\n#{o.obj}; } else "\n" end end |
#screen_output(data) ⇒ Object
425 426 427 428 429 430 431 432 |
# File 'lib/sisu/ao.rb', line 425 def screen_output(data) data.each do |o| print o.class screen_print(o.ocn) screen_print(o.obj) puts "\n" end end |
#screen_print(t_o) ⇒ Object
420 421 422 423 424 |
# File 'lib/sisu/ao.rb', line 420 def screen_print(t_o) if defined? t_o print ' ' + t_o.to_s end end |