Method: SGMLParser#parse_comment
- Defined in:
- lib/web/htmlparser/sgml-parser.rb
#parse_comment(i) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/web/htmlparser/sgml-parser.rb', line 160 def parse_comment(i) rawdata = @rawdata if rawdata[i, 4] != '<!--' raise RuntimeError, 'unexpected call to handle_comment' end match = rawdata.index(Commentclose, i) return nil unless match matched_length = $&.length j = match handle_comment(rawdata[i+4..(j-1)]) j = match + matched_length return j-i end |