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

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

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

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