summaryrefslogtreecommitdiff
path: root/talerblog/blog/content.py
diff options
context:
space:
mode:
Diffstat (limited to 'talerblog/blog/content.py')
-rw-r--r--talerblog/blog/content.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/talerblog/blog/content.py b/talerblog/blog/content.py
index 8dddd1f..0ecfa66 100644
--- a/talerblog/blog/content.py
+++ b/talerblog/blog/content.py
@@ -33,6 +33,7 @@ Article = namedtuple("Article", "slug title teaser main_file extra_files")
# be made available in the blog.
ARTICLES = OrderedDict()
+
##
# Add article to the list of the available articles.
#
@@ -55,6 +56,7 @@ def get_image_file(image):
filex = resource_filename("talerblog", os.path.join("blog/data/", image))
return os.path.abspath(filex)
+
##
# Build the file path of a article.
#
@@ -81,7 +83,7 @@ def add_from_html(resource_name, teaser_paragraph=0, title=None):
soup = BeautifulSoup(res, 'html.parser')
res.close()
if title is None:
- title_el = soup.find("h1", attrs={"class":["chapter", "unnumbered"]})
+ title_el = soup.find("h1", attrs={"class": ["chapter", "unnumbered"]})
if title_el is None:
LOGGER.warning("Can't extract title from '%s'", resource_name)
title = resource_name
@@ -90,7 +92,7 @@ def add_from_html(resource_name, teaser_paragraph=0, title=None):
slug = title.replace(" ", "_")
paragraphs = soup.find_all("p")
- teaser = soup.find("p", attrs={"id":["teaser"]})
+ teaser = soup.find("p", attrs={"id": ["teaser"]})
if teaser is None:
teaser = paragraphs[teaser_paragraph].get_text()
else:
@@ -104,7 +106,10 @@ def add_from_html(resource_name, teaser_paragraph=0, title=None):
# component actually matches the article's slug
if re_proc.match(img['src']):
if img['src'].split(os.sep)[2] == slug:
- LOGGER.info("extra file for %s is %s" % (slug, os.path.basename(img['src'])))
+ LOGGER.info(
+ "extra file for %s is %s" %
+ (slug, os.path.basename(img['src']))
+ )
extra_files.append(os.path.basename(img['src']))
else:
LOGGER.warning("Image src and slug don't match: '%s' != '%s'" \