From 315f066398d967028f162aeb4e62a6003675affa Mon Sep 17 00:00:00 2001 From: Talha Mansoor Date: Thu, 29 Aug 2013 23:33:14 +0500 Subject: [PATCH] Add INTRASITE_LINK_REGEX to configuration that user can modify Updates getpelican/pelican#1061 --- pelican/contents.py | 8 +------- pelican/settings.py | 7 +++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pelican/contents.py b/pelican/contents.py index 94790612..1f326b0d 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -182,13 +182,7 @@ class Content(object): if not content: return content - hrefs = re.compile(r""" - (?P<\s*[^\>]* # match tag with src and href attr - (?:href|src)\s*=) - - (?P["\']) # require value to be quoted - (?P[|{](?P.*?)[|}](?P.*?)) # the url value - \2""", re.X) + hrefs = re.compile(self.settings['INTRASITE_LINK_REGEX'], re.X) def replacer(m): what = m.group('what') diff --git a/pelican/settings.py b/pelican/settings.py index 1f2646f6..7b656960 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -110,6 +110,13 @@ DEFAULT_CONFIG = { 'TEMPLATE_PAGES': {}, 'IGNORE_FILES': ['.#*'], 'SLUG_SUBSTITUTIONS': (), + 'INTRASITE_LINK_REGEX': r""" + (?P<\s*[^\>]* # match tag with src and href attr + (?:href|src)\s*=) + + (?P["\']) # require value to be quoted + (?P[|{](?P.*?)[|}](?P.*?)) # the url value + \2""", }