66425d1aea15 — Marcin Cieślak 6 years ago
Don't remove plain [ ] that do not constitute links.
1 files changed, 4 insertions(+), 6 deletions(-)

M plwiki/chemia/comp.py
M plwiki/chemia/comp.py +4 -6
@@ 55,12 55,10 @@ class CompoundWikiReader:
 
 class Compound:
 	LINKS = [
-		re.compile("\[\[.+?\|"),
-		re.compile("\[\["),
-		re.compile("\[.+? +"),
-		re.compile("\]+"),
-		(re.compile("<br>"), " "),
-		(re.compile("<br/>"), " "),
+		(re.compile("\[\[.+?\|(.*)\]\]"), lambda re: re.match(1)),
+		(re.compile("\[.+? +(.*)\]"), lambda re: re.match(1)),
+		(re.compile("<br>"), lambda re: " "),
+		(re.compile("<br/>"), lambda re: " "),
 	]
 	REMOVE = [
 		re.compile("<sup>.*?</sup>"),