[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[www] branch master updated: pass number of characters to function inste
From: |
gnunet |
Subject: |
[www] branch master updated: pass number of characters to function instead of hardcoding. |
Date: |
Sun, 10 Nov 2019 18:21:10 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository www.
The following commit(s) were added to refs/heads/master by this push:
new 91cb96c pass number of characters to function instead of hardcoding.
91cb96c is described below
commit 91cb96c258144d0fac35014b36b9df1e5fa5a6d2
Author: ng0 <address@hidden>
AuthorDate: Sun Nov 10 17:17:42 2019 +0000
pass number of characters to function instead of hardcoding.
---
template.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/template.py b/template.py
index 607608f..dc98251 100755
--- a/template.py
+++ b/template.py
@@ -154,7 +154,7 @@ def copy_static(locale, indict):
print(locale + "/" + key + " ...to... " + locale + "/" + value)
-def preview_text(filename):
+def preview_text(filename, count):
with open(filename) as html:
# html = open(filename).read()
soup = BeautifulSoup(html, features="lxml")
@@ -166,12 +166,12 @@ def preview_text(filename):
k.append(i)
b = ''.join(str(e) for e in k)
text = b.replace("\n", "")
- textreduced = (text[:800] + '...') if len(text) > 800 else (text +
'..')
+ textreduced = (text[:count] + '...') if len(text) > count else (text +
'..')
return(textreduced)
-def abstract_news(filename):
- return preview_text("news/" + filename + ".j2")
+def abstract_news(filename, count):
+ return preview_text("news/" + filename + ".j2", count)
def generate_site(root, conf):
@@ -271,7 +271,7 @@ def main():
conf=yaml.load(site_configfile)
for item in conf["newsposts"]:
- item['abstract'] = abstract_news(item['page'])
+ item['abstract'] = abstract_news(item['page'], 800)
print("generating template")
generate_site("template", conf)
print("generating news")
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [www] branch master updated: pass number of characters to function instead of hardcoding.,
gnunet <=