snippet content is cut at max length, last word

small-nav
Mimi Momo 4 years ago
parent d0304a5b57
commit 3ea1b5ba20

@ -1,7 +1,7 @@
import datetime, os
from bottle import route, run, template
# diary
# write diary
def build_nav():
return "nav"
@ -51,19 +51,16 @@ def find_content(article, length, head, tail):
return content
def snip_article(article):
# read text in article
# clean 250 first characters
# add to snippet
# add "read more" button that links to article to snippet
return article
limit = 300
cut = article[0:min(len(article),limit)]
result = cut.rsplit(' ',1)[0]
return result + " ... "
def sort_files(files):
# sort array so articles are latest to earliest
m = list(reversed(files))
return files
def gather_files():
# directory to list
return os.listdir('entries/feature/')
# Webpages

@ -19,7 +19,7 @@
{{s[2]}}{{s[3]}}
</div>
<div class="snippet-link">
<a href={{s[4]}}>{{s[4]}}</a>
<a href={{s[4]}}>... Read More</a>
</div>
</div>
% end

Loading…
Cancel
Save