|
21 | 21 | from indico.modules.attachments.models.attachments import AttachmentType
|
22 | 22 | from indico.modules.events.views import WPSimpleEventDisplay
|
23 | 23 | from indico.util.date_time import now_utc
|
| 24 | +from indico.util.string import render_markdown |
24 | 25 | from indico.web.forms.base import IndicoForm
|
25 | 26 | from indico.web.forms.fields import IndicoPasswordField, TextListField
|
26 | 27 | from indico.web.forms.validators import HiddenUnless
|
@@ -61,7 +62,8 @@ class SettingsForm(IndicoForm):
|
61 | 62 | cloudconvert_conversion_notice = TextAreaField(_('PDF conversion notice'),
|
62 | 63 | description=_('A notice that will be shown to end users when '
|
63 | 64 | 'converting PDF files in the upload files dialog. '
|
64 |
| - 'You may use basic HTML elements for formatting.')) |
| 65 | + 'You may use Markdown and basic HTML elements for ' |
| 66 | + 'formatting.')) |
65 | 67 | valid_extensions = TextListField(_('Extensions'),
|
66 | 68 | filters=[lambda exts: sorted({ext.lower().lstrip('.').strip() for ext in exts})],
|
67 | 69 | description=_('File extensions for which PDF conversion is supported. '
|
@@ -114,11 +116,14 @@ def _add_file_form_fields(self, form_cls, **kwargs):
|
114 | 116 | description = _('If enabled, your files will be converted to PDF if possible. '
|
115 | 117 | 'The following file types can be converted: {exts}').format(exts=exts)
|
116 | 118 | if self.settings.get('cloudconvert_conversion_notice'):
|
117 |
| - description = '{}<br>{}'.format(self.settings.get('cloudconvert_conversion_notice'), |
118 |
| - _('The following file types can be converted: {exts}').format(exts=exts)) |
| 119 | + notice = Markup(render_markdown(self.settings.get('cloudconvert_conversion_notice'))) # noqa: RUF035 |
| 120 | + description = Markup('{}<br>{}').format( |
| 121 | + notice, |
| 122 | + _('The following file types can be converted: {exts}').format(exts=exts) |
| 123 | + ) |
119 | 124 | return 'convert_to_pdf', \
|
120 | 125 | BooleanField(_('Convert to PDF'), widget=SwitchWidget(),
|
121 |
| - description=Markup(description), |
| 126 | + description=description, |
122 | 127 | default=True)
|
123 | 128 |
|
124 | 129 | def _add_url_form_fields(self, form_cls, **kwargs):
|
|
0 commit comments