This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
cottonmouth
===========

Pure-Python HTML generation, inspired by [Hiccup][1].

```python
from cottonmouth.html import render
from cottonmouth.tags import html, head, body, title, meta, link, h1

def welcome(user=None, **context):
return ['p', 'Welcome' + (' back!' if user else '!')]

content = (
# Feel free to use raw HTML
'',
# Tags are represented as sequences with a tag name at the head
[html,
# Or just use strings instead of the default tag symbols
['head',
[title, 'The Site'],
# Attributes are passed as a dict immediately after the tag
[meta, {'charset': 'utf-8'}],
[link, dict(rel='stylesheet', type='text/css',
href='static/layout.css')]],
[body,
# You can also call tags as functions with the content as
# the first argument and attributes as `kwargs`
[header, h1(u'The Website', id='header')],
# Use "#id.class" shortcuts to easily create `div` elements
['#map.pretty-map'],
# Functions will be called with context and the results rendered
['#main', welcome]]]
)

render(*content, user=None)
```

Equivalent output:

```html

<html>
<head>
<title>The Site</title>
<meta content="text/html;charset=utf-8" http-equiv="content-type">
<link href="static/layout.css" type="text/css" rel="stylesheet">
</head>
<body>
<h1 id="header">Welcome to the site!</h1>
<div id="map" class="pretty-map"></div>
<div id="main">
<p>Welcome!</p>
</div>
</body>
</html>
```


### Installation

pip install cottonmouth


### Testing

python setup.py test


### License

BSD Copyright 2013, Noah Seger


[1]: https://github.com/weavejester/hiccup
Release History

Release History

0.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
cottonmouth-0.2.0.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Dec 2, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting