html2jade icon indicating copy to clipboard operation
html2jade copied to clipboard

Weird Jade output

Open briemens opened this issue 13 years ago • 5 comments

Hi Don! Love your project.

I'm getting some weird output. I'm converting a generated HTML file to JADE.

The source HTML file...

http://share.crafity.com/UQKs

The scrambled JADE output

http://share.crafity.com/PrTN

Any ideas?

PS. Installed html2jade from NPM

briemens avatar Sep 21 '12 14:09 briemens

Definitely a bug. I'll take a look. thx Bart.

donpark avatar Sep 21 '12 19:09 donpark

TJ @visionmedia, how would you code the following HTML in Jade?

<pre class="hl"><span class="hl slc">// Generated by CoffeeScript 1.3.3</span>
<span class="hl opt">(</span><span class="hl kwa">function</span><span class="hl opt">() {</span>
</pre>

donpark avatar Sep 21 '12 20:09 donpark

@briemens I tried to manually convert your PRE example and found it really awkward. What would your expected output Jade file look like?

donpark avatar Sep 22 '12 06:09 donpark

@donpark I use the command line tool highlight to create a syntax highlighted HTML files from JS files. In this example I converted your html2jade.js file to HTML. The HTML is not nice to look at, but with the right CSS the browser renders it correct.

I would expect the following Jade output based on the HTML above

pre.hl
    span.hl.slc // Generated by CoffeeScript 1.3.3
    span.hl.opt (
    span.hl.kwa function
    span.hl.opt () {

briemens avatar Sep 22 '12 10:09 briemens

Disabling special handling of pre tag generates exactly that. Problem is blank lines and white spaces have to be inserted awkwardly to break up the lines and indent output correctly to make them render correctly. By 'awkwardly', I mean pretty ugly and arbitrary looking jade which defeats the whole purpose of jade.

I am afraid I'll have to sit on this bug for a while. Maybe TJ will add some syntactic sugar to make pre in Jade actually pretty. :-p

donpark avatar Sep 22 '12 12:09 donpark