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

Fix as_html spec and add spec for _as_html #164

Merged
merged 1 commit into from
Nov 26, 2017
Merged
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
7 changes: 4 additions & 3 deletions lib/earmark.ex
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ defmodule Earmark do
Earmark.as_html(original, %Options{smartypants: false})

"""
@spec as_html(String.t | list(String.t), %Options{}) :: {String.t, list(String.t)}
@spec as_html(String.t | list(String.t), %Options{}) :: {:ok, String.t, list()} | {:error, String.t, list(String.t)}
def as_html(lines, options \\ %Options{}) do
{context, html} = _as_html(lines, options)
case sort_messages(context) do
Expand All @@ -313,10 +313,11 @@ defmodule Earmark do
html
end

@spec _as_html(String.t | list(String.t), %Options{}) :: {%Context{}, String.t}
defp _as_html(lines, options) do
{blocks, context} = parse(lines, options)
case blocks do
[] -> {context, ""}
case blocks do
[] -> {context, ""}
_ -> options.renderer.render(blocks, context)
end
end
Expand Down