From 818a2274707fcea3a24c765809bcf7f4920df5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 15 Dec 2015 10:19:11 +0100 Subject: [PATCH] misc: always embed unmarked text in a paragraph tag (#9332) --- tests/test_texts.py | 4 ++-- wcs/qommon/admin/texts.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_texts.py b/tests/test_texts.py index b31da46..6249382 100644 --- a/tests/test_texts.py +++ b/tests/test_texts.py @@ -27,13 +27,13 @@ def test_get_html_text_unset(): def test_get_html_text_default(): TextsDirectory.register('foo2', 'Foo', default='Foo...') - assert TextsDirectory.get_html_text('foo2') == '
Foo...
' + assert TextsDirectory.get_html_text('foo2') == '

Foo...

' def test_get_html_text_set(): TextsDirectory.register('foo3', 'Foo', default='Foo...') pub.cfg['texts'] = {'text-foo3': None} pub.write_cfg() - assert TextsDirectory.get_html_text('foo3') == '
Foo...
' + assert TextsDirectory.get_html_text('foo3') == '

Foo...

' pub.cfg['texts'] = {'text-foo3': 'Bar...'} pub.write_cfg() assert TextsDirectory.get_html_text('foo3') == '

Bar...

' diff --git a/wcs/qommon/admin/texts.py b/wcs/qommon/admin/texts.py index 1caf2dc..e280502 100644 --- a/wcs/qommon/admin/texts.py +++ b/wcs/qommon/admin/texts.py @@ -41,9 +41,9 @@ class TextsDirectory(Directory): return htmltext(open(filepath).read()) return '' text = _(default) - else: - if text[0] != '<': - text = '

%s

' % text + + if not text.startswith('<'): + text = '

%s

' % text subst_vars = get_publisher().substitutions.get_context_variables() if vars: -- 2.6.4