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

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

Loading…
Cancel
Save