news on index shows 9 latest headlines as links to their articles
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
ancient text
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
nothing new sorry
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
1 sample news <b>whoa</b>
|
||||||
+18
-9
@@ -6,15 +6,24 @@ from bottle import error, route, run, static_file, template
|
|||||||
|
|
||||||
# write diary
|
# write diary
|
||||||
|
|
||||||
def make_latest():
|
def list_headlines(articles):
|
||||||
# for article in array (just 5 or something)
|
head = count_lines('entries/raw/res/head.txt')
|
||||||
# link to webpage
|
result = []
|
||||||
return "latest"
|
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('<br>',''), path))
|
||||||
|
result.append(b)
|
||||||
|
return result
|
||||||
|
|
||||||
def list_snippets(articles):
|
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
|
limit = 4
|
||||||
total = len(articles)
|
total = len(articles)
|
||||||
head = count_lines('entries/raw/res/head.txt')
|
head = count_lines('entries/raw/res/head.txt')
|
||||||
@@ -99,7 +108,7 @@ def error404(error):
|
|||||||
@route('/')
|
@route('/')
|
||||||
def index():
|
def index():
|
||||||
"""home page"""
|
"""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)
|
return template('index.tpl', info)
|
||||||
|
|
||||||
@route('/game')
|
@route('/game')
|
||||||
@@ -122,7 +131,7 @@ def diary2():
|
|||||||
def diary(page):
|
def diary(page):
|
||||||
"""diary page"""
|
"""diary page"""
|
||||||
assert isinstance(page, int)
|
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)
|
return template('diary.tpl', info)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
+5
-1
@@ -14,7 +14,11 @@
|
|||||||
<div class="news">
|
<div class="news">
|
||||||
<center>. • . <strong>news</strong> ☆ .. . <br></center>
|
<center>. • . <strong>news</strong> ☆ .. . <br></center>
|
||||||
<br>
|
<br>
|
||||||
{{news}}
|
<ul>
|
||||||
|
% for n in news:
|
||||||
|
<li>★ <a href={{n[0]}}>{{!n[1]}}</a><br></li>
|
||||||
|
% end
|
||||||
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<center>. ★ .. • . ☆</center>
|
<center>. ★ .. • . ☆</center>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user