Giter Site home page Giter Site logo

Textarea adds blank lines about slime HOT 5 CLOSED

slime-lang avatar slime-lang commented on August 28, 2024
Textarea adds blank lines

from slime.

Comments (5)

henrik avatar henrik commented on August 28, 2024

Looking into this myself. Happens with textarea = "foo" but not textarea foo

from slime.

henrik avatar henrik commented on August 28, 2024

Failing test:

  test "does not add linebreaks to textarea with '=' output" do
    slim = ~s"""
    textarea = "foo"
    """

    assert render(slim) == ~s(<textarea>foo</textarea>)
  end

Will see if I can figure out how to fix it, too, but I suspect that's trickier.

from slime.

henrik avatar henrik commented on August 28, 2024

This change will fix my test but break a bunch of others:

--- a/lib/slim_fast/compiler.ex
+++ b/lib/slim_fast/compiler.ex
@@ -43,7 +43,7 @@ defmodule SlimFast.Compiler do

   defp open(_, %{type: :eex, content: code, attributes: attrs}) do
     inline = if attrs[:inline], do: "=", else: ""
-    "<%#{inline} #{code} %>\n"
+    "<%#{inline} #{code} %>"
   end

Don't want to wrap my head around this now, so I think I'll leave it at that :)

from slime.

henrik avatar henrik commented on August 28, 2024

I don't completely understand why those newlines are being added. They're also added e.g. inside <title> which seems weird. So the simplest fix would just be to not add those newlines anywhere, but I guess there's some reason they were introduced?

If the newlines should remain, I did figure out how to skip them for textareas only, though it's not super pretty: henrik@2de86b3

from slime.

doomspork avatar doomspork commented on August 28, 2024

Hey @henrik! I haven't had a chance to look into this yet but I suspect this PR is to blame for the newlines.

from slime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.