gnunet-svn
[Top][All Lists]
Advanced

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

[www] branch stable updated (01815e9 -> eda66aa)


From: gnunet
Subject: [www] branch stable updated (01815e9 -> eda66aa)
Date: Mon, 11 Nov 2019 22:25:24 +0100

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

ng0 pushed a change to branch stable
in repository www.

    from 01815e9  Fix path in previous commit
     add 3526521  maybe fix the submodule for schanzen
     add 91cb96c  pass number of characters to function instead of hardcoding.
     add 090ee84  update git submodule.
     add 0e8591f  rssg: remove -f from readlink.
     add d057ee0  Merge branch 'master' of git+ssh://gnunet.org/www
     add 530aab6  merge
     add 5f0ba1b  Merge branch 'master' of gnunet.org:www
     add 74b3565  This break rssg. I'll rewrite this part.
     add f585e21  revert back to 400 until the extraction does properly strip 
out html.
     add 97beb6b  better text extraction.
     add 076ecac  news, add paragraph.
     new eda66aa  Merge branch 'master' into stable

The 1 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:
 .gitmodules                      |  2 ++
 build-system/taler-build-scripts |  2 +-
 configure                        |  3 ++-
 news/2019-11-ICANNUpdate.html.j2 |  5 ++++-
 template.py                      | 30 +++++++++++++++++++++++-------
 5 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/.gitmodules b/.gitmodules
index 6ddd9f2..d21ef0d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,6 +2,8 @@
        path = help
        url = git://taler.net/help
        branch = master
+        ignore = dirty
 [submodule "build-system/taler-build-scripts"]
        path = build-system/taler-build-scripts
        url = git://git.taler.net/build-common
+        ignore = dirty
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
index 2536801..ff59117 160000
--- a/build-system/taler-build-scripts
+++ b/build-system/taler-build-scripts
@@ -1 +1 @@
-Subproject commit 2536801927781ea38fefc3de924934e1c6a74d88
+Subproject commit ff59117f2814c866e45ef8b3265b8596264d4eba
diff --git a/configure b/configure
index 4ffb738..e2be5fa 100755
--- a/configure
+++ b/configure
@@ -32,7 +32,8 @@
 
 # we invoke configure not as a symlink but as a copy,
 # so we have to use a fixed location for the repository!
-dir=$(dirname "$(readlink -f -- "$0")")/build-system/taler-build-scripts
+# dir=$(dirname "$(readlink -f -- "$0")")/build-system/taler-build-scripts
+dir=$(dirname "$(readlink -- "$0")")/build-system/taler-build-scripts
 . $dir/sh/lib.sh/existence.sh
 . $dir/sh/lib.sh/existence_python.sh
 
diff --git a/news/2019-11-ICANNUpdate.html.j2 b/news/2019-11-ICANNUpdate.html.j2
index 9c21ebc..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="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 IC [...]
+  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 d2dc5a9..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
@@ -154,7 +170,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")
@@ -165,13 +181,13 @@ def preview_text(filename):
         for i in soup.findAll('p')[1]:
             k.append(i)
         b = ''.join(str(e) for e in k)
-        text = b.replace("\n", "")
-        textreduced = (text[:1000] + '...') if len(text) > 1000 else (text + 
'..')
+        text = html2text(b.replace("\n", ""))
+        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 +287,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'], 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]