-
Notifications
You must be signed in to change notification settings - Fork 106
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support recursive with dominate.document() #157
Comments
No issue/problem/question stated and this looks working as intended |
@Knio This come up in real life, when I try to use dominate, as I try to create multiple webpage in a hirearchical order. I initially wrote a recursive function to do that, starting from the main entry, generating hyperlink on needed, but as dominate doesnt support that I have to rewrite it from a top-down to a bottom-up manner. |
This project is not meant to be an html validator - i.e. it doesn't check that
This is explicitly asking for it to be the context. Not doing so would break the expectations of the API. If you don't want the effect, why not just write If
That seems like an excessive reaction, why don't you just subclass class mydoc(dominate.document):
def _add_to_ctx(self): pass # don't add to contexts With your example do what I think you want: >>> with mydoc() as outer_doc:
... with mydoc() as inner_doc:
... p('meow')
... print(inner_doc)
...
<dominate.tags.p at 1bb1a765160: 0 attributes, 1 child>
<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body>
<p>meow</p>
</body>
</html>
>>> print(outer_doc)
<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body></body>
</html>
|
Thx. the subclass solution is excatly what I want. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
output
The text was updated successfully, but these errors were encountered: