functional python html generation library
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
MIT-LICENSE
README
__init__.py
setup.py
test_pfh.py

README

INSTALLATION:

Clone the repo into your working directory.

USAGE: 

The recommended import strategy is:
from pfh import *

For just about every tag type in HTML there's a corresponding 
function.  That function will return text and takes any number of 
arguments.  There's no validation, so it helps to know HTML.

del, def, and object are namespace collisions with python, and 
are currently unimplemented.
    
Attributes are added as additional keyword arguments.  eg:

a('linky!', href="http://foo.com/bar/", alt='foo')

will generate:

<a alt="foo" href="http://foo.com/bar/">linky!</a>

a more elaborate example:

from pfh import *

def main():
    print html(head(title('foo')),
               body(h1('title'),
                    em('strong!'),
                    br(),
                    a('linky!', href="http://foo.com/bar/",
		      alt='foo')))

if __name__ == '__main__':
    main()

Which, when run results in: 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>foo</title></head>
<body>
<h1>title</h1>
<em>strong!</em>
<br/>
<a alt="foo" href="http://foo.com/bar/">linky!</a>
</body>
</html>

Not the prettiest HTML, but servicable, and hopefully you won't 
need to use it much.

CREDITS & LICENSE: 

Written by Evan McClanahan <mcclanahan@gmail.com>
Copyright 2008-2013 under the MIT LICENSE.
See MIT-LICENSE in this repository for details