cmlenz@1: # -*- coding: utf-8 -*- cmlenz@1: # cmlenz@66: # Copyright (C) 2006 Edgewall Software cmlenz@1: # All rights reserved. cmlenz@1: # cmlenz@1: # This software is licensed as described in the file COPYING, which cmlenz@1: # you should have received as part of this distribution. The terms cmlenz@66: # are also available at http://markup.edgewall.org/wiki/License. cmlenz@1: # cmlenz@1: # This software consists of voluntary contributions made by many cmlenz@1: # individuals. For the exact contribution history, see the revision cmlenz@66: # history and logs, available at http://markup.edgewall.org/log/. cmlenz@1: cmlenz@1: """This package provides various means for generating and processing web markup cmlenz@1: (XML or HTML). cmlenz@1: cmlenz@1: The design is centered around the concept of streams of markup events (similar cmlenz@1: in concept to SAX parsing events) which can be processed in a uniform manner cmlenz@1: independently of where or how they are produced. cmlenz@1: cmlenz@1: cmlenz@1: Generating content cmlenz@1: ------------------ cmlenz@1: cmlenz@1: Literal XML and HTML text can be used to easily produce markup streams cmlenz@1: via helper functions in the `markup.input` module: cmlenz@1: cmlenz@1: >>> from markup.input import XML cmlenz@1: >>> doc = XML('My document') cmlenz@1: cmlenz@1: This results in a `Stream` object that can be used in a number of way. cmlenz@1: cmlenz@1: >>> doc.render(method='html', encoding='utf-8') cmlenz@1: 'My document' cmlenz@1: cmlenz@1: >>> from markup.input import HTML cmlenz@1: >>> doc = HTML('My document</HTML>') cmlenz@1: >>> doc.render(method='html', encoding='utf-8') cmlenz@1: '<html lang="en"><head><title>My document' cmlenz@1: cmlenz@1: >>> title = doc.select('head/title') cmlenz@1: >>> title.render(method='html', encoding='utf-8') cmlenz@1: 'My document' cmlenz@1: cmlenz@1: cmlenz@1: Markup streams can also be generated programmatically using the cmlenz@1: `markup.builder` module: cmlenz@1: cmlenz@1: >>> from markup.builder import tag cmlenz@20: >>> doc = tag.doc(tag.title('My document'), lang='en') cmlenz@1: >>> doc.generate().render(method='html') cmlenz@1: 'My document' cmlenz@1: """ cmlenz@1: cmlenz@1: from markup.core import * cmlenz@21: from markup.input import ParseError, XML, HTML