Skip to content

Releases: byteface/domonic

libs

06 Nov 16:01
Compare
Choose a tag to compare

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

28 Jun 20:05
Compare
Choose a tag to compare

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

10 Apr 14:33
Compare
Choose a tag to compare

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)

05 Apr 00:47
c552f01
Compare
Choose a tag to compare

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

24 Mar 22:36
Compare
Choose a tag to compare

Started some unit tests for Javascript Date and began to fix up bugs.
Still a way to go on that but much improved.

sse install fix

26 Feb 17:57
Compare
Choose a tag to compare

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

25 Feb 09:19
Compare
Choose a tag to compare

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

23 Feb 23:45
Compare
Choose a tag to compare

Adds history to window with back/forward methods.
Uses f-strings everywhere
Updates svg with fixes from @Kainech

evaluate

17 Feb 09:19
Compare
Choose a tag to compare

Adds evaluate method to Document which should make playing with xpath simpler
Adds length to Node for compatiblity
Merges fixes to Polygon by FrackOverflow
General code clean up

open and close

15 Feb 09:17
Compare
Choose a tag to compare

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.