anchor.diff:      unescape/1,
       strip/1,
   	sanitize/1,
  -	noscript/1
  +	noscript/1,
  +    escape_link/1,
  +    nl2br/1
   ]).
   
   -include_lib("zotonic.hrl").
  
positive.code: 
  
  %% @doc Escape a string so that it is valid within HTML/ XML.
  %% @spec escape(iolist()) -> iolist()
  escape(undefined) -> 
      undefined;
  escape(<<>>) -> 
      <<>>;
  escape([]) ->
      [];
  escape(L) when is_list(L) ->
      escape(list_to_binary(L));
  escape(B) when is_binary(B) ->
  
negative.code: 	nows([$\\|T], Acc) -> nows(T, Acc);
  	nows([C|T], Acc) -> nows(T, [C|Acc]).
  
  
  %% @doc Translate any newlines to html br entities.
  nl2br(B) when is_binary(B) ->
      nl2br_bin(B, <<>>);
  nl2br(L) ->
      nl2br(L, []).
  
      nl2br([], Acc) ->
          lists:reverse(Acc);
      nl2br("\r\n" ++ Rest, Acc) ->
          nl2br(Rest, lists:reverse("<br />", Acc));
      nl2br("\n" ++ Rest, Acc) ->
          nl2br(Rest, lists:reverse("<br />", Acc));
      nl2br([C | Rest], Acc) ->
          nl2br(Rest, [C | Acc]).
  
      nl2br_bin(<<>>, Acc) ->
          Acc;
      nl2br_bin(<<$\r, $\n, Post/binary>>, Acc) ->
          nl2br_bin(Post, <<Acc/binary, "<br />">>);
      nl2br_bin(<<$\r, Post/binary>>, Acc) ->
          nl2br_bin(Post, <<Acc/binary, "<br />">>);
      nl2br_bin(<<$\n, Post/binary>>, Acc) ->
          nl2br_bin(Post, <<Acc/binary, "<br />">>);
      nl2br_bin(<<C, Post/binary>>, Acc) ->
          nl2br_bin(Post, <<Acc/binary, C>>).
          
  