snippet content is cut at max length, last word
This commit is contained in:
+5
-8
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user