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

Add an option to clean up the tables #7

Open
mcintyre94 opened this issue Mar 25, 2018 · 0 comments
Open

Add an option to clean up the tables #7

mcintyre94 opened this issue Mar 25, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@mcintyre94
Copy link
Owner

RAGE table cells have a lot of non-HTML attributes, a title tag and lots of style etc. This is an OK default because it means the HTML dumped looks + acts exactly the same as the original report, but for other consumers it makes sense to clean the data - eg. it doesn't parse well as-is. The simplest thing is just to remove all the attributes from the div inside each elements.

eg.

    td_wrapped = f"<html><body><table><tr>{td}</tr></table></body></html>"

    parsed = BeautifulSoup(td_wrapped, 'html.parser')
    td_div_tag = parsed.td.div
    td_div_tag.attrs={}

    return parsed.td

In ragelib this could be done on all elements together, saving the awkward wrapping to make it parse and probably performing better.

@mcintyre94 mcintyre94 added the enhancement New feature or request label Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant