Add INTRASITE_LINK_REGEX to configuration that user can modify

Updates getpelican/pelican#1061
This commit is contained in:
Talha Mansoor 2013-08-29 23:33:14 +05:00
commit 315f066398
2 changed files with 8 additions and 7 deletions

View file

@ -182,13 +182,7 @@ class Content(object):
if not content:
return content
hrefs = re.compile(r"""
(?P<markup><\s*[^\>]* # match tag with src and href attr
(?:href|src)\s*=)
(?P<quote>["\']) # require value to be quoted
(?P<path>[|{](?P<what>.*?)[|}](?P<value>.*?)) # the url value
\2""", re.X)
hrefs = re.compile(self.settings['INTRASITE_LINK_REGEX'], re.X)
def replacer(m):
what = m.group('what')

View file

@ -110,6 +110,13 @@ DEFAULT_CONFIG = {
'TEMPLATE_PAGES': {},
'IGNORE_FILES': ['.#*'],
'SLUG_SUBSTITUTIONS': (),
'INTRASITE_LINK_REGEX': r"""
(?P<markup><\s*[^\>]* # match tag with src and href attr
(?:href|src)\s*=)
(?P<quote>["\']) # require value to be quoted
(?P<path>[|{](?P<what>.*?)[|}](?P<value>.*?)) # the url value
\2""",
}