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

Parser Ability To Handle Embedded Tables #57

Closed
bhreinb opened this issue Aug 22, 2017 · 6 comments
Closed

Parser Ability To Handle Embedded Tables #57

bhreinb opened this issue Aug 22, 2017 · 6 comments

Comments

@bhreinb
Copy link

bhreinb commented Aug 22, 2017

Hi There,

I have a minimum set of instructions to reproduce an issue I believe is with the parser. The set of steps to reproduce are the following:

  1. Read Sample File Using i.e.
    HtmlTemplate = fs.readFileSync(TemplateHtmlPath, {encoding: 'utf8'});
  2. Convert To Json i.e.
    JsonTemplate = himalaya.parse(HtmlTemplate );
  3. Convert the Json Back To Html & Write To File i.e.
    let Html = toHTML(JsonTemplate );
    fs.writeFileSync(FinalHtmlPath, Html);

The Html returned from toHTML(JsonTemplate) is very different to the HTML that was originally loaded into the program. I don't think the module currently handles embedded tables. Thoughts? I attach sample files (Test.html, script.js & style.css). As you can see from the sample html it contains embedded tables.

Test.zip

@andrejewski
Copy link
Owner

Minimal case:

<table><tbody><tr><td><table><tbody></tbody></table></td></tr></tbody></table>

I will look into this when I have time.

@bhreinb
Copy link
Author

bhreinb commented Aug 22, 2017

Lol it sure is. Thanks and let me know if you need any help reproducing this.

@andrejewski
Copy link
Owner

andrejewski commented Aug 23, 2017

@bhreinb The fix has been released in v0.2.11. Thank you for your contribution.

@bhreinb
Copy link
Author

bhreinb commented Aug 23, 2017

thanks @andrejewski I got the latest 0.2.11 but this doesn't appear to be fixed as of yet....do you want me to send sample code and a test file? I think the minimal test scenario is missing embedding tr & td for example

OLD
<table><tbody><tr><td><table><tbody></tbody></table></td></tr></tbody></table>

NEW
<table><tbody><tr><td><table><tbody><tr><td></td><td></td></tr></tbody></table></td></tr></tbody></table>

The tr and td tags are been pushed to the top level table.

@andrejewski
Copy link
Owner

Ah, I see. I made the parser demo to help with issues so usually a HTML snippet is fine and I can load it up in the demo and see the problem. This will take a very similar fix and test cases, hopefully I can get this fixed when I find some time.

@bhreinb
Copy link
Author

bhreinb commented Aug 25, 2017

Hey @andrejewski thanks for the fix looks good. All the best.

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