From 0142b635fd0b591d044cfd61638e3a672198589a Mon Sep 17 00:00:00 2001 From: Kevin Montuori Date: Sat, 5 Sep 2015 10:53:23 -0400 Subject: [PATCH] added href_target application option and test --- src/markdown.erl | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/markdown.erl b/src/markdown.erl index a70df53..3a172dd 100644 --- a/src/markdown.erl +++ b/src/markdown.erl @@ -1079,7 +1079,7 @@ m_str1([{{inline, open}, O} | T], R, A) -> [] -> []; _ -> " title=\"" ++ Title ++ "\"" end, - Tag = [{tags, ""}, Acc, {tags, ""} | []], m_str1(Rest, R, [Tag | A]); @@ -1090,7 +1090,7 @@ m_str1([{email, Addie} | T], R, A) -> m_str1(T, R, [{tags, "\" />"}, Addie, {tags, " m_str1(T, R, [ {tags, ""}, Url, {tags, "\">"}, Url, - {tags, " m_str1(T, R, [Tag | A]); m_str1([{{{tag, Type}, Tag}, _} | T], R, A) -> @@ -1282,6 +1282,14 @@ make_img_tag(Url, Acc, Title) -> ++ " title=\"" ++ Title ++ "\"" ++ " />"}. +make_href_open_tag() -> + case application:get_env(markdown, href_target, undefined) of + undefined -> " " %%%------------------------------------------------------------------- -include("markdown_tests.hrl"). +href_no_target_test() -> + MDText = "[quux](http://example.com)", + ?assertEqual("

quux

", + conv(MDText)). + +href_target_test() -> + application:set_env(markdown, href_target, "_r"), + MDText = "[quux](http://example.com)", + ?assertEqual("

quux

", + conv(MDText)). +