aboutsummaryrefslogtreecommitdiff
path: root/trac2md.py
diff options
context:
space:
mode:
Diffstat (limited to 'trac2md.py')
-rwxr-xr-xtrac2md.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/trac2md.py b/trac2md.py
index 6645bc7..0804608 100755
--- a/trac2md.py
+++ b/trac2md.py
@@ -15,7 +15,7 @@ from datetime import datetime
from urllib.parse import quote
wikilink_1_pattern = re.compile("\[\[(http.*)\]\]|\[(http.*)\]")
-wikilink_2_pattern = re.compile("\[\[(?:wiki:)?([a-zA-Z0-9_]+)\]\]|\[wiki:([a-zA-Z0-9_]+)\]")
+wikilink_2_pattern = re.compile("\[\[(?:wiki:)?([a-zA-Z0-9_]+)\]\]|\[wiki:(.+)\]")
strikethrough_pattern = re.compile("~~(.*)~~")
camelcase_pattern = re.compile("!(\w+)")
image_pattern = re.compile("\[\[Image\((.*)\)\]\]")
@@ -95,7 +95,13 @@ def convert_wikilinks_2(line):
if text.lower() == "pageoutline":
mdlink = ""
else:
- mdlink = "[{0}]({0})".format(text)
+ for sep in "| ":
+ if sep in text:
+ parts = text.split(sep, 1)
+ break
+ else:
+ parts = [text]
+ mdlink = "[{}]({})".format(parts[-1], parts[0])
line = line.replace(m.group(0), mdlink)
return line