Esempio n. 1
0
File: util.py Progetto: 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']})
Esempio n. 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']
        })
Esempio n. 3
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue('<br' in text2html('abc\ndef'))
Esempio n. 4
0
 def format(self, item):
     return text2html(item.address)
Esempio n. 5
0
 def format(self, item):
     return text2html(item.address)
Esempio n. 6
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue("<br" in text2html("abc\ndef"))
Esempio n. 7
0
    def test_text2html(self):
        from clld.web.util.helpers import text2html

        self.assertTrue('<br' in text2html('abc\ndef'))
Esempio n. 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'))
Esempio n. 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')))
Esempio n. 10
0
File: util.py Progetto: clld/cariban
def text2html(*args, **kw):
    res = str(h.text2html(*args, **kw))
    res = res.replace(' class="table ', ' class="table table-nonfluid ')
    return res