gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[www] branch master updated (f585e21 -> 076ecac)


From: gnunet
Subject: [www] branch master updated (f585e21 -> 076ecac)
Date: Mon, 11 Nov 2019 22:18:34 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a change to branch master
in repository www.

    from f585e21  revert back to 400 until the extraction does properly strip 
out html.
     new 97beb6b  better text extraction.
     new 076ecac  news, add paragraph.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 news/2019-11-ICANNUpdate.html.j2 |  5 ++++-
 template.py                      | 22 +++++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/news/2019-11-ICANNUpdate.html.j2 b/news/2019-11-ICANNUpdate.html.j2
index 3606ff0..1edbbb8 100644
--- a/news/2019-11-ICANNUpdate.html.j2
+++ b/news/2019-11-ICANNUpdate.html.j2
@@ -2,6 +2,9 @@
 {% block body_content %}
   <h1>GNS&#64;ICANN66</h1>
 <p>
-  The <a href="https://meetings.icann.org/en/montreal66";>ICANN Annual General 
Meeting</a> is concluded. We were invited to join a panel discussion on 
<i>Emerging Internet Identifier Technologies</i> in order to share our ideas 
and work on the <i>GNU Name System (GNS)</i>. You can find the presentation on 
GNS in <a href="{{ url_localized('video.html') }}">our video section</a>. The 
handshake.org project, which proposes a decentralized, blockchain-based 
governance of the root zone (as oppo [...]
+  The <a href="https://meetings.icann.org/en/montreal66";>ICANN Annual General 
Meeting</a> is concluded. We were invited to join a panel discussion on 
<i>Emerging Internet Identifier Technologies</i> in order to share our ideas 
and work on the <i>GNU Name System (GNS)</i>.
+</p>
+<p>
+  You can find the presentation on GNS in <a href="{{ 
url_localized('video.html') }}">our video section</a>. The handshake.org 
project, which proposes a decentralized, blockchain-based governance of the 
root zone (as opposed to governance by ICANN), joined us on the panel. The full 
video including questions and answers can be found <a 
href="https://icann.zoom.us/recording/share/M8N-Duq935XheIZoBedIwmi3VqRUAe2iOPwECiTNLxKwIumekTziMw?startTime=1572978711000";>here</a>.
 </p>
 {% endblock body_content %}
diff --git a/template.py b/template.py
index e2a689b..89e4856 100755
--- a/template.py
+++ b/template.py
@@ -33,8 +33,8 @@ from pathlib import Path
 import hashlib
 from bs4 import BeautifulSoup
 from ruamel.yaml import YAML
+import html.parser
 
-# TODO: Turn repetition into a class.
 
 env = jinja2.Environment(loader=jinja2.FileSystemLoader(
     os.path.dirname(__file__)),
@@ -45,6 +45,22 @@ env = jinja2.Environment(loader=jinja2.FileSystemLoader(
                          autoescape=False)
 
 
+class extractText(html.parser.HTMLParser):
+    def __init__(self):
+        super(extractText, self).__init__()
+        self.result = []
+    def handle_data(self, data):
+        self.result.append(data)
+    def text_in(self):
+        return ''.join(self.result)
+
+
+def html2text(html):
+    k = extractText()
+    k.feed(html)
+    return k.text_in()
+
+
 def localized(filename, locale, *args):
     if len(args) == 0:
         return "../" + locale + "/" + filename
@@ -165,7 +181,7 @@ def preview_text(filename, count):
         for i in soup.findAll('p')[1]:
             k.append(i)
         b = ''.join(str(e) for e in k)
-        text = b.replace("\n", "")
+        text = html2text(b.replace("\n", ""))
         textreduced = (text[:count] + '...') if len(text) > count else (text + 
'..')
         return(textreduced)
 
@@ -271,7 +287,7 @@ def main():
     conf=yaml.load(site_configfile)
 
     for item in conf["newsposts"]:
-        item['abstract'] = abstract_news(item['page'], 300)
+        item['abstract'] = abstract_news(item['page'], 1000)
     print("generating template")
     generate_site("template", conf)
     print("generating news")

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]