Permalink
Browse files

Merge branch 'master' of github.com:zotonic/zotonic

  • Loading branch information...
2 parents 061cfd3 + b942aae commit c9a7f7f3c594fc462c617a4b24e4e00c14bfaf75 @arjan arjan committed Mar 7, 2012
Showing with 23 additions and 10 deletions.
  1. +0 −5 modules/mod_base/lib/css/zp-base.css
  2. +17 −5 src/erlydtl/erlydtl_runtime.erl
  3. +6 −0 src/erlydtl/erlydtl_scanner.erl
@@ -195,11 +195,6 @@ figure {
.clearfix,
.zp-wrapper {
- display: inline-block;
-}
-
-html[xmlns] .clearfix,
-html[xmlns] .zp-wrapper {
display: block;
}
@@ -195,11 +195,7 @@ cycle(NamesTuple, Counters, Context) when is_tuple(NamesTuple) ->
cache(MaxAge, Name, Args, Func, Context) ->
VisibleFor = z_acl:args_to_visible_for(Args),
- DoCache = case z_convert:to_bool(proplists:get_value(if_anonymous, Args, false)) of
- true -> VisibleFor =:= ?ACL_VIS_PUBLIC orelse z_acl:user(Context) =:= undefined;
- false -> true
- end,
- case DoCache of
+ case do_cache(VisibleFor, Args, Context) of
false ->
Func(Context);
true ->
@@ -213,3 +209,19 @@ cache(MaxAge, Name, Args, Func, Context) ->
end,
z_depcache:memo(F, Key, MaxAge, Varies ++ Cat1, FuncContext)
end.
+
+do_cache(VisibleFor, Args, Context) ->
+ do_cache1(get_bool_value('if', Args, true), VisibleFor, Args, Context).
+
+do_cache1(true, ?ACL_VIS_PUBLIC, _Args, _Context) ->
+ true;
+do_cache1(true, _VisibleFor, Args, Context) ->
+ case get_bool_value(if_anonymous, Args, false) of
+ true -> z_acl:user(Context) =:= undefined;
+ false -> true
+ end;
+do_cache1(false, _VisibleFor, _Args, _Context) ->
+ false.
+
+get_bool_value(Key, Args, Default) ->
+ z_convert:to_bool(proplists:get_value(Key, Args, Default)).
@@ -185,6 +185,12 @@ scan("#}-->" ++ T, Scanned, {SourceRef, Row, Column}, {in_comment, "#}-->"}) ->
scan("#}" ++ T, Scanned, {SourceRef, Row, Column}, {in_comment, "#}"}) ->
scan(T, Scanned, {SourceRef, Row, Column + 2}, in_text);
+scan("\r\n" ++ T, Scanned, {SourceRef, Row, _Column}, {in_comment, Closer}) ->
+ scan(T, Scanned, {SourceRef, Row+1, 1}, {in_comment, Closer});
+
+scan("\n" ++ T, Scanned, {SourceRef, Row, _Column}, {in_comment, Closer}) ->
+ scan(T, Scanned, {SourceRef, Row+1, 1}, {in_comment, Closer});
+
scan([_ | T], Scanned, {SourceRef, Row, Column}, {in_comment, Closer}) ->
scan(T, Scanned, {SourceRef, Row, Column + 1}, {in_comment, Closer});

0 comments on commit c9a7f7f

Please sign in to comment.