def build(self): doc = document.Document() ctx = DocBuilder(doc, self.clean_paragraphs) for bit in self.group.flatten(): typeName = type(bit).__name__ getattr(ctx, "handle_%s" % typeName)(bit) ctx.flushParagraph() return doc
def go(self): soup = BeautifulSoup.BeautifulSoup( self.source, convertEntities=BeautifulSoup.BeautifulSoup.HTML_ENTITIES, fromEncoding=self.encoding, smartQuotesTo=None) # Make sure the document content doesn't use multi-lines soup = self.format(soup) doc = document.Document() if self.css_source: self.css = CSS(self.css_source) else: self.css = CSS() # empty css self.process_into(soup, doc) return doc