@ -6,34 +6,6 @@ from bottle import error, route, run, static_file, template
# write diary
# write diary
def build_nav ( ) :
nav = " nav "
return nav
#function build_nav($page, $total) {
# echo '<div class="diary-dir">';
# $limit = 4;
# $min = max($page - $limit, 0);
#$max = min($page + $limit, $total);
# if($min > 0) {
# echo "<a href=diary.php?page=0>first</a>";
# }
# for($i = $min; $i < $max; $i++) {
# if ($i == $page) {
# echo "<strong>$i</strong>";
# } else {
# echo "<a href=diary.php?page=$i>$i</a>";
#}
# }
# if($max < $total) {
# $t = $total - 1;
# echo "<a href=diary.php?page=$t>last</a>";
#}
# echo '</div>';
#}
def make_latest ( ) :
def make_latest ( ) :
# for article in array (just 5 or something)
# for article in array (just 5 or something)
# link to webpage
# link to webpage
@ -115,7 +87,7 @@ def serve_css(filename):
return static_file ( filename , root = ' static/css ' )
return static_file ( filename , root = ' static/css ' )
@route ( ' /static/img/<filename:path> ' )
@route ( ' /static/img/<filename:path> ' )
def serve_ css ( filename ) :
def serve_ img ( filename ) :
return static_file ( filename , root = ' static/img ' )
return static_file ( filename , root = ' static/img ' )
# Routes
# Routes
@ -143,9 +115,13 @@ def presskit():
return template ( ' presskit.tpl ' , info )
return template ( ' presskit.tpl ' , info )
@route ( ' /diary ' )
@route ( ' /diary ' )
def diary ( ) :
def diary2 ( ) :
return diary ( 0 )
@route ( ' /diary/<page:int> ' )
def diary ( page ) :
""" diary page """
""" diary page """
info = { ' css ' : ' diary ' , ' title ' : ' blessfrey - about the game ' , ' year ' : datetime . datetime . now ( ) , ' snippets ' : list_snippets ( sort_files ( gather_files ( ) ) ) , ' latest ' : make_latest ( ) , ' nav ' : build_nav ( ) }
info = { ' css ' : ' diary ' , ' title ' : ' blessfrey - about the game ' , ' year ' : datetime . datetime . now ( ) , ' snippets ' : list_snippets ( sort_files ( gather_files ( ) ) ) , ' latest ' : make_latest ( ) , ' total' : len ( gather_files ( ) ) , ' limit ' : 3 , ' page ' : page }
return template ( ' diary.tpl ' , info )
return template ( ' diary.tpl ' , info )
if __name__ == ' __main__ ' :
if __name__ == ' __main__ ' :