Skip to content
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

Make it possible to clone a node #24

Open
dmbaturin opened this issue Jul 22, 2019 · 3 comments
Open

Make it possible to clone a node #24

dmbaturin opened this issue Jul 22, 2019 · 3 comments

Comments

@dmbaturin
Copy link
Contributor

In some HTML manipulation tasks, you need to create a copy of a node without deleting the original.
For example, if you are making a page ToC, you need to take the content of the original <h*> tag and insert it into a link to that header. Now if you do let e = Soup.select_one "someselector" in Soup.append_child e p, e will be moved to p.

Unless I'm missing something, there's no way to do it now other than to convert a node to string and then parse it back.

@aantron
Copy link
Owner

aantron commented Jul 23, 2019

That's right, there is no other way right now.

@dmbaturin
Copy link
Contributor Author

Are there any fundamental difficulties, or it's a matter of just getting it done?

Got any pointers for diving into the source?

@aantron
Copy link
Owner

aantron commented Jul 24, 2019

I don't think there are any fundamental obstacles. You're welcome to ask here if you have any difficulties with the source :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants