diff --git a/src/entries/raw/news/100504.html b/src/entries/raw/news/100504.html new file mode 100644 index 0000000..63266f5 --- /dev/null +++ b/src/entries/raw/news/100504.html @@ -0,0 +1 @@ +ancient text diff --git a/src/entries/raw/news/200811.html b/src/entries/raw/news/200811.html new file mode 100644 index 0000000..85feb50 --- /dev/null +++ b/src/entries/raw/news/200811.html @@ -0,0 +1 @@ +nothing new sorry diff --git a/src/entries/raw/news/201004.html b/src/entries/raw/news/201004.html new file mode 100644 index 0000000..a66bb2d --- /dev/null +++ b/src/entries/raw/news/201004.html @@ -0,0 +1 @@ +1 sample news whoa diff --git a/src/index.py b/src/index.py index 90683c2..efc59c2 100644 --- a/src/index.py +++ b/src/index.py @@ -6,15 +6,24 @@ from bottle import error, route, run, static_file, template # write diary -def make_latest(): - # for article in array (just 5 or something) - # link to webpage - return "latest" +def list_headlines(articles): + head = count_lines('entries/raw/res/head.txt') + result = [] + text = [] + + for article in articles: + path = 'entries/' + article + + with open(path) as f: + text = f.readlines() + + b = [] + b.append(path) + b.append(clean(text[head].replace('
',''), path)) + result.append(b) + return result def list_snippets(articles): - # take articles between 0-4, 5-8, 9-13,...) based on current page - # for each one of those articles, - # snip_article(article) limit = 4 total = len(articles) head = count_lines('entries/raw/res/head.txt') @@ -99,7 +108,7 @@ def error404(error): @route('/') def index(): """home page""" - info = {'css': 'index', 'news': 'News goes here', 'title': 'chimchooree\'s dev space - blessfrey', 'year': datetime.datetime.now()} + info = {'css': 'index', 'news': list_headlines(sort_files(gather_files())[0:10]), 'title': 'chimchooree\'s dev space - blessfrey', 'year': datetime.datetime.now()} return template('index.tpl', info) @route('/game') @@ -122,7 +131,7 @@ def diary2(): def diary(page): """diary page""" assert isinstance(page, int) - info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest(), 'total': len(gather_files()), 'limit': 4, 'cluster': 3, 'page': page} + info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': list_headlines(sort_files(gather_files())[0:5]), 'total': len(gather_files()), 'limit': 4, 'cluster': 3, 'page': page} return template('diary.tpl', info) if __name__ == '__main__': diff --git a/src/views/index.tpl b/src/views/index.tpl index 7e5ca37..03edd8d 100644 --- a/src/views/index.tpl +++ b/src/views/index.tpl @@ -14,7 +14,11 @@
.      •        . news ☆            ..   .

- {{news}} +
.            ★            ..             •           .            ☆