summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun SAG <sagarun@gmail.com>2011-09-18 01:22:20 +0530
committerArun SAG <sagarun@gmail.com>2011-09-18 01:22:20 +0530
commit1980d43ecfb7f30f2904eb924319d5c6aff0e4ac (patch)
tree024d76d9a98ae94a2683679bcbc0541045acd218
parent2464b782aacd1bd7083b5169a520008631f69c03 (diff)
downloadaskbot-1980d43ecfb7f30f2904eb924319d5c6aff0e4ac.tar.gz
askbot-1980d43ecfb7f30f2904eb924319d5c6aff0e4ac.tar.bz2
askbot-1980d43ecfb7f30f2904eb924319d5c6aff0e4ac.zip
Add autolinking settings to conf/markup.py
- See #607 for more details on this feature - We use regex to match a pattern and autolink it
-rw-r--r--askbot/conf/markup.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/askbot/conf/markup.py b/askbot/conf/markup.py
index 026c5536..9eeb3149 100644
--- a/askbot/conf/markup.py
+++ b/askbot/conf/markup.py
@@ -15,6 +15,13 @@ MARKUP = ConfigurationGroup(
_('Markup formatting')
)
+AUTOLINK = ConfigurationGroup(
+ 'AUTOLINK',
+ _('Auto link a pattern to an URL')
+
+)
+
+
settings.register(
BooleanValue(
MARKUP,
@@ -63,3 +70,51 @@ settings.register(
default = ''
)
)
+
+
+settings.register(
+ BooleanValue(
+ AUTOLINK,
+ 'ENABLE_AUTO_LINK',
+ description=_('Enable autolinking a specifc pattern'),
+ help_text=_(
+ 'If you enable this feature, '
+ 'the application will be able to '
+ 'detect patterns and auto link to URLs'
+ ),
+
+ default = False
+ )
+ )
+
+
+settings.register(
+ StringValue(
+ AUTOLINK,
+ 'Pattern',
+ description=_('Regex to detect the pattern'),
+ help_text=_(
+ 'Enter a valid regular expression to'
+ 'detect the pattern. For example to'
+ 'detect something like #rhbz 637402 '
+ 'use a regular expression like r"#rhbz\s(\d+)"'
+ ),
+ default = ''
+ )
+ )
+
+settings.register(
+ StringValue(
+ AUTOLINK,
+ 'AutoLinkURL',
+ description=_('URL for autolinking'),
+ help_text=_(
+ 'Let us assume that to detect a pattern #rhbz 637402'
+ ' the regex is r"#rhbz\s(\d+)" '
+ 'then the autolink URL should be https://bugzilla.redhat.com/show_bug.cgi?id=\\1'
+ ' Where \\1 is the saved match from the regular expression'
+ ),
+ default = ''
+ )
+ )
+