Module: Raggle::HTML::Parser

Module | Raggle::HTML::Parser
In: | raggle (CVS)

Basic HTML parser.

### Methods

each_token parse_attributes

### Constants

NO_ATTRIBUTES | = | {}.freeze
ATTRIBUTE_LIST_RE | = | /\s*([^>=\s]+)\s*(?:=\s*(?:(?:['"]([^'">]*)['"])|([^'"\s>]+)))?/
PARSER_RE | = | %r!<(/?\w+[^>]*?/?)>|([^<]*)!m

### Public Class methods

each_token(source) {|:END_TAG, tag[1..-1], NO_ATTRIBUTES| ...}

Parses HTML in `source` and invokes block with each token as a paramater.

Parameters to the block:

     token id   | data        | attributes
     :TEXT      | text        | NO_ATTRIBUTES
     :START_TAG | tag's name  | attributes of current tag
     :END_TAG   | tag's name  | NO_ATTRIBUTES

source: | HTML source

parse_attributes(source)

Parses tag’s attributes and returns them in a hash.

[Validate]