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

Don't work with Angular 2 template syntax #116

Open desaroger opened 7 years ago

desaroger commented 7 years ago

Angular 2 makes use of case-sensitive attributes.

For this test I have this html:

<nav>
      <span>
        <a [routerLink]=" ['./'] ">
          Index
        </a>
      </span>
</nav>

If I run:

$ html2hade test.html --bodyless

I get:

nav
  span
    a([routerlink]=" ['./'] ")
      | Index

As you can see, now the attribute routerLink is in lowercase, routerlink, and doesn't work anymore with Angular.

I tried with -s and --donotencode, same results.

donpark commented 7 years ago

This is related to #102 and share root cause: DOM parser used (jsdom) either did not or does not preserve case.

desaroger commented 7 years ago

Hi @donpark, oh I see jsdom-little isn't updated from 2 years :/

Do you have any plan to solve this? Changing the DOM parser or something like this? Oh and sorry for duplicate issues, I made a search but didn't found that one.

donpark commented 7 years ago

@desaroger well, this issue calls for a major change which will very likely disturb existing users so I think it's best to fork.

@aichholzer any plan to address this issue?

aichholzer commented 7 years ago

@desaroger a complete re-write is on the way. I will revisit this issue when I get there. Thank you for reporting it.

rmckeel commented 7 years ago

@aichholzer Thanks, happy to see a resolution for this issue as I use html2jade all the time, and just now getting into Angular2 with case-sensitive dom elements. Thanks!

rsxdalv commented 7 years ago

Same with ngModel