Changeset 38685 in project


Ignore:
Timestamp:
05/07/20 17:56:59 (7 months ago)
Author:
wasamasa
Message:

html-parser: Document remaining exported procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/html-parser

    r35716 r38685  
    8585tags removed.  No whitespace reduction or other rendering is done.
    8686
     87==== Misc
     88
     89===== make-string-reader/ci
     90
     91<procedure>(make-string-reader/ci str)</procedure>
     92
     93Generates a KMP reader that works on ports, returning the text read up
     94until the search string (or the entire port if the search string isn't
     95found).  This is O(n) in the length of the string returned, as opposed
     96to the {{find-string-from-port?}} in SSAX which uses backtracking for
     97an O(nm) algorithm.  This is hard-coded to case-insensitively match,
     98since that's what we need for HTML.  A more general utility would
     99abstract the character matching predicate and possibly provide a limit
     100on the length of the string read.
     101
     102===== html-display-escaped-string
     103
     104<procedure>(html-display-escaped-string str out)</procedure>
     105
     106Writes a HTML escaped string to the output port, replacing the
     107characters {{<>&"'}} with the appropriate HTML entities.
     108
     109===== html-escape
     110
     111<procedure>(html-escape str)</procedure>
     112
     113Returns a HTML escaped string.  Equivalent to using
     114{{html-display-escaped-string}} with a string output port.
     115
     116===== html-attr->string
     117
     118<procedure>(html-attr->string attr)</procedure>
     119
     120Format an attribute pair as string.  Both {{(name . "value")}} and
     121{{(name "value")}} are supported and are turned into
     122{{"name=\"value\""}}.
     123
     124===== html-tag->string
     125
     126<procedure>(html-tag->string tag attrs)</procedure>
     127
     128Format tag and attribute list as string.  The tag must be a symbol,
     129the attribute list is processed using {{html-attr->string}}.  For
     130example {{(html-tag->string 'a '((href "#")))}} is turned into {{"<a
     131href=\"#\">"}}.
     132
     133===== sxml-display-as-html
     134
     135<procedure>(sxml-display-as-html sxml [port])</procedure>
     136
     137Write the HTML representation of {{sxml}}, with the optional port
     138argument defaulting to {{(current-output-port)}}.  Processing
     139instructions, declarations, comments, top nodes and regular nodes are
     140handled.
     141
     142===== sxml->html
     143
     144<procedure>(sxml->html sxml)</procedure>
     145
     146Convert the HTML representation of {{sxml}} to a string.  Equivalent
     147to using {{sxml-display-as-html}} with a string output port.
     148
    87149=== Examples
    88150
     
    126188
    127189BSD-style license: [[http://synthcode.com/license.txt]].
    128 
Note: See TracChangeset for help on using the changeset viewer.