donpark / html2jade

Converts HTML to Jade template. Not perfect but useful enough for non-daily conversions.
MIT License
1.18k stars 156 forks source link

Spaces getting removed #76

Closed rmdort closed 10 years ago

rmdort commented 10 years ago

I have spotted an issue where spaces are removed by the parser

image

image

If you notice, there should be a space between the text and the link.

donpark commented 10 years ago

Either a loose trim or a DOM impl. difference. Will take a look

donpark commented 10 years ago

Text auto-trimming logic was very sloppy. Raising priority to Major. Can't believe no one complained until now.

rmdort commented 10 years ago

Hi Don,

This happens with strong tag as well. Attached screenshot

image

There should be a space after strong tag

donpark commented 10 years ago

will take a look. not likely soon though unless someone screams.

rmdort commented 10 years ago

I am :P

It would be really great if you could take a look. I am in the middle of content migration of 800+ html pages to jade. Everything has been running smooth and fast, except for this one little bug :)

donpark commented 10 years ago

Ouch. html2jade is not quite good enough for automated use but I'll take a look tomorrow.

donpark commented 10 years ago

@rmdort I can't replicate this bug. my environment: platform: OS X Yosemite node: 0.10.33 html2jade: 0.8.0

Which version of html2jade and what platform are you using?

If you are not using html2jade directly but via one of the websites like html2jade.org as your screenshot shows above, I think the problem is they are using an older version of html2jade.

rmdort commented 10 years ago

Hi Don,

The bug appears when there is a <a> tag before <strong>. The space between closing </a> and opening <strong> is removed

For example

<p>Hey there, <a href="#">html2jade</a> <strong>is awesome</strong></p>

gets rendered as

p
    Hey there, 
    a(href="#") html2jade
    strong is awesome

when it should be

p
    Hey there, 
    a(href="#") html2jade
    |  
    strong is awesome

My environment is the same as yours, except its node v10.29

donpark commented 10 years ago

aha. was able to replicate the bug and am now looking at the code.

donpark commented 10 years ago

@rmdort version 0.8.1 should do what you need.