Mercurial > genshi > genshi-test
annotate markup/__init__.py @ 69:e9a3930f8823
A couple of minor performance improvements.
author | cmlenz |
---|---|
date | Mon, 10 Jul 2006 17:37:01 +0000 |
parents | 822089ae65ce |
children |
rev | line source |
---|---|
1 | 1 # -*- coding: utf-8 -*- |
2 # | |
66
822089ae65ce
Switch copyright to Edgewall and URLs to markup.edgewall.org.
cmlenz
parents:
27
diff
changeset
|
3 # Copyright (C) 2006 Edgewall Software |
1 | 4 # All rights reserved. |
5 # | |
6 # This software is licensed as described in the file COPYING, which | |
7 # you should have received as part of this distribution. The terms | |
66
822089ae65ce
Switch copyright to Edgewall and URLs to markup.edgewall.org.
cmlenz
parents:
27
diff
changeset
|
8 # are also available at http://markup.edgewall.org/wiki/License. |
1 | 9 # |
10 # This software consists of voluntary contributions made by many | |
11 # individuals. For the exact contribution history, see the revision | |
66
822089ae65ce
Switch copyright to Edgewall and URLs to markup.edgewall.org.
cmlenz
parents:
27
diff
changeset
|
12 # history and logs, available at http://markup.edgewall.org/log/. |
1 | 13 |
14 """This package provides various means for generating and processing web markup | |
15 (XML or HTML). | |
16 | |
17 The design is centered around the concept of streams of markup events (similar | |
18 in concept to SAX parsing events) which can be processed in a uniform manner | |
19 independently of where or how they are produced. | |
20 | |
21 | |
22 Generating content | |
23 ------------------ | |
24 | |
25 Literal XML and HTML text can be used to easily produce markup streams | |
26 via helper functions in the `markup.input` module: | |
27 | |
28 >>> from markup.input import XML | |
29 >>> doc = XML('<html lang="en"><head><title>My document</title></head></html>') | |
30 | |
31 This results in a `Stream` object that can be used in a number of way. | |
32 | |
33 >>> doc.render(method='html', encoding='utf-8') | |
34 '<html lang="en"><head><title>My document</title></head></html>' | |
35 | |
36 >>> from markup.input import HTML | |
37 >>> doc = HTML('<HTML lang=en><HEAD><TITLE>My document</HTML>') | |
38 >>> doc.render(method='html', encoding='utf-8') | |
39 '<html lang="en"><head><title>My document</title></head></html>' | |
40 | |
41 >>> title = doc.select('head/title') | |
42 >>> title.render(method='html', encoding='utf-8') | |
43 '<title>My document</title>' | |
44 | |
45 | |
46 Markup streams can also be generated programmatically using the | |
47 `markup.builder` module: | |
48 | |
49 >>> from markup.builder import tag | |
20 | 50 >>> doc = tag.doc(tag.title('My document'), lang='en') |
1 | 51 >>> doc.generate().render(method='html') |
52 '<doc lang="en"><title>My document</title></doc>' | |
53 """ | |
54 | |
55 from markup.core import * | |
21
eca77129518a
* Include paths are now interpreted relative to the path of the including template. Closes #3.
cmlenz
parents:
20
diff
changeset
|
56 from markup.input import ParseError, XML, HTML |