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']})
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'] })
def test_text2html(self): from clld.web.util.helpers import text2html self.assertTrue('<br' in text2html('abc\ndef'))
def format(self, item): return text2html(item.address)
def test_text2html(self): from clld.web.util.helpers import text2html self.assertTrue("<br" in text2html("abc\ndef"))
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'))
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')))
def text2html(*args, **kw): res = str(h.text2html(*args, **kw)) res = res.replace(' class="table ', ' class="table table-nonfluid ') return res