comparison doc/builder.txt @ 395:55cf81951686 experimental-inline

inline branch: Merged [439:479/trunk].
author cmlenz
date Thu, 28 Dec 2006 18:17:10 +0000
parents b3cabd49de75
children
comparison
equal deleted inserted replaced
359:f53be1b18b82 395:55cf81951686
50 shortcut for converting the ``Element`` to a stream and serializing that 50 shortcut for converting the ``Element`` to a stream and serializing that
51 stream:: 51 stream::
52 52
53 >>> stream = doc.generate() 53 >>> stream = doc.generate()
54 >>> stream 54 >>> stream
55 <genshi.core.Stream object at 0x72d230> 55 <genshi.core.Stream object at ...>
56 >>> print stream 56 >>> print stream
57 <p class="intro">Some text and <a href="http://example.org/">a link</a>.<br/></p> 57 <p class="intro">Some text and <a href="http://example.org/">a link</a>.<br/></p>
58 58
59 59
60 Creating Fragments 60 Creating Fragments
63 The ``tag`` object also allows creating “fragments”, which are basically lists 63 The ``tag`` object also allows creating “fragments”, which are basically lists
64 of nodes (elements or text) that don't have a parent element. This can be useful 64 of nodes (elements or text) that don't have a parent element. This can be useful
65 for creating snippets of markup that are attached to a parent element later (for 65 for creating snippets of markup that are attached to a parent element later (for
66 example in a template). Fragments are created by calling the ``tag`` object:: 66 example in a template). Fragments are created by calling the ``tag`` object::
67 67
68 >>> fragment = tag('Hello, ', tag.em('word'), '!') 68 >>> fragment = tag('Hello, ', tag.em('world'), '!')
69 >>> fragment 69 >>> fragment
70 <Fragment> 70 <Fragment>
71 >>> print fragment 71 >>> print fragment
72 Hello, <em>world</em>! 72 Hello, <em>world</em>!
Copyright (C) 2012-2017 Edgewall Software