misc: don't use <p> for comment fields when there are block level tags (#18691)

This commit is contained in:
Frédéric Péters 2017-09-14 10:42:11 +02:00
parent a29a9d9c0d
commit 91a4409209
1 changed files with 6 additions and 4 deletions

View File

@ -513,10 +513,12 @@ class CommentField(Field):
import wcs.workflows
label = wcs.workflows.template_on_html_string(label)
if '<p' in label:
enclosing_tag = 'div'
else:
enclosing_tag = 'p'
enclosing_tag = 'p'
for block_level in ('p', 'div', 'ul', 'ol', 'hr'):
if '<' + block_level in label:
enclosing_tag = 'div'
break
form.widgets.append(HtmlWidget(
htmltext('<%s %s>%s</%s>' % (enclosing_tag, class_attribute,
label, enclosing_tag))))