Skip to content
代码片段 群组 项目
  • Andy Green's avatar
    63d2f844
    lhp: Lightweight HTML Parser · 63d2f844
    Andy Green 创作于
    Introduce a very lightweight html5 + css2.1+ stateful stream parser, along
    the same lines as the lws json and cbor ones.
    
    This is interesting primarily because of just how low-resource it is for
    modest css + html, it uses an lwsac to hold the entirity of the css in
    memory at once but the html is parsed in chunks without any need to keep
    previous chunks around (chunks may be as small as 1 byte).
    
    A user callback receives element entry and exit callbacks with payload and
    all attributes parsed out, CSS related to the active element stack is
    parsed to provide a list of active css attributes, which takes heap for the
    duration of the parsing.
    
    In effect this provides rich information about the html and css state to
    the callback, which has the job of producing the layout in a user-defined
    way.
    
    As such, there is no DOM in memory at one time, there is only a stack of
    active elements like <html><body><div>xxx with their associated attributes
    (like class).  So as it is, it does not support DOM modification such as
    JS changing elements after parsing, although elements with interesting IDs
    could be kept around by the callback.  There is a corresponding tiny and
    relatively flat heap usage regardless of html size.
    
    Default CSS is specified as recommended in the CSS 2.1 standard.
    
    Inline <style></style> elements are supported, but not pre-html5 style= in
    element attributes, since these are incompatible with strict CSP.
    
    What the attributes should mean on your system, eg, font-size, font-family
    etc is left for the user callback to decide, along with how to lay out the
    items using the CSS attributes, and render them.
    
    Fixed point 32.32 constants are used (fraction expressed at parts in 100M)
    instead of floating point.
    
    If you have presentation needs, even on a constrained display on a
    constrained microcontroller, this makes it feasible to use standardized
    markup and styling instead of roll your own.
    63d2f844
    历史
    lhp: Lightweight HTML Parser
    Andy Green 创作于
    Introduce a very lightweight html5 + css2.1+ stateful stream parser, along
    the same lines as the lws json and cbor ones.
    
    This is interesting primarily because of just how low-resource it is for
    modest css + html, it uses an lwsac to hold the entirity of the css in
    memory at once but the html is parsed in chunks without any need to keep
    previous chunks around (chunks may be as small as 1 byte).
    
    A user callback receives element entry and exit callbacks with payload and
    all attributes parsed out, CSS related to the active element stack is
    parsed to provide a list of active css attributes, which takes heap for the
    duration of the parsing.
    
    In effect this provides rich information about the html and css state to
    the callback, which has the job of producing the layout in a user-defined
    way.
    
    As such, there is no DOM in memory at one time, there is only a stack of
    active elements like <html><body><div>xxx with their associated attributes
    (like class).  So as it is, it does not support DOM modification such as
    JS changing elements after parsing, although elements with interesting IDs
    could be kept around by the callback.  There is a corresponding tiny and
    relatively flat heap usage regardless of html size.
    
    Default CSS is specified as recommended in the CSS 2.1 standard.
    
    Inline <style></style> elements are supported, but not pre-html5 style= in
    element attributes, since these are incompatible with strict CSP.
    
    What the attributes should mean on your system, eg, font-size, font-family
    etc is left for the user callback to decide, along with how to lay out the
    items using the CSS attributes, and render them.
    
    Fixed point 32.32 constants are used (fraction expressed at parts in 100M)
    instead of floating point.
    
    If you have presentation needs, even on a constrained display on a
    constrained microcontroller, this makes it feasible to use standardized
    markup and styling instead of roll your own.
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
lhp-104-212-red.jpg 18.92 KiB