##// END OF EJS Templates
update patterns for strip_files filter...
MinRK -
Show More
@@ -122,8 +122,8 b' def strip_dollars(text):'
122 return text.strip('$')
122 return text.strip('$')
123
123
124
124
125 files_url_pattern = re.compile(r'(src|href)\=([\'"]?)files/')
125 files_url_pattern = re.compile(r'(src|href)\=([\'"]?)/?files/')
126 markdown_url_pattern = re.compile(r'!\[(?P<caption>.*?)\]\(/?files/(?P<location>.*?)\)')
126 markdown_url_pattern = re.compile(r'(!?)\[(?P<caption>.*?)\]\(/?files/(?P<location>.*?)\)')
127
127
128 def strip_files_prefix(text):
128 def strip_files_prefix(text):
129 """
129 """
@@ -136,7 +136,7 b' def strip_files_prefix(text):'
136 Text in which to replace 'src="files/real...' with 'src="real...'
136 Text in which to replace 'src="files/real...' with 'src="real...'
137 """
137 """
138 cleaned_text = files_url_pattern.sub(r"\1=\2", text)
138 cleaned_text = files_url_pattern.sub(r"\1=\2", text)
139 cleaned_text = markdown_url_pattern.sub(r'![\1](\2)', cleaned_text)
139 cleaned_text = markdown_url_pattern.sub(r'\1[\2](\3)', cleaned_text)
140 return cleaned_text
140 return cleaned_text
141
141
142
142
General Comments 0
You need to be logged in to leave comments. Login now