Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes markdown dependency, fixes bugs #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions lib/ex_brace_expansion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule ExBraceExpansion do

## Examples
iex> import ExBraceExpansion
nil
ExBraceExpansion

iex> expand("file-{a,b,c}.jpg")
["file-a.jpg", "file-b.jpg", "file-c.jpg"]
Expand Down Expand Up @@ -224,17 +224,18 @@ defmodule ExBraceExpansion do
[post_parts_hd | post_parts_tail] = post_parts
p = List.update_at(p, length(p) - 1, fn val -> val <> post_parts_hd end)
p = p ++ post_parts_tail
[] ++ p
else
[] ++ p
end

[] ++ p
end
end

defp numeric(val) do
try do
String.to_integer(val)
rescue
_ -> hd(to_char_list(val))
_ -> hd(to_charlist(val))
end
end

Expand All @@ -256,13 +257,16 @@ defmodule ExBraceExpansion do
if need > 0 do
front_padding = Enum.join(Enum.map(0..(need-1), fn _ -> "0" end), "")
if i < 0 do
c = "-" <> front_padding <> String.slice(c, 1, String.length(c))
"-" <> front_padding <> String.slice(c, 1, String.length(c))
else
c = front_padding <> c
front_padding <> c
end
else
c
end
else
c
end
c
end

end
9 changes: 4 additions & 5 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ defmodule ExBraceExpansion.Mixfile do
[app: :ex_brace_expansion,
version: "0.0.2",
elixir: "~> 1.0",
description: description,
package: package,
deps: deps]
description: description(),
package: package(),
deps: deps()]
end

# Configuration for the OTP application
Expand All @@ -28,8 +28,7 @@ defmodule ExBraceExpansion.Mixfile do
# Type `mix help deps` for more examples and options
defp deps do
[
{:ex_doc, "~> 0.7", only: :dev},
{:markdown, github: "devinus/markdown"}
{:ex_doc, "~> 0.7", only: :dev}
]
end

Expand Down
8 changes: 5 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%{"ex_doc": {:hex, :ex_doc, "0.7.2"},
"hoedown": {:git, "git://github.com/hoedown/hoedown.git", "2a4cf17c70e6572ed42cdca3ea7ca3e768ed17be", []},
"markdown": {:git, "git://github.com/devinus/markdown.git", "cd0df79b6f1cc374499d47f6ba6aaab5096f874f", []}}
%{
"ex_doc": {:hex, :ex_doc, "0.7.2", "c24bd9efdace906c23c943280a3d29c15e649e4c0eeca92f6ee35723f44691a7", [:mix], [], "hexpm", "8bb0b9272b4b427a0f8f915b85a82a3296be8c3a3814891b1c9d090839b5d396"},
"hoedown": {:git, "https://github.com/hoedown/hoedown.git", "980b9c549b4348d50b683ecee6abee470b98acda", []},
"markdown": {:git, "https://github.com/devinus/markdown.git", "d065dbcc4e242a85ca2516fdadd0082712871fd8", []},
}
2 changes: 1 addition & 1 deletion test/ex_brace_expansion/concat_map_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ defmodule ConcatMapTest do
end

test "nils" do
assert concat_map(["a", "b", "c", "d"], fn _ -> end) == [ nil, nil, nil, nil ]
assert concat_map(["a", "b", "c", "d"], fn _ -> nil; end) == [ nil, nil, nil, nil ]
end
end