Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Close <li> tags in linebreaks.

Thanks to Drew Gulino
  • Loading branch information...
commit 1facccc27e94147db314a84da3e7a868dd505397 1 parent 8a89e64
@evanmiller evanmiller authored
Showing with 5 additions and 1 deletion.
  1. +4 −0 src/erlydtl_filters.erl
  2. +1 −1  tests/src/erlydtl_unittests.erl
View
4 src/erlydtl_filters.erl
@@ -759,6 +759,10 @@ unordered_list([], Acc) ->
["<ul>", lists:reverse(Acc), "</ul>"];
unordered_list([First|_] = List, []) when is_integer(First) ->
"<li>"++List;
+unordered_list([First|Rest], Acc) when is_list(First), Rest == [] ->
+ unordered_list(Rest, ["</li>"] ++ [unordered_list(First, []) | Acc ]) ;
+unordered_list([First|Rest], Acc) when is_list(First), is_integer(hd(hd(Rest))) ->
+ unordered_list(Rest, [unordered_list(First, []) ++ "</li>" |Acc]);
unordered_list([First|Rest], Acc) when is_list(First) ->
unordered_list(Rest, [unordered_list(First, [])|Acc]).
View
2  tests/src/erlydtl_unittests.erl
@@ -780,7 +780,7 @@ tests() ->
<<"<p>The <strong>Long and <em>Winding</em>...</strong></p>">>},
{"|unordered_list",
<<"{{ var1|unordered_list }}">>, [{var1, ["States", ["Kansas", ["Lawrence", "Topeka"], "Illinois"]]}],
- <<"<li>States<ul><li>Kansas<ul><li>Lawrence<li>Topeka</ul><li>Illinois</ul>">>},
+ <<"<li>States<ul><li>Kansas<ul><li>Lawrence</li><li>Topeka</li></ul></li><li>Illinois</li></ul></li>">>},
{"|upper",
<<"{{ message|upper }}">>, [{message, "That man has a gun."}],
<<"THAT MAN HAS A GUN.">>},
Please sign in to comment.
Something went wrong with that request. Please try again.