nlg_tags #
The nlg_tags method allows allows to create a string containing HTML tags with attributes and encapsulate text into them.
nlg = NlgTools()
nlg.nlg_tags('br')
# <br>
nlg.nlg_tags('p', TextVar(
'This is a',
nlg.nlg_tags('b', 'sentence with bold'),
'in a paragraph.'
))
# <p>This is a <b>sentence with bold</p> in a paragraph.</p>
nlg.nlg_tags('div',
nlg.nlg_tags('h1', "My content"),
id="title_div"
)
# <div id="title_div"><h1>My content</h1></div>
Parameters #
Parameter | Type | Default Value |
---|---|---|
the html tag to create | string | |
text (the text to write inside the tag) | string | "" |
_class (the html class attribute to provide to the tag) | string | "" |
**args (key-values to add html attributes to the tag) | key=string (e.g. id=“my_id”) | None |