Skip to content

Commit

Permalink
Merge pull request #14 from Rakoth/master
Browse files Browse the repository at this point in the history
Support for attributes values containing an equal sign in them
  • Loading branch information
doomspork committed Aug 5, 2015
2 parents 99f9a7d + a015015 commit ee3915d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/slim_fast/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule SlimFast.Parser do
end

defp html_attribute(attribute) do
[key, value] = attribute |> String.split("=")
[key, value] = attribute |> String.split("=", parts: 2)
key = key
|> String.strip
|> String.to_atom
Expand Down
6 changes: 6 additions & 0 deletions test/renderer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ defmodule RendererTest do
articles: [%{name: "Art 1", desc: "Desc 1"}, %{name: "Art 2", desc: "Desc 2"}]
) == @inline_html
end

test "render attributes with equal sign in value" do
assert render(
~s(meta content="width=device-width, initial-scale=1" name="viewport")
) == ~s(<meta name="viewport" content="width=device-width, initial-scale=1">)
end
end

0 comments on commit ee3915d

Please sign in to comment.