-
Notifications
You must be signed in to change notification settings - Fork 0
functional python html generation library
License
evanmcc/pfh
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
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 0
No packages published