Skip to content

evanmcc/pfh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

functional python html generation library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages