|
|
|
@ -1,9 +1,6 @@
|
|
|
|
|
import datetime, os, re
|
|
|
|
|
from bottle import error, route, run, static_file, template
|
|
|
|
|
|
|
|
|
|
# make article-to-html work with entries
|
|
|
|
|
# make index work with entries - later, they can be differentiated into features and weeklies with tags or title or whatever
|
|
|
|
|
|
|
|
|
|
def list_headlines(articles):
|
|
|
|
|
head = count_lines('entries/raw/res/head.txt')
|
|
|
|
|
result = []
|
|
|
|
@ -17,7 +14,7 @@ def list_headlines(articles):
|
|
|
|
|
|
|
|
|
|
b = []
|
|
|
|
|
b.append(path)
|
|
|
|
|
b.append(clean(text[head].replace('<br>',''), path))
|
|
|
|
|
b.append(clean(text[head].replace('<br>','')))
|
|
|
|
|
result.append(b)
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
@ -61,7 +58,7 @@ def find_content(article, length, head, tail):
|
|
|
|
|
content += line
|
|
|
|
|
return content
|
|
|
|
|
|
|
|
|
|
def clean(result, path):
|
|
|
|
|
def clean(result):
|
|
|
|
|
result = result.replace('<br>','')
|
|
|
|
|
result = re.sub(r'<a href=.*?>', '', result)
|
|
|
|
|
result = result.replace('</a>','')
|
|
|
|
@ -70,7 +67,7 @@ def clean(result, path):
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def snip_article(article, path):
|
|
|
|
|
article = clean(article, path)
|
|
|
|
|
article = clean(article)
|
|
|
|
|
limit = 300
|
|
|
|
|
result = article[0:min(len(article),limit)]
|
|
|
|
|
result = result.rsplit(' ',1)[0]
|
|
|
|
|