diff options
Diffstat (limited to 'trac2md.py')
-rwxr-xr-x | trac2md.py | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -14,14 +14,17 @@ from base64 import b64decode 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:(.+)\]") -strikethrough_pattern = re.compile("~~(.*)~~") -camelcase_pattern = re.compile("!(\w+)") -image_pattern = re.compile("\[\[Image\((.*)\)\]\]") - -wikiheading_patterns = tuple((level, re.compile("^{} (.*)[ \t]*=*$".format("=" * level))) - for level in range(1, 7)) +image_pattern = re.compile(r"\[\[Image\((.*)\)\]\]") + +wikilink_1_pattern = re.compile(r"\[\[(http.*)\]\]|\[(http.*)\]") +wikilink_2_pattern = re.compile(r"\[\[(?:wiki:)?([a-zA-Z0-9_]+)\]\]|\[wiki:(.+)\]") + +strikethrough_pattern = re.compile(r"~~(.*)~~") +camelcase_pattern = re.compile(r"!((?:\w|[#])+)") + +wikiheading_patterns = tuple( + (level, re.compile("^{} (.*)[ \t]*=*$".format("=" * level))) + for level in range(1, 7)) def to_timestamp(tm): ''' Convert to timestamp which can be jsonified ''' |