codenautas / js-from-html

js-to-html reverse
MIT License
0 stars 0 forks source link

El texto multilínea hay que ponerlo en múltiples strings #6

Closed emilioplatzer closed 8 years ago

emilioplatzer commented 8 years ago

Por ejemplo:

<pre>linea 1
linea 2
linea 3
</pre>

Debe quedar como

html.pre(
    "linea 1\n"+
    "linea 2\n"+
    "linea 3\n"
),

Lo mismo si hay mix de contenido:

<p>
Uno <b>bold</b> y
luego otro</p>

queda

html.p(
    "\n"+
    "Uno ",
    html.b("bold"),
    " y\n"+
    " luego otro",
), 
diegoefe commented 8 years ago

No falta un "\n" debajo de https://github.com/codenautas/js-from-html/blob/master/test/fixtures/pseudo-pp.js#L15? Donde dice:

html.pre(
        "\n"+
        "Array.prototype.forEach.call(document.body.childNodes, function(node){\n"+
        "    console.log(JSON.stringify(node.textContent));\n"+
        "});\n"
    ),

No debería decir?

html.pre(
        "\n"+
        "Array.prototype.forEach.call(document.body.childNodes, function(node){\n"+
        "    console.log(JSON.stringify(node.textContent));\n"+
        "});\n"+
        "\n"
    ),
emilioplatzer commented 8 years ago

Puede ser. Hay que mirar cómo queda el textContent metiendo el html de la entrada

On Tue, Apr 19, 2016 at 2:00 PM, Diego Florio notifications@github.com wrote:

No falta un "\n" debajo de https://github.com/codenautas/js-from-html/blob/master/test/fixtures/pseudo-pp.js#L15 ? Donde dice:

html.pre( "\n"+ "Array.prototype.forEach.call(document.body.childNodes, function(node){\n"+ " console.log(JSON.stringify(node.textContent));\n"+ "});\n" ),

No debería decir?

html.pre( "\n"+ "Array.prototype.forEach.call(document.body.childNodes, function(node){\n"+ " console.log(JSON.stringify(node.textContent));\n"+ "});\n"+ "\n" ),

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/codenautas/js-from-html/issues/6#issuecomment-212016234

diegoefe commented 8 years ago

No te entiendo

emilioplatzer commented 8 years ago

Opino que conviene hacer lo que haga el navegador. Pruebo con Chrome y utilizo el inspector y la consola obteniendo:

inspect1

cuando miro veo que el último "\n" no está, veo uno solo.

inspect2