← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands-website/correct_link_coloring into lp:widelands-website

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/correct_link_coloring into lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1732101 in Widelands Website: "Wiki link color markup can't handle %20"
  https://bugs.launchpad.net/widelands-website/+bug/1732101

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/correct_link_coloring/+merge/333697

A small change...

Use urllib.unquote() to get a clean name for a wikiarticle, so a database query will find it.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/correct_link_coloring into lp:widelands-website.
=== modified file 'mainpage/templatetags/wl_markdown.py'
--- mainpage/templatetags/wl_markdown.py	2017-07-06 06:28:44 +0000
+++ mainpage/templatetags/wl_markdown.py	2017-11-14 17:00:34 +0000
@@ -22,6 +22,7 @@
     raise ImportError, 'Markdown library to old!'
 from markdown import markdown
 import re
+import urllib
 import bleach
 
 from BeautifulSoup import BeautifulSoup, NavigableString
@@ -113,7 +114,7 @@
 
         # Check for missing wikilink /wiki/PageName[/additionl/stuff]
         # Using href because we need cAsEs here
-        pn = tag['href'][6:].split('/', 1)[0]
+        pn = urllib.unquote(tag['href'][6:].split('/', 1)[0])
 
         if not len(pn):  # Wiki root link is not a page
             return {'class': 'wrongLink', 'title': 'This Link misses an articlename'}


Follow ups