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

Possible to generate without html and body? #69

Closed Wolfr closed 10 years ago

Wolfr commented 10 years ago

I often have to do conversion from jade to HTML and back.

html2jade automatically puts

html
    body

before my code, is there a way to circumvent this?

These lines from the html2jade.coffee script seem relevant:

if document.documentElement
  @children document, output, false
else
  # documentElement is missing.
  # not sure why but this happens with jsdom when document has no body
  # HACK: generate manually
  htmlEls = document.getElementsByTagName 'html'
  @element htmlEls[0], output if htmlEls.length > 0
donpark commented 10 years ago

Issue #68 does this but I haven't merged it into code yet because it's in javascript instead of CoffeeScript.

donpark commented 10 years ago

Started working on this, adding bodyless option

donpark commented 10 years ago

Implemented in version 0.6.3

Wolfr commented 10 years ago

Superb!