Projet

Général

Profil

0001-misc-always-embed-unmarked-text-in-a-paragraph-tag-9.patch

Frédéric Péters, 15 décembre 2015 10:35

Télécharger (1,94 ko)

Voir les différences:

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(-)
tests/test_texts.py
27 27

  
28 28
def test_get_html_text_default():
29 29
    TextsDirectory.register('foo2', 'Foo', default='Foo...')
30
    assert TextsDirectory.get_html_text('foo2') == '<div class="text-foo2">Foo...</div>'
30
    assert TextsDirectory.get_html_text('foo2') == '<div class="text-foo2"><p>Foo...</p></div>'
31 31

  
32 32
def test_get_html_text_set():
33 33
    TextsDirectory.register('foo3', 'Foo', default='Foo...')
34 34
    pub.cfg['texts'] = {'text-foo3': None}
35 35
    pub.write_cfg()
36
    assert TextsDirectory.get_html_text('foo3') == '<div class="text-foo3">Foo...</div>'
36
    assert TextsDirectory.get_html_text('foo3') == '<div class="text-foo3"><p>Foo...</p></div>'
37 37
    pub.cfg['texts'] = {'text-foo3': 'Bar...'}
38 38
    pub.write_cfg()
39 39
    assert TextsDirectory.get_html_text('foo3') == '<div class="text-foo3"><p>Bar...</p></div>'
wcs/qommon/admin/texts.py
41 41
                    return htmltext(open(filepath).read())
42 42
                return ''
43 43
            text = _(default)
44
        else:
45
            if text[0] != '<':
46
                text = '<p>%s</p>' % text
44

  
45
        if not text.startswith('<'):
46
            text = '<p>%s</p>' % text
47 47

  
48 48
        subst_vars = get_publisher().substitutions.get_context_variables()
49 49
        if vars:
50
-