X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fsp%2Futil.py;h=795bf57c7bb645eedda0792bb2e58d6972be7e62;hb=b60c7ad215785cac80a3b43e7ca828338bfdd765;hp=f387f1c09298d948ca115b5fd7c24466b91ee07f;hpb=ee213a9b2c572b9abca9a1babb5c32c9512f0682;p=wrw.git diff --git a/wrw/sp/util.py b/wrw/sp/util.py index f387f1c..795bf57 100644 --- a/wrw/sp/util.py +++ b/wrw/sp/util.py @@ -44,6 +44,9 @@ class formatter(object): def text(self, el): self.quotewrite(el) + def rawcode(self, el): + self.write(el) + def attrval(self, buf): qc, qt = (u"'", u"'") if u'"' in buf else (u'"', u""") self.write(qc) @@ -112,6 +115,8 @@ class formatter(object): self.element(el) elif isinstance(el, cons.text): self.text(el) + elif isinstance(el, cons.raw): + self.rawcode(el) else: raise Exception("Unknown object in element tree: " + el) @@ -135,6 +140,10 @@ class formatter(object): def output(cls, out, el, *args, **kw): cls(out=out, root=el, *args, **kw).start() + @classmethod + def fragment(cls, out, el, *args, **kw): + cls(out=out, root=el, *args, **kw).node(el) + def update(self, **ch): ret = type(self).__new__(type(self)) ret.__dict__.update(self.__dict__)