Skip to content

Commit

Permalink
Merge pull request #25 from inaka/ferigis.23.remove_elixir
Browse files Browse the repository at this point in the history
[#23] remove elixir dependencies
  • Loading branch information
Brujo Benavides authored Apr 12, 2017
2 parents 27d7603 + 2c52b7a commit fa05808
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 76 deletions.
20 changes: 2 additions & 18 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
%% == Dependencies ==

{deps, [
{earmark, {elixir, "earmark" ,"1.2.0"}},
{worker_pool, "2.2.3"}
{worker_pool, "2.2.3"},
{emarkdown, "0.1.0"}
]}.

%% == Profiles ==
Expand Down Expand Up @@ -88,20 +88,4 @@
{base_plt_prefix, "sheldon"}
]}.

%% == Plugins ==
{plugins, [
{ rebar3_elixir_compile, ".*", {git, "https://github.com/barrel-db/rebar3_elixir_compile.git", {ref, "1c6c516"}}}
]}.

{provider_hooks, [
{pre, [{compile, {ex, compile}}]},
{pre, [{release, {ex, compile}}]}
]}.

{elixir_opts,
[
{env, dev}
]
}.

{erl_first_files, ["src/adapter/sheldon_adapter.erl"]}.
6 changes: 2 additions & 4 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{"1.1.0",
[{<<"bunt">>,{elixir,"bunt","0.2.0"},2},
{<<"credo">>,{elixir,"credo","0.7.2"},1},
{<<"dialyxir">>,{elixir,"dialyxir","0.5.0"},1},
{<<"earmark">>,{elixir,"earmark","1.2.0"},0},
[{<<"emarkdown">>,{pkg,<<"emarkdown">>,<<"0.1.0">>},0},
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"2.2.3">>},0}]}.
[
{pkg_hash,[
{<<"emarkdown">>, <<"F1310FB8EE1A488CB2E16AA4E13CB34A7B68B310222CC47BB817B52242D7337C">>},
{<<"worker_pool">>, <<"2CD7B2C289B900940297D283922D7E119C540CB8F29B5254639ABB9BFB100CAE">>}]}
].
28 changes: 1 addition & 27 deletions src/adapter/markdown_adapter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,5 @@

-spec adapt(binary()) -> iodata().
adapt(Line) ->
{ok, Line1, _} = 'Elixir.Earmark':as_html(Line, options()),
Line1 = emarkdown:to_html(Line),
html_adapter:adapt(Line1).

%%%===================================================================
%%% Internal Funcions
%%%===================================================================

-spec options() -> map().
options() ->
#{ renderer => 'Elixir.Earmark.HtmlRenderer'
, gfm => true
, breaks => false
, pedantic => false
, smartypants => false
, sanitize => false
, footnotes => false
, footnote_offset => 1
, code_class_prefix => 'nil'
, do_smartypants => 'nil'
, do_sanitize => 'nil'
, mapper => fun 'Elixir.Earmark':'pmap'/2
, render_code => fun 'Elixir.Earmark.HtmlRenderer':'render_code'/1
, file => <<"<no file>">>
, line => 1
, messages => []
, plugins => #{}
, '__struct__' => 'Elixir.Earmark.Options'
}.
3 changes: 1 addition & 2 deletions src/sheldon.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
{applications, [
kernel,
stdlib,
elixir,
earmark,
emarkdown,
worker_pool
]},
{modules, []},
Expand Down
10 changes: 5 additions & 5 deletions test/files/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ And you can check all of our open-source projects at [inaka.github.io](http://in
And you can check all of our open-source projects at [inaka.github.io](http://inaka.github.io)

this is a test with start_block blocks
this is a test with start-block blocks
this line shouldn't appear
neither end_block continue here
neither end-block continue here
new one

this is a huge line with *another block* start_block1 this part of the text should be
removed end_block1 here we can continue and start_block1 this is out end_block1 continue here and start_block again
and finish end_block here
this is a huge line with *another block* start-block1 this part of the text should be
removed end-block1 here we can continue and start-block1 this is out end-block1 continue here and start-block again
and finish end-block here

let's test with 'hello' > < & ;

Expand Down
40 changes: 20 additions & 20 deletions test/sheldon_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,16 @@ markdown_adapter(_Config) ->
, #{ line_number := 16, word := "####" }
, #{ line_number := 18, word := "API" }
, #{ line_number := 20, word := "open-source" }
, #{ line_number := 22, word := "start_block" }
, #{ line_number := 24, word := "end_block" }
, #{ line_number := 22, word := "start-block" }
, #{ line_number := 24, word := "end-block" }
, #{ line_number := 27, word := "*another" }
, #{ line_number := 27, word := "block*" }
, #{ line_number := 27, word := "start_block1" }
, #{ line_number := 28, word := "end_block1" }
, #{ line_number := 28, word := "start_block1" }
, #{ line_number := 28, word := "end_block1" }
, #{ line_number := 28, word := "start_block" }
, #{ line_number := 29, word := "end_block" }
, #{ line_number := 27, word := "start-block1" }
, #{ line_number := 28, word := "end-block1" }
, #{ line_number := 28, word := "start-block1" }
, #{ line_number := 28, word := "end-block1" }
, #{ line_number := 28, word := "start-block" }
, #{ line_number := 29, word := "end-block" }
, #{ line_number := 33, word := "##" }
]
} = sheldon:check(MarkownFile, #{ignore_patterns => ["http://"]}),
Expand All @@ -289,14 +289,14 @@ markdown_adapter(_Config) ->
, #{ line_number := 18, word := "API" }
, #{ line_number := 20, word := "open-source" }
, #{ line_number := 20, word := "inaka.github.io" }
, #{ line_number := 22, word := "start_block" }
, #{ line_number := 24, word := "end_block" }
, #{ line_number := 27, word := "start_block1" }
, #{ line_number := 28, word := "end_block1" }
, #{ line_number := 28, word := "start_block1" }
, #{ line_number := 28, word := "end_block1" }
, #{ line_number := 28, word := "start_block" }
, #{ line_number := 29, word := "end_block" }
, #{ line_number := 22, word := "start-block" }
, #{ line_number := 24, word := "end-block" }
, #{ line_number := 27, word := "start-block1" }
, #{ line_number := 28, word := "end-block1" }
, #{ line_number := 28, word := "start-block1" }
, #{ line_number := 28, word := "end-block1" }
, #{ line_number := 28, word := "start-block" }
, #{ line_number := 29, word := "end-block" }
]
} = sheldon:check(MarkownFile, #{ adapters => [markdown_adapter] }),

Expand All @@ -316,16 +316,16 @@ markdown_adapter(_Config) ->
]
} = sheldon:check(MarkownFile, #{ adapters => [markdown_adapter]
, ignore_blocks =>
[ #{ open => "^start_block$", close => "^end_block$" }
, #{ open => "^start_block1$", close => "^end_block1$" }
[ #{ open => "^start-block$", close => "^end-block$" }
, #{ open => "^start-block1$", close => "^end-block1$" }
]
}),

ok = sheldon:check( MarkownFile
, #{ adapters => [markdown_adapter]
, ignore_blocks =>
[ #{ open => "^start_block$", close => "^end_block$" }
, #{ open => "^start_block1$", close => "^end_block1$" }
[ #{ open => "^start-block$", close => "^end-block$" }
, #{ open => "^start-block1$", close => "^end-block1$" }
]
, ignore_words =>
[ "api"
Expand Down

0 comments on commit fa05808

Please sign in to comment.