Esempio n. 1
0
def tag(children, data, name):
    """Wrap text into a tag.

    >>> print tag('em') ['important'].format().render_as('html')
    <em>important</em>
    >>> print sentence ['ready', 'set', tag('em') ['go']].format().render_as('html')
    Ready, set, <em>go</em>.
    """
    parts = _format_list(children, data)
    return richtext.Tag(name, *_format_list(children, data))
Esempio n. 2
0
def tag(children, data, name):
    """Wrap text into a tag.

    >>> import pybtex.backends.html
    >>> html = pybtex.backends.html.Backend()
    >>> print(tag('emph') ['important'].format().render(html))
    <em>important</em>
    >>> print(sentence ['ready', 'set', tag('emph') ['go']].format().render(html))
    Ready, set, <em>go</em>.
    """
    parts = _format_list(children, data)
    return richtext.Tag(name, *_format_list(children, data))