From 3c7282501372caa9f8a394f35383518b6106cf3f Mon Sep 17 00:00:00 2001 From: Milton Mazzarri Date: Wed, 30 Aug 2017 12:25:18 -0500 Subject: [PATCH] Make ebert happy --- assets/js/epub.js | 1 - lib/ex_doc/markdown/cmark.ex | 2 +- lib/ex_doc/markdown/earmark.ex | 2 +- lib/ex_doc/retriever.ex | 4 ++-- test/ex_doc/formatter/html_test.exs | 14 +++++++------- test/ex_doc_test.exs | 8 ++++++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/assets/js/epub.js b/assets/js/epub.js index 573eaaaaf..678dc9403 100644 --- a/assets/js/epub.js +++ b/assets/js/epub.js @@ -4,4 +4,3 @@ import hljs from 'highlight.js/build/highlight.pack' hljs.initHighlightingOnLoad() - diff --git a/lib/ex_doc/markdown/cmark.ex b/lib/ex_doc/markdown/cmark.ex index 031810f55..2696cd45e 100644 --- a/lib/ex_doc/markdown/cmark.ex +++ b/lib/ex_doc/markdown/cmark.ex @@ -15,6 +15,6 @@ defmodule ExDoc.Markdown.Cmark do Generate HTML output. Cmark takes no options. """ def to_html(text, _opts) do - Cmark.to_html(text) |> ExDoc.Markdown.pretty_codeblocks + text |> Cmark.to_html() |> ExDoc.Markdown.pretty_codeblocks() end end diff --git a/lib/ex_doc/markdown/earmark.ex b/lib/ex_doc/markdown/earmark.ex index d9eb07458..17862e13d 100644 --- a/lib/ex_doc/markdown/earmark.ex +++ b/lib/ex_doc/markdown/earmark.ex @@ -32,6 +32,6 @@ defmodule ExDoc.Markdown.Earmark do file: Keyword.get(opts, :file), breaks: Keyword.get(opts, :breaks, false), smartypants: Keyword.get(opts, :smartypants, true)) - Earmark.as_html!(text, options) |> ExDoc.Markdown.pretty_codeblocks + text |> Earmark.as_html!(options) |> ExDoc.Markdown.pretty_codeblocks() end end diff --git a/lib/ex_doc/retriever.ex b/lib/ex_doc/retriever.ex index cefd59cad..1383ddf78 100644 --- a/lib/ex_doc/retriever.ex +++ b/lib/ex_doc/retriever.ex @@ -433,8 +433,8 @@ defmodule ExDoc.Retriever do end end - defp anno_line(line) when is_integer(line), do: line |> abs() - defp anno_line(anno), do: :erl_anno.line(anno) |> abs() + defp anno_line(line) when is_integer(line), do: abs(line) + defp anno_line(anno), do: anno |> :erl_anno.line() |> abs() # Detect if a module is an exception, struct, # protocol, implementation or simply a module diff --git a/test/ex_doc/formatter/html_test.exs b/test/ex_doc/formatter/html_test.exs index 585e38913..dfc0c1946 100644 --- a/test/ex_doc/formatter/html_test.exs +++ b/test/ex_doc/formatter/html_test.exs @@ -130,9 +130,9 @@ defmodule ExDoc.Formatter.HTMLTest do assert File.regular?("#{output_dir()}/CompiledWithDocs.html") assert File.regular?("#{output_dir()}/CompiledWithDocs.Nested.html") - assert [_] = "#{output_dir()}/dist/app-*.css" |> Path.wildcard - assert [_] = "#{output_dir()}/dist/app-*.js" |> Path.wildcard - assert [] = "#{output_dir()}/another_dir/dist/app-*.js.map" |> Path.wildcard + assert [_] = Path.wildcard("#{output_dir()}/dist/app-*.css") + assert [_] = Path.wildcard("#{output_dir()}/dist/app-*.js") + assert [] = Path.wildcard("#{output_dir()}/another_dir/dist/app-*.js.map") content = File.read!("#{output_dir()}/index.html") assert content =~ ~r{} @@ -145,9 +145,9 @@ defmodule ExDoc.Formatter.HTMLTest do assert File.regular?("#{output_dir()}/another_dir/CompiledWithDocs.html") assert File.regular?("#{output_dir()}/another_dir/RandomError.html") - assert [_] = "#{output_dir()}/another_dir/dist/app-*.css" |> Path.wildcard - assert [_] = "#{output_dir()}/another_dir/dist/app-*.js" |> Path.wildcard - assert [_] = "#{output_dir()}/another_dir/dist/app-*.js.map" |> Path.wildcard + assert [_] = Path.wildcard("#{output_dir()}/another_dir/dist/app-*.css") + assert [_] = Path.wildcard("#{output_dir()}/another_dir/dist/app-*.js") + assert [_] = Path.wildcard("#{output_dir()}/another_dir/dist/app-*.js.map") content = File.read!("#{output_dir()}/another_dir/index.html") assert content =~ ~r{} @@ -228,7 +228,7 @@ defmodule ExDoc.Formatter.HTMLTest do test "before_closing_*_tags are placed in the right place - generated pages" do config = doc_config([main: "readme"]) generate_docs(config) - + content = File.read!("#{output_dir()}/readme.html") assert content =~ ~r[#{@before_closing_head_tag_content_html}\s*] assert content =~ ~r[#{@before_closing_body_tag_content_html}\s*] diff --git a/test/ex_doc_test.exs b/test/ex_doc_test.exs index 7839d65d2..7610b7247 100644 --- a/test/ex_doc_test.exs +++ b/test/ex_doc_test.exs @@ -18,8 +18,12 @@ defmodule ExDocTest do test "build_config & normalize_options" do project = "Elixir" version = "1" - options = [formatter: IdentityFormatter, retriever: IdentityRetriever, - source_root: "root_dir", source_beam: "beam_dir",] + options = [ + formatter: IdentityFormatter, + retriever: IdentityRetriever, + source_root: "root_dir", + source_beam: "beam_dir", + ] {_, config} = ExDoc.generate_docs project, version, Keyword.merge(options, [output: "test/tmp/ex_doc"]) assert config.output == "test/tmp/ex_doc"