Class: ODDB::HtmlParser

Inherits:
BasicHtmlParser show all
Defined in:
src/util/html_parser.rb

Direct Known Subclasses

Interaction::Parser

Constant Summary

Constants inherited from BasicHtmlParser

Entitydefs

Instance Method Summary (collapse)

Methods inherited from BasicHtmlParser

#end_table, #end_td, #end_tr, #finish_endtag, #start_table, #start_td, #start_tr, #unknown_entityref

Instance Method Details

- (Object) do_img(attrs)



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'src/util/html_parser.rb', line 113

def do_img(attrs)
  align = nil
  alt = '(image)'
  ismap = nil
  src = nil
  width = 0
  height = 0
  for attrname, value in attrs
    if attrname == 'align'
      align = value
    end
    if attrname == 'alt'
      alt = value
    end
    if attrname == 'ismap'
      ismap = value
    end
    if attrname == 'src'
      src = value
    end
    if attrname == 'width'
      width = value.to_i
    end
    if attrname == 'height'
      height = value.to_i
    end
  end
  handle_image(src, alt, ismap, align, width, height)
end

- (Object) do_meta(attrs)



142
143
144
# File 'src/util/html_parser.rb', line 142

def do_meta(attrs)
  @formatter.send_meta(attrs)
end

- (Object) end_a



145
146
147
# File 'src/util/html_parser.rb', line 145

def end_a
  @formatter.pop_link
end

- (Object) end_font



148
149
150
# File 'src/util/html_parser.rb', line 148

def end_font
  @formatter.pop_fonthandler
end

- (Object) feed(data)



151
152
153
# File 'src/util/html_parser.rb', line 151

def feed(data)
  super(data.gsub("\302\222", "’"))
end

- (Object) handle_image(src, *args)



154
155
156
# File 'src/util/html_parser.rb', line 154

def handle_image(src, *args)
  @formatter.send_image(src.to_s.gsub(/["']/u, ''))
end

- (Object) start_a(attrs)



157
158
159
# File 'src/util/html_parser.rb', line 157

def start_a(attrs)
  @formatter.push_link(attrs)
end

- (Object) start_font(attrs)



160
161
162
# File 'src/util/html_parser.rb', line 160

def start_font(attrs)
  @formatter.push_fonthandler(attrs)
end