Template engine with simple data structure
Project description
flexable is template engine with simple data structure. That is made up of str, unicode, dict, tuple, list and Element.
usage merge structured values to xhtml template. >>> t = Template() >>> t.fromstring(“<div/>”) >>> str(t) ‘<div/>’
>>> t.merge('hello') >>> str(t) '<div>hello</div>'
>>> t = Template() >>> t.fromstring("<div><span class='y'/></div>") >>> t.merge({'y':['1', '2']}) >>> str(t) '<div><span class="y">1</span><span class="y">2</span></div>'
>>> t = Template() >>> t.fromstring("<div><span class='y'/></div>") >>> t.merge({'y':[({'@id':'m1'}, '1'), ... ({'@id':'m2'}, '2')]}) >>> str(t) '<div><span class="y" id="m1">1</span><span class="y" id="m2">2</span></div>'
>>> t.fromstring("<div><div class='box'><span class='x'/><span class='y'/></div></div>") >>> t.merge({'box':[{'x':'1', 'y':'2'}, ... {'x':'3', 'y':'4'}]}) >>> str(t) '<div><div class="box"><span class="x">1</span><span class="y">2</span></div><div class="box"><span class="x">3</span><span class="y">4</span></div></div>'
>>> t.fromstring("<div/>") >>> t.merge(ET.Element('span')) >>> str(t) '<div><span/></div>'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flexable-0.2dev.tar.gz
(5.5 kB
view details)
Built Distribution
flexable-0.2dev-py2.5.egg
(9.8 kB
view details)
File details
Details for the file flexable-0.2dev.tar.gz
.
File metadata
- Download URL: flexable-0.2dev.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57894ece9e1d32a7f2c3d32118941122a107ad2dab0e05e0c2ed6569ad447e4b |
|
MD5 | 3b064ebb83ccba93965d9ff711b50230 |
|
BLAKE2b-256 | 04bb812a73e9f26a085897752a6f9f1222d08d9f7c4160e984aaa5d5af6932c0 |
File details
Details for the file flexable-0.2dev-py2.5.egg
.
File metadata
- Download URL: flexable-0.2dev-py2.5.egg
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd44cde1dd3df8bfe661bd7953913ea95a1c39c6cd05d1eae2e86d5d3ccd07c5 |
|
MD5 | d4b97f99f2782287d4855081a8e4639c |
|
BLAKE2b-256 | 33623b39798cfcf337856345732ffa2e06f03f9afdebb319f37cabeaf0cf8c13 |