Date: | July 19, 2013 |
---|---|
Author: | Daniel Greenfeld |
Version: | 1.0 |
description: | An example of using Simplicity to populate the data in a Complexity generated site. |
Clone this and use it with the Complexity static site generator. Try it out:
$ pip install simplicity
$ pip install complexity
$ git clone [email protected]:pydanny/simplicity-complexity-example.git my_project
$ cd my_project
$ simplicity README.rst > project/json/README.json
$ complexity project www
BOOM!
You installed:
- simplicity: Converts ReStructuredText into JSON.
- complexity: A refreshingly simple static site generator, for those who like to work in HTML.
$ pip install simplicity
$ pip install complexity
- You cloned these files to your local machine and went inside them.
$ git clone [email protected]:pydanny/simplicity-complexity-example.git my_project
$ cd my_project
- You used simplicity to convert this README.rst file to JSON.
$ simplicity README.rst > project/json/README.json
- You used complexity to generate a static HTML site in a new 'www' folder.
$ complexity project www
You viewed the generated static site which was served by complexity's built-in HTTP server:
$ open http://127.0.0.1:9090
Take a look at https://github.com/pydanny/simplicity-complexity-example/blob/master/project/templates/index.html
{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block content %}
<div class="row">
<div class="span12">
<h1>{{ README.0.title }}</h1>
<p>Created: {{ README.0.date }}</p>
<p>Author: {{ README.0.author }}</p>
<p>Version: {{ README.0.version }}</p>
<p>Version: {{ README.0.description }}</p>
</div>
</div>
{% endblock %}
Complexity used Jinja2 to render the data elements in that module with the README.json module you just created from this file using simplicity.
Easy as that.