Пример #1
0
Файл: util.py Проект: clld/wold2
def infobutton(desc, content_type='text', placement='right'):
    if not desc:
        return ''
    if content_type == 'text':
        desc = text2html(escape(desc, quote=True), mode='p')
    return button(
        icon('info-sign', inverted=True),
        **{
            'data-toggle': 'popover',
            'data-placement': placement,
            'data-content': desc,
            'class': ['btn-info', 'btn-mini', 'fieldinfo']})
Пример #2
0
def infobutton(desc, content_type='text', placement='right'):
    if not desc:
        return ''
    if content_type == 'text':
        desc = text2html(escape(desc, quote=True), mode='p')
    return button(
        icon('info-sign', inverted=True), **{
            'data-toggle': 'popover',
            'data-placement': placement,
            'data-content': desc,
            'class': ['btn-info', 'btn-mini', 'fieldinfo']
        })
Пример #3
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue('<br' in text2html('abc\ndef'))
Пример #4
0
 def format(self, item):
     return text2html(item.address)
Пример #5
0
 def format(self, item):
     return text2html(item.address)
Пример #6
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue("<br" in text2html("abc\ndef"))
Пример #7
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue('<br' in text2html('abc\ndef'))
Пример #8
0
def test_text2html(env):
    from clld.web.util.helpers import text2html

    assert '<br' in text2html('abc\ndef')
    assert 'div' in text_type(text2html('chunk', mode='p'))
Пример #9
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue('<br' in text2html('abc\ndef'))
        self.assertIn('div', text_type(text2html('chunk', mode='p')))
Пример #10
0
def text2html(*args, **kw):
    res = str(h.text2html(*args, **kw))
    res = res.replace(' class="table ', ' class="table table-nonfluid ')
    return res