clean doesn't need the path anymore

small-nav
chimchooree 4 years ago
parent 51b5e2c63c
commit d9b78f4e4d

@ -1,9 +1,6 @@
import datetime, os, re import datetime, os, re
from bottle import error, route, run, static_file, template 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): def list_headlines(articles):
head = count_lines('entries/raw/res/head.txt') head = count_lines('entries/raw/res/head.txt')
result = [] result = []
@ -17,7 +14,7 @@ def list_headlines(articles):
b = [] b = []
b.append(path) b.append(path)
b.append(clean(text[head].replace('<br>',''), path)) b.append(clean(text[head].replace('<br>','')))
result.append(b) result.append(b)
return result return result
@ -61,7 +58,7 @@ def find_content(article, length, head, tail):
content += line content += line
return content return content
def clean(result, path): def clean(result):
result = result.replace('<br>','') result = result.replace('<br>','')
result = re.sub(r'<a href=.*?>', '', result) result = re.sub(r'<a href=.*?>', '', result)
result = result.replace('</a>','') result = result.replace('</a>','')
@ -70,7 +67,7 @@ def clean(result, path):
return result return result
def snip_article(article, path): def snip_article(article, path):
article = clean(article, path) article = clean(article)
limit = 300 limit = 300
result = article[0:min(len(article),limit)] result = article[0:min(len(article),limit)]
result = result.rsplit(' ',1)[0] result = result.rsplit(' ',1)[0]

Loading…
Cancel
Save