Closed roskakori closed 2 years ago
document
inherits from the tag class, so all the regular attribute setting methods work:
d = dominate.document()
...
d['lang'] = 'en'
...
with d:
dominate.tags.attr(lang='en')
...
d.set_attribute('lang','en')
...
print(d.render())
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dominate</title>
</head>
<body></body>
</html>
Perhaps a fix to make it more convenient would be to just pass **kwargs
to the super in the document
constructor (and maybe *args
into the body tag)
Thanks!
According to "Declaring language in HTML" the recommended way to specify the language of an HTML document is:
However, the document tag does not provide any means to set it:
It would be nice to have an optional parameter
lang=None
that if set to e.g.lang='en'
would set the respective attribute for<html>
.AFAICT this would be a rather simple change in
document.render()
, so if you want I can look into it and submit a pull request.