Class: ODDB::HtmlFormatter

Inherits:
AbstractFormatter
  • Object
show all
Defined in:
src/util/html_parser.rb,
test/test_util/html_parser.rb

Direct Known Subclasses

DocData::DoctorFormatter, Interaction::Formatter, MedData::Formatter

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (HtmlFormatter) initialize(writer)

A new instance of HtmlFormatter



444
445
446
447
448
449
# File 'src/util/html_parser.rb', line 444

def initialize(writer)
  super
  @fonthandler_stack = []
  @table_stack = []
  @link_stack = []
end

Instance Attribute Details

Returns the value of attribute link_stack



12
13
14
# File 'test/test_util/html_parser.rb', line 12

def link_stack
  @link_stack
end

- (Object) table_stack

Returns the value of attribute table_stack



12
13
14
# File 'test/test_util/html_parser.rb', line 12

def table_stack
  @table_stack
end

- (Object) tablehandler

Returns the value of attribute tablehandler



12
13
14
# File 'test/test_util/html_parser.rb', line 12

def tablehandler
  @tablehandler
end

Instance Method Details

- (Object) pop_alignment



450
451
452
# File 'src/util/html_parser.rb', line 450

def pop_alignment
  @align_stack.pop
end

- (Object) pop_fonthandler



453
454
455
456
457
# File 'src/util/html_parser.rb', line 453

def pop_fonthandler
  @fonthandler_stack.pop
  @fonthandler = @fonthandler_stack.last
  @writer.new_fonthandler(@fonthandler)
end


458
459
460
461
462
# File 'src/util/html_parser.rb', line 458

def pop_link
  @link_stack.pop
  @linkhandler = @link_stack.last
  @writer.new_linkhandler(@linkhandler)
end

- (Object) pop_table



463
464
465
466
467
# File 'src/util/html_parser.rb', line 463

def pop_table
  @table_stack.pop
  @tablehandler = @table_stack.last
  @writer.new_tablehandler(@tablehandler)
end

- (Object) pop_tablecell



470
471
# File 'src/util/html_parser.rb', line 470

def pop_tablecell
end

- (Object) pop_tablerow



468
469
# File 'src/util/html_parser.rb', line 468

def pop_tablerow
end

- (Object) push_alignment(alignment)



472
473
474
475
476
477
# File 'src/util/html_parser.rb', line 472

def push_alignment(alignment)
  if(@align_stack.last != alignment)
    @writer.new_alignment(alignment)
  end
  @align_stack.push(alignment)
end

- (Object) push_fonthandler(attributes)



483
484
485
486
487
# File 'src/util/html_parser.rb', line 483

def push_fonthandler(attributes)
  @fonthandler = HtmlFontHandler.new(attributes)
  @fonthandler_stack << @fonthandler
  @writer.new_fonthandler(@fonthandler)
end


478
479
480
481
482
# File 'src/util/html_parser.rb', line 478

def push_link(attributes)
  @linkhandler = HtmlLinkHandler.new(attributes)
  @link_stack << @linkhandler
  @writer.new_linkhandler(@linkhandler)
end

- (Object) push_table(attributes)



488
489
490
491
492
# File 'src/util/html_parser.rb', line 488

def push_table(attributes)
  @tablehandler = HtmlTableHandler.new(attributes)
  @table_stack << @tablehandler 
  @writer.new_tablehandler(@tablehandler)      
end

- (Object) push_tablecell(attributes)



493
494
495
496
497
# File 'src/util/html_parser.rb', line 493

def push_tablecell(attributes)
  unless(@tablehandler.nil?)
    @tablehandler.next_cell(attributes)
  end
end

- (Object) push_tablerow(attributes)



498
499
500
501
502
# File 'src/util/html_parser.rb', line 498

def push_tablerow(attributes)
  unless(@tablehandler.nil?)
    @tablehandler.next_row(attributes)
  end
end

- (Object) send_image(src)



503
504
505
# File 'src/util/html_parser.rb', line 503

def send_image(src)
  @writer.send_image(src)
end

- (Object) send_meta(attrs)



506
507
508
# File 'src/util/html_parser.rb', line 506

def send_meta(attrs)
  @writer.send_meta(attrs)
end