donpark / html2jade

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

Fix bug always true #111

Closed dimensi closed 7 years ago

dimensi commented 8 years ago

I do not know much English. Always gives true, if at least one time to set true. Thank you for your work.

donpark commented 8 years ago

That's not a bug. CoffeeScript expression:

useTabs = true if options.tabs

compiles to:

if (options.tabs) {
  useTabs = true;
}
dimensi commented 8 years ago

it is BUG!!! If use your script on client side and change your tabs on true 1 TIME, tabs option always will be TRUE. Only RELOAD page fix this! Your expression check only true and always return true... Sorry for my english, i hope you understand me. Thank you advance. You can see in real, how bug work. https://html2pug.herokuapp.com/ https://github.com/edDimensi/html2pug Try swith on tabs and again space, you will see, server now all time send tabs.

donpark commented 7 years ago

@edDimensi I now see where you're coming from. html2jade started out as a command-line tool and browser support was added later so there could be other corner-case issues like this. JS module's singleton semantic also contributed to the problem.

Anyway, other flags also had similar problem so I went ahead and fixed them all directly without merging your PR.

Thx for reporting the bug and pushing back when I made erroneous conclusions.