1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
"""
Settings that modify processing of user text input
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps.livesettings import ConfigurationGroup
from askbot.deps.livesettings import BooleanValue, StringValue
from django.utils.translation import ugettext as _
import askbot
from askbot import const
import os
MARKUP = ConfigurationGroup(
'MARKUP',
_('Markup formatting')
)
AUTOLINK = ConfigurationGroup(
'AUTOLINK',
_('Auto link a pattern to an URL')
)
settings.register(
BooleanValue(
MARKUP,
'MARKUP_CODE_FRIENDLY',
description = _('Enable code-friendly Markdown'),
help_text = _(
'If checked, underscore characters will not '
'trigger italic or bold formatting - '
'bold and italic text can still be marked up '
'with asterisks. Note that "MathJax support" '
'implicitly turns this feature on, because '
'underscores are heavily used in LaTeX input.'
),
default = False
)
)
settings.register(
BooleanValue(
MARKUP,
'ENABLE_MATHJAX',
description=_('Mathjax support (rendering of LaTeX)'),
help_text=_(
'If you enable this feature, '
'<a href="%(url)s">mathjax</a> must be '
'installed on your server in its own directory.'
) % {
'url': const.DEPENDENCY_URLS['mathjax'],
},
default = False
)
)
settings.register(
StringValue(
MARKUP,
'MATHJAX_BASE_URL',
description=_('Base url of MathJax deployment'),
help_text=_(
'Note - <strong>MathJax is not included with '
'askbot</strong> - you should deploy it yourself, '
'preferably at a separate domain and enter url '
'pointing to the "mathjax" directory '
'(for example: http://mysite.com/mathjax)'
),
default = ''
)
)
settings.register(
BooleanValue(
AUTOLINK,
'ENABLE_AUTO_LINKING',
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,
'AUTO_LINK_URL',
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 = ''
)
)
|