X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fsp%2Futil.py;h=ba75cac307490e158744db40c89fc7be47d8a99b;hb=3e91bb195838a6c561358a44f654f41f46e9c95f;hp=c9f940113cefb6971273d7fa83b40d580a7a9317;hpb=7bcaef26c590cd10955848fbf313f41c78b8d1ce;p=wrw.git diff --git a/wrw/sp/util.py b/wrw/sp/util.py index c9f9401..ba75cac 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 = ("'", "'") if '"' in buf else ('"', """) 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__)