AttributeError: 'Literal' object has no attribute 'build'
Closed this issue · 9 comments
gnbl commented
Attempting the example in https://github.com/evtn/soda#text
from soda import Tag, Root, Literal
svg = Root()(
Tag.g(Literal('<path d="M0 0 L10 0 Z"/>', escape=False))
).render()
gnbl commented
Temporary fix:
def build(self, *args):
return self.children[0]
evtn commented
Temporary fix:
def build(self, *args): return self.children[0]
That doesn't seem right, Tag.build
should return a generator
I'll check in a moment
evtn commented
A proper Literal.build
should be
def build(self, tab_size: int = 0, tab_level: int = 0) -> Generator[str, None, None]:
separator = "\n" * bool(tab_size)
for child in self.children:
yield separator
yield from self.build_child(child, tab_size, tab_level + 1)
I will add this in 1.0.1
gnbl commented
AttributeError: 'Literal' object has no attribute 'build_child'
evtn commented
AttributeError: 'Literal' object has no attribute 'build_child'
Yes, this won't work on old vesrions without another edit
Literal
should extend Tag
class Literal(Tag):
gnbl commented
No worries, take your time.
evtn commented
I took my time and fixed this in 1.0.1, which should be available already.
gnbl commented
escape=False
does not appear to have an effect.
evtn commented
And that one was fixed in 1.0.2
Seems like I didn't use Literal
enough to catch obvious bugs