-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move all TODOs and FIXMEs to GitHub issues #124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,11 +35,9 @@ globalThis["arizona"] = (() => { | |
const subscribers = new Map(); | ||
const unsubscribers = new Map(); | ||
|
||
// @todo Subscribe to global events. | ||
function subscribe(eventName, callback, opts = {}) { | ||
let eventSubs = subscribers.get(eventName); | ||
if (!eventSubs) eventSubs = new Map(); | ||
// @todo Improve id. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const id = Math.random(); | ||
eventSubs.set(id, { id, callback, opts }); | ||
subscribers.set(eventName, eventSubs); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ HTML support. | |
%% API funtions. | ||
%% -------------------------------------------------------------------- | ||
|
||
% TODO: Do this really safe for HTML. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
safe(V) when is_binary(V) -> | ||
V; | ||
safe(V) when is_atom(V) -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ send(Event, Payload) -> | |
%% Internal funtions. | ||
%% -------------------------------------------------------------------- | ||
|
||
% TODO: Real safe JS. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
safe(Term) -> | ||
iolist_to_binary(json:encode(Term)). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,6 @@ handle_info({_Pid, {fs, file_event}, {File, Events}}, | |
[modified, closed] -> | ||
{noreply, State#state{files = Files#{File => {erl, modified}}}}; | ||
_ -> | ||
% TODO: Act on created, renamed, deleted. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{noreply, State} | ||
end; | ||
_ -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ compile({Mod, Fun, Args}) when is_atom(Mod), is_atom(Fun) -> | |
directives => #{stateful => true}, | ||
attrs => []}}], [], 0, #state{view = Mod}), | ||
{ok, Block}; | ||
% TODO: Maybe require a module to be the view. | ||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
compile(Tree) -> | ||
[{0, Block}] = compile(Tree, [], 0, #state{}), | ||
{ok, Block}. | ||
|
@@ -74,11 +73,6 @@ compile_tag(#{name := Name} = Tag, Txt, T, P, I, State) -> | |
norm_tag_attrs(#{attrs := Attrs0, directives := Dirs}, Id, Target) -> | ||
maps:fold(fun | ||
(stateful, true, Attrs) -> | ||
% TODO: Rename 'arz-id' to 'arz-sid' (statefull id), | ||
% and provide a 'arz-tid' (tag id) to each tag. | ||
% I think this can improve changes patch, | ||
% because just the most close tag could be rendered | ||
% instead of the entirely block/tree. | ||
Comment on lines
-77
to
-81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
[{<<"arz-id">>, {text, arz_id(Id)}} | Attrs]; | ||
(K, V, Attrs) -> | ||
case atom_to_binary(K, utf8) of | ||
|
@@ -123,8 +117,6 @@ do_compile_tag([K | T], Tag, TT, P, I, State, Acc) -> | |
do_compile_tag(T, Tag, TT, P, I, State, [K, $\s | Acc]); | ||
% IMPORTANT: Text concat must be reviewed when :if and :for be implemented. | ||
% Cannot concat when this kind of directive is defined. | ||
% TODO: There are more optimizations to do by concatenating tags. | ||
% Nested blocks of blocks are not concatenated. | ||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
do_compile_tag([], Tag, TT, P, I, State, Acc) -> | ||
case maps:get(void, Tag, false) of | ||
true -> | ||
|
@@ -245,7 +237,6 @@ block_struct(Block, P, I, State) -> | |
{Mod, Fun} = block_mod_fun(Block, State), | ||
Tree = apply(Mod, Fun, [maps:get(args, Block, #{})]), | ||
Attrs = block_attrs(Block), | ||
% TODO: Check this directives merge implementation. | ||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Directives = maps:get(directives, Block), | ||
AllDirectives = case find_first_tag(Tree) of | ||
{ok, Tag} -> | ||
|
@@ -257,8 +248,6 @@ block_struct(Block, P, I, State) -> | |
AllAttrs = maps:merge(Attrs, maps:without(NonAttrs, Directives)), | ||
Id = id(P, I), | ||
Stateful = maps:get(stateful, Directives, false), | ||
% TODO: Remove vars prop from expr tokens. | ||
% They will live in the block props. | ||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Tokens = case Stateful of | ||
true -> | ||
compile(Tree, [I | P], 0, | ||
|
@@ -285,7 +274,6 @@ block_struct(Block, P, I, State) -> | |
vars => vars_group(vars(ExprVars, Id)) | ||
}. | ||
|
||
% TODO: Change to binary_to_existing_atom. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
block_mod_fun(#{name := Name}, State) -> | ||
case binary:split(Name, <<":">>) of | ||
[M, F] -> | ||
|
@@ -311,7 +299,6 @@ find_first_tag(_) -> | |
is_tag(Name) -> | ||
not lists:member(Name, [<<"!DOCTYPE">>, <<"!doctype">>, <<"?xml">>]). | ||
|
||
% TODO: Use binary_to_existing_atom. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
block_attrs(#{attrs := Attrs}) -> | ||
#{binary_to_atom(K, utf8) => V || {K, V} <- Attrs}. | ||
|
||
|
@@ -575,10 +562,6 @@ counter(Macros) -> | |
{% and adds this to the blocks param in the state. } | ||
<div id={_@id} :stateful> | ||
<span> | ||
{% TODO: Find a better way to define default values } | ||
{% in a pure Erlang implementation. } | ||
{% Using try/catch by now for this. } | ||
{% Should find a way to define a maps:get/3. } | ||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{try _@label catch _:_ -> <<"Count:">> end} | ||
|
||
{% NOTE: _@counter_count not wrapper by try/catch, } | ||
|
@@ -597,9 +580,6 @@ counter(Macros) -> | |
{% It's filled with tokens when is not a void tag } | ||
{% and the content between `>...</`, for example } | ||
{% > <div>mycontent</div> } | ||
{% FIXME: This implementation wont work, because it } | ||
{% needs to be compiled in tokens. } | ||
{% The 'merl:tsubst' should be used to fix this. } | ||
Comment on lines
-600
to
-602
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{% {try _@content catch _:_ -> <<>> end} } | ||
</div> | ||
"""), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,6 @@ do_parse_tag([tag_close | T0], Props0, Macros) -> | |
true -> | ||
Props = case OpenName =:= <<"head">> of | ||
true -> | ||
% TODO: Do not reverse. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #123 / 1 |
||
lists:reverse(inject_js_scripts(lists:reverse(Props1))); | ||
false -> | ||
Props1 | ||
|
@@ -163,12 +162,10 @@ parse_attr(K, {expr, ExprStr}, Macros) -> | |
parse_attr(K, {text, Text}, _Macros) -> | ||
do_parse_attr(K, {text, Text}). | ||
|
||
% TODO: Directive keys to atom using binary_to_existing_atom. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
do_parse_attr(<<$:, K/binary>>, {text, <<$:, K/binary>>}) -> | ||
{directive, {binary_to_atom(K, utf8), true}}; | ||
do_parse_attr(<<$:, K/binary>>, V) -> | ||
{directive, {binary_to_atom(K, utf8), V}}; | ||
% TODO: Comments support. | ||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||
do_parse_attr(<<$%, _K/binary>>, _V) -> | ||
error(not_supported_yet); | ||
do_parse_attr(K, V) -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,24 +30,7 @@ Template scanner. | |
%% API funtions. | ||
%% -------------------------------------------------------------------- | ||
|
||
% TODO: Implement the :case directive: | ||
% """ | ||
% {% The directive should be a valid Erlang syntax, like: } | ||
% {:case _@foo of | ||
% foo -> | ||
% """ | ||
% {% Expressions will be compiled into a tree... } | ||
% <div>foo</div> | ||
% """; | ||
% Bar -> | ||
% """ | ||
% {% and should be able to eval variables. } | ||
% <div>{Bar}</div> | ||
% """ | ||
% end} | ||
% """. | ||
Comment on lines
-33
to
-48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
string(Str) when is_binary(Str) -> | ||
% TODO: Location. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #123 / 2 |
||
{ok, scan(Str, Str, 0, 0), 1}; | ||
string(Str) when is_list(Str) -> | ||
string(iolist_to_binary(Str)). | ||
|
@@ -120,8 +103,6 @@ scan_tag_name(<<$>, Rest/binary>>, Str, Pos, Len) -> | |
scan_tag_name(<<C, Rest/binary>>, Str, Pos, Len) | ||
when C =:= $\s; C =:= $\r; C =:= $\n -> | ||
Name = binary_part(Str, Pos, Len), | ||
% FIXME: If closing_tag we should go to 'scan' | ||
% instead of 'scan_attr_key'. | ||
Comment on lines
-123
to
-124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
[{tag_name, Name} | scan_attr_key(Rest, Str, Pos + Len + 1, 0)]; | ||
scan_tag_name(<<_, Rest/binary>>, Str, Pos, Len) -> | ||
scan_tag_name(Rest, Str, Pos, Len + 1). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,6 @@ websocket_handle({text, Msg}, #{sockets := Sockets} = State) -> | |
{Target, Event, Payload} = decode_msg(Msg), | ||
Socket0 = maps:get(Target, Sockets), | ||
View = maps:get(view, Socket0), | ||
% TODO: {reply, Msg, Socket} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{noreply, Socket1} = arizona_live_view:handle_event(View, Event, Payload, Socket0), | ||
Socket = case maps:get(changes, Socket1) of | ||
Changes when map_size(Changes) > 0 -> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#110