Mercurial > genshi > mirror
annotate markup/__init__.py @ 210:9fd7535883f2 trunk
Fix regression introduced in [258]. More fixes needed?
author | cmlenz |
---|---|
date | Tue, 29 Aug 2006 17:35:32 +0000 |
parents | 59eb24184e9c |
children |
rev | line source |
---|---|
1 | 1 # -*- coding: utf-8 -*- |
2 # | |
66
59eb24184e9c
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
59eb24184e9c
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
59eb24184e9c
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
b4d17897d053
* 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 |