[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-merchant-demos] branch master updated: try to fix #7390: ti
From: |
gnunet |
Subject: |
[taler-taler-merchant-demos] branch master updated: try to fix #7390: title extraction for 'Only the Free World Can Stand up to Microsoft' and related issues |
Date: |
Wed, 19 Oct 2022 08:27:23 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository taler-merchant-demos.
The following commit(s) were added to refs/heads/master by this push:
new 25314dd try to fix #7390: title extraction for 'Only the Free World
Can Stand up to Microsoft' and related issues
25314dd is described below
commit 25314dd613ecaed102567b2aa3745de34817aaf3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Oct 19 08:27:10 2022 +0200
try to fix #7390: title extraction for 'Only the Free World Can Stand up to
Microsoft' and related issues
---
talermerchantdemos/blog/content.py | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/talermerchantdemos/blog/content.py
b/talermerchantdemos/blog/content.py
index 8de89f4..ba69248 100644
--- a/talermerchantdemos/blog/content.py
+++ b/talermerchantdemos/blog/content.py
@@ -104,10 +104,21 @@ def add_from_html(resource_name, lang):
teaser = soup.find("p", attrs={"id": ["teaser"]})
if teaser is None:
paragraphs = soup.find_all("p")
- if len(paragraphs) > 0:
- teaser = paragraphs[0].get_text()
- if (len(paragraphs) > 1) and (len(teaser) < 100):
- teaser2 = paragraphs[1].get_text()
+ lists = soup.find_all("li")
+ if (len(paragraphs) > 0) and (len(lists) > 0):
+ if (paragraphs[0].sourcepos > lists[0].sourcepos):
+ titleat = lists
+ else:
+ titleat = paragraphs
+ else:
+ if (len(paragraphs) > 0):
+ titleat = paragraphs
+ else:
+ titleat = lists
+ if len(titleat) > 0:
+ teaser = titelat[0].prettify()
+ if (len(titleat) > 1) and (len(teaser) < 100):
+ teaser2 = titleat[1].prettify()
if len(teaser2) > len(teaser):
teaser = teaser2
else:
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taler-merchant-demos] branch master updated: try to fix #7390: title extraction for 'Only the Free World Can Stand up to Microsoft' and related issues,
gnunet <=