chickadee » html-parser » make-html-parser

make-html-parser #!rest keysprocedure

Returns a procedure of two arguments, an initial seed and an optional input port, which parses the HTML document from the port with the callbacks specified in the plist KEYS (using normal, quoted symbols, for portability and to avoid making this a macro). The following callbacks are recognized:

 START: TAG ATTRS SEED VIRTUAL?
     fdown in foldts, called when a start-tag is encountered.
   TAG:         tag name
   ATTRS:       tag attributes as a alist
   SEED:        current seed value
   VIRTUAL?:    #t iff this start tag was inserted to fix the HTML tree
 END: TAG ATTRS PARENT-SEED SEED VIRTUAL?
     fup in foldts, called when an end-tag is encountered.
   TAG:         tag name
   ATTRS:       tag attributes of the corresponding start tag
   PARENT-SEED: parent seed value (i.e. seed passed to the start tag)
   SEED:        current seed value
   VIRTUAL?:    #t iff this end tag was inserted to fix the HTML tree
 TEXT: TEXT SEED
     fhere in foldts, called when any text is encountered.  May be
     called multiple times between a start and end tag, so you need
     to string-append yourself if desired.
   TEXT:        entity-decoded text
   SEED:        current seed value
 COMMENT: TEXT SEED
     fhere on comment data
 DECL: NAME ATTRS SEED
     fhere on declaration data
     
 PROCESS: LIST SEED
     fhere on process-instruction data

In addition, entity-mappings may be overriden with the ENTITIES: keyword.