From 84802cf52161d9a8e1380c67d83071de59f3e2ed Mon Sep 17 00:00:00 2001 From: Jonathan Golder Date: Sat, 28 Oct 2017 18:41:06 +0200 Subject: [PATCH] Remove leading or trailing spaces in articles Some articles contain spaces between title and anchor part which will be stripped now Related Task: [FS#159](https://fs.golderweb.de/index.php?do=details&task_id=159) --- lib/redfam.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/redfam.py b/lib/redfam.py index f36d1bc..6f73a5c 100644 --- a/lib/redfam.py +++ b/lib/redfam.py @@ -297,6 +297,10 @@ class RedFamParser( RedFam ): article[0] = article[0].replace("_", " ") if len(article) > 1: + # Strip both parts to prevent leading/trailing spaces + article[0] = article[0].strip() + article[1] = article[1].strip() + # other way round, replace spaces with underscores in anchors article[1] = article[1].replace(" ", "_")