Releases: byteface/domonic
libs
Haven't touched this for over a year due to being busy. But figured I'd give it a polish and see if I remembered how to code. I deleted the discord for this repo so just comment on discussions tab if you want.
- Update the referenced libraries
- Update the Event class to include an async event
- Port the demos to use fast api instead of sanic
quotes
Quotes around attribute values
The quotes around attributes can be finely controlled using the DOMConfig.ATTRIBUTE_QUOTES flag
By default everything is double quoted on render.
However a flag can be set to None which will not render quotes if the passed value is not a string.
Alternatively it can be set to use a single quotation mark or even False to use None at all and control it yourself.
Examples provided below:
>>> from domonic.html import *
>>> from domonic.dom import DOMConfig
>>> print(body(test="123"))
# <body test="123"></body>
>>> print(body(test=123))
# <body test="123"></body>
>>> DOMConfig.ATTRIBUTE_QUOTES = None
>>> print(body(test=123))
# <body test=123></body>
>>> print(body(test="123"))
# <body test="123"></body>
>>> DOMConfig.ATTRIBUTE_QUOTES = "'"
>>> print(body(test="123"))
# <body test='123'></body>
>>> DOMConfig.ATTRIBUTE_QUOTES = True
>>> print(body(test="123"))
# <body test="123"></body>
>>> print(body(test=123))
# <body test="123"></body>
>>> DOMConfig.ATTRIBUTE_QUOTES = False
>>> print(body(test="123"))
# <body test=123></body>
>>> print(body(test="TEXT"))
# <body test=TEXT></body>
DOMConfig
Fixes parser errors where html nodes was being nested.
Adds a DOMConfig to set some rendering options
Adds default params some Elements for hinting while using
Fixes call to pyml which wasn't putting text nodes in strings.
Updates docs to mention the DOMConfig
Autoescape and namespaces (piotrm0)
Adds a global Autoescape for testing.
It's on Node. something like Node.GLOBAL_AUTOESCAPE = True should set it.
Namespaces are one honking great idea — let's do more of those! via piotrm0
Adds a tags modules as a namespace package. (It's either that or lose the 'html' element from being included in root.)
Date
sse install fix
sseclient was stopping install on 3.10. so don't use 0.9.6, sorry. not sure why this wasn't picked up in git workflow tests.
Server sent events and DOMTokenList
DOMTokenList now works and has tests. hooked up to classList prop on dom, so makes working with that nicer as it has utility methods
Server Sent Events is started . inludes a new library and is a lot of fun to play with so far. more to come on that I imagine.
history
evaluate
open and close
Adds strings for complex ones that don't pass on CLI examples
Adds document.stylesheets to the docs
Adds css selector to CLI like the xpath one
Adds open and close methods to document.
Fixes DocumentFragment issue.
Makes default document an instance
Adds fastapi and blacksheep hello worlds
there's no 0.9.2 btw. don't ask.