snippets are cleaned of <br>s, snipped to given length; need to remove more tags, figure out why tags do nothing for everything but content
This commit is contained in:
+4
-3
@@ -46,14 +46,15 @@ def find_content(article, length, head, tail):
|
|||||||
content = ""
|
content = ""
|
||||||
with open('entries/feature/' + article) as f:
|
with open('entries/feature/' + article) as f:
|
||||||
for pos, line in enumerate(f):
|
for pos, line in enumerate(f):
|
||||||
if pos > head and pos < length - tail:
|
if pos > head + 1 and pos < length - tail:
|
||||||
content += line
|
content += line
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def snip_article(article):
|
def snip_article(article):
|
||||||
limit = 300
|
limit = 300
|
||||||
cut = article[0:min(len(article),limit)]
|
result = article[0:min(len(article),limit)]
|
||||||
result = cut.rsplit(' ',1)[0]
|
result = result.replace('<br>','')
|
||||||
|
result = result.rsplit(' ',1)[0]
|
||||||
return result + " ... "
|
return result + " ... "
|
||||||
|
|
||||||
def sort_files(files):
|
def sort_files(files):
|
||||||
|
|||||||
+1
-1
@@ -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]}}>... Read More</a>
|
<a href={{s[4]}}>Read More</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% end
|
% end
|
||||||
|
|||||||
Reference in New Issue
Block a user