mirror of
https://github.com/kennethreitz-archive/untar.it.git
synced 2026-06-05 07:16:13 +00:00
Unstyled example content.
This commit is contained in:
@@ -24,14 +24,16 @@ endif
|
||||
|
||||
## Composer
|
||||
|
||||
index.json: indexer.py templates/
|
||||
content: templates/
|
||||
|
||||
index.json: indexer.py content
|
||||
python indexer.py > index.json
|
||||
|
||||
build: index.json
|
||||
composer build index.json
|
||||
build: requirements index.json
|
||||
composer build indexer:UntaritIndex
|
||||
|
||||
serve: requirements index.json
|
||||
composer serve indexer:UntaritIndexer
|
||||
composer serve indexer:UntaritIndex
|
||||
|
||||
deploy: build
|
||||
s3cmd sync build/ s3://untar.it/
|
||||
|
||||
+8
-6
@@ -2,9 +2,7 @@
|
||||
"routes": [
|
||||
{
|
||||
"url": "/",
|
||||
"context": {
|
||||
"title": "Hello"
|
||||
},
|
||||
"context": {},
|
||||
"filters": [
|
||||
"mako"
|
||||
],
|
||||
@@ -13,7 +11,7 @@
|
||||
{
|
||||
"url": "/tar.gz/",
|
||||
"context": {
|
||||
"title": "Hello"
|
||||
"filetype": "tar.gz"
|
||||
},
|
||||
"filters": [
|
||||
"filetype"
|
||||
@@ -23,7 +21,7 @@
|
||||
{
|
||||
"url": "/tar.bz2/",
|
||||
"context": {
|
||||
"title": "Hello"
|
||||
"filetype": "tar.bz2"
|
||||
},
|
||||
"filters": [
|
||||
"filetype"
|
||||
@@ -40,7 +38,11 @@
|
||||
"filters": {
|
||||
"mako": {
|
||||
"class": "composer.filters:Mako",
|
||||
"kwargs": {}
|
||||
"kwargs": {
|
||||
"directories": [
|
||||
"templates"
|
||||
]
|
||||
}
|
||||
},
|
||||
"filetype": {
|
||||
"class": "composer.filters:MakoContainer",
|
||||
|
||||
+13
-6
@@ -1,25 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from composer.index import Index, Route, Static
|
||||
from composer.filters import MakoContainer
|
||||
from composer.filters import Mako, MakoContainer
|
||||
|
||||
|
||||
class UntaritIndex(Index):
|
||||
|
||||
def _register_filters(self):
|
||||
self.register_filter('mako', Mako, {'directories': ['templates']})
|
||||
self.register_filter('filetype', MakoContainer, {'directories': ['templates'], 'template': 'filetype.mako'})
|
||||
|
||||
def _generate_static(self):
|
||||
yield Static('/static', 'static')
|
||||
|
||||
def _generate_routes(self):
|
||||
context = {'title': 'Hello'}
|
||||
|
||||
yield Route('/', 'templates/index.mako', filters=['mako'], context=context)
|
||||
|
||||
# TODO: Pull this from a yaml file or something
|
||||
for filetype in ['tar.gz', 'tar.bz2']:
|
||||
known_types = ['tar.gz', 'tar.bz2']
|
||||
|
||||
yield Route('/', 'templates/index.mako', filters=['mako'], context={
|
||||
'known_types': known_types,
|
||||
})
|
||||
|
||||
for filetype in known_types:
|
||||
url = self.absolute_url(filetype + '/')
|
||||
context = {
|
||||
'filetype': filetype,
|
||||
'known_types': known_types,
|
||||
}
|
||||
yield Route(url, 'templates/filetype.mako', filters=['filetype'], context=context)
|
||||
|
||||
|
||||
|
||||
@@ -3,3 +3,4 @@ mako
|
||||
markdown
|
||||
mdx_smartypants
|
||||
PyYaml
|
||||
werkzeug
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<title><%block name="title">Untar.it</%block></title>
|
||||
|
||||
<link href="/static/css/base.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="/static/images/icon.png" />
|
||||
|
||||
<%block name="extra_head" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
${next.body()}
|
||||
|
||||
<footer>
|
||||
Created by
|
||||
<a href="http://kennethreitz.org">kennethreitz</a> and
|
||||
<a href="http://shazow.net/">shazow</a>.
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
// TODO:
|
||||
// _gaq.push(['_setAccount', 'XXX']);
|
||||
// _gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<%block name="tail">
|
||||
</%block>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<%inherit file="base.mako" />
|
||||
<%block name="title">How to untar a .${route.context['filetype']} file</%block>
|
||||
|
||||
<h1>${route.context['filetype']}</h1>
|
||||
|
||||
<p>
|
||||
Filetype-specific content goes here.
|
||||
</p>
|
||||
|
||||
+13
-1
@@ -1 +1,13 @@
|
||||
foo
|
||||
<%inherit file="base.mako" />
|
||||
|
||||
<h1>Untar.it</h1>
|
||||
|
||||
<p>
|
||||
What kind of file do you need to open?
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
% for filetype in route.context['known_types']:
|
||||
<li><a href="/${filetype}/">${filetype}</a></li>
|
||||
% endfor
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user