From 02e53475f1091f8eba58c47ba1af703e2f1e3292 Mon Sep 17 00:00:00 2001 From: Jonathan Golder Date: Sat, 9 Sep 2017 21:35:36 +0200 Subject: [PATCH] Prevent lowercase article titles in Parser Since real lowercase article titles are not allowed, make sure to convert all first letters of article titles to uppercase. This is neccessary since pywikibot will return article titles like this. Related Task: [FS#157](https://fs.golderweb.de/index.php?do=details&task_id=157) --- lib/redfam.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/redfam.py b/lib/redfam.py index 6a9402c..f36d1bc 100644 --- a/lib/redfam.py +++ b/lib/redfam.py @@ -284,6 +284,13 @@ class RedFamParser( RedFam ): for link in heading.ifilter_wikilinks(): article = str( link.title ).strip() + # Short circuit empty links + if not article: + continue + + # Make sure first letter is uppercase + article = article[0].upper() + article[1:] + # Split in title and anchor part article = article.split("#", 1) # Replace underscores in title with spaces