Skip to content
Browse files

major trailing whitespace cleanup

Remove trailing whitespace in all .erl and .hrl files in the
repository.

If you're an emacs user, you can easily see trailing whitespace using
settings like these in your ~/.emacs file:

(setq-default show-trailing-whitespace t)
(set-face-background 'trailing-whitespace "slate gray")

You can also delete trailing whitespace automatically when you save
your Erlang sources by setting the emacs before-save-hook in your
~/.emacs file like this:

(add-hook 'before-save-hook
          '(lambda () (if (eq major-mode 'erlang-mode)
                          (delete-trailing-whitespace))))
  • Loading branch information...
1 parent f74f67a commit 455578a251c267401c31c665be33aa5426910b95 @vinoski vinoski committed Apr 19, 2011
Showing with 1,304 additions and 1,304 deletions.
  1. +7 −7 applications/chat/src/chat.erl
  2. +4 −4 applications/mail/src/attachment.erl
  3. +2 −2 applications/mail/src/defs.hrl
  4. +44 −44 applications/mail/src/mail.erl
  5. +3 −3 applications/mail/src/mail_html.erl
  6. +6 −6 applications/mail/src/smtp.erl
  7. +1 −1 applications/wiki/src/utils.erl
  8. +100 −100 applications/wiki/src/wiki.erl
  9. +2 −2 applications/wiki/src/wiki_diff.erl
  10. +12 −12 applications/wiki/src/wiki_format_txt.erl
  11. +3 −3 applications/wiki/src/wiki_plugin_backlinks.erl
  12. +3 −3 applications/wiki/src/wiki_plugin_menu.erl
  13. +7 −7 applications/wiki/src/wiki_split.erl
  14. +39 −39 applications/wiki/src/wiki_templates.erl
  15. +6 −6 applications/wiki/src/wiki_to_html.erl
  16. +8 −8 applications/wiki/src/wiki_utils.erl
  17. +2 −2 applications/wiki/src/wiki_yaws.erl
  18. +44 −44 applications/yapp/src/yapp.erl
  19. +4 −4 applications/yapp/src/yapp_app.erl
  20. +13 −13 applications/yapp/src/yapp_event_handler.erl
  21. +9 −9 applications/yapp/src/yapp_handler.erl
  22. +11 −11 applications/yapp/src/yapp_mnesia_server.erl
  23. +5 −5 applications/yapp/src/yapp_registry.erl
  24. +5 −5 applications/yapp/src/yapp_server.erl
  25. +4 −4 applications/yapp/src/yapp_sup.erl
  26. +45 −45 include/yaws.hrl
  27. +13 −13 include/yaws_api.hrl
  28. +33 −33 src/authmod_gssapi.erl
  29. +11 −11 src/benchmarks/all.erl
  30. +89 −89 src/benchmarks/bench.erl
  31. +3 −3 src/benchmarks/bench.hrl
  32. +3 −3 src/benchmarks/conc_path_bm.erl
  33. +3 −3 src/contrib/yaws_mnesia_session.erl
  34. +15 −15 src/haxe.erl
  35. +15 −15 src/json.erl
  36. +35 −35 src/jsonrpc.erl
  37. +7 −7 src/mime_type_c.erl
  38. +110 −110 src/yaws.erl
  39. +1 −1 src/yaws_app.erl
  40. +1 −1 src/yaws_appmod_cgi.erl
  41. +29 −29 src/yaws_compile.erl
  42. +68 −68 src/yaws_config.erl
  43. +10 −10 src/yaws_content_negotiation.erl
  44. +16 −16 src/yaws_ctl.erl
  45. +11 −11 src/yaws_dav.erl
  46. +14 −14 src/yaws_debug.erl
  47. +4 −4 src/yaws_debug.hrl
  48. +5 −5 src/yaws_html.erl
  49. +25 −25 src/yaws_jsonrpc.erl
  50. +25 −25 src/yaws_log.erl
  51. +1 −1 src/yaws_log_file_h.erl
  52. +27 −27 src/yaws_ls.erl
  53. +5 −5 src/yaws_outmod.erl
  54. +12 −12 src/yaws_pam.erl
  55. +19 −19 src/yaws_revproxy.erl
  56. +45 −45 src/yaws_rpc.erl
  57. +36 −36 src/yaws_rss.erl
  58. +9 −9 src/yaws_server.erl
  59. +7 −7 src/yaws_session_server.erl
  60. +17 −17 src/yaws_showarg.erl
  61. +83 −83 src/yaws_soap_lib.erl
  62. +15 −15 src/yaws_soap_srv.erl
  63. +1 −1 src/yaws_stats.erl
  64. +5 −5 src/yaws_sup.erl
  65. +2 −2 src/yaws_sup_restarts.erl
  66. +8 −8 src/yaws_vdir.erl
  67. +3 −3 src/yaws_websockets.erl
  68. +16 −16 src/yaws_xmlrpc.erl
  69. +5 −5 src/yaws_zlib.erl
  70. +10 −10 src/ymnesia.erl
  71. +5 −5 test/eunit/yaws_session_server_test.erl
  72. +8 −8 test/src/httpc.erl
  73. +3 −3 test/src/test.erl
  74. +1 −1 www/code/myappmod.erl
  75. +26 −26 www/shoppingcart/shopcart.erl
View
14 applications/chat/src/chat.erl
@@ -1,8 +1,8 @@
-% -*- Erlang -*-
+% -*- Erlang -*-
% File: chat.erl (chat.erl)
% Author: Johan Bevemyr
% Created: Thu Nov 18 21:27:41 2004
-% Purpose:
+% Purpose:
-module('chat').
-author('jb@son.bevemyr.com').
@@ -34,7 +34,7 @@
color,
cookie}).
-
+
login(User, Password) ->
session_server(),
erlang:send(chat_server, {new_session, User, self()}),
@@ -187,7 +187,7 @@ chat_server(Users0) ->
5000 ->
chat_server(Users)
end.
-
+
%%
@@ -226,7 +226,7 @@ send_to_all(Type, Msg, Users) ->
if U#user.pid /= undefined ->
%% io:format("Sending ~p to ~p\n", [Msg, U#user.user]),
U#user.pid ! {msgs, [{Type, Msg}]},
- U#user{pid=undefined, last_read = Now};
+ U#user{pid=undefined, last_read = Now};
true ->
U#user{buffer=[{Type,Msg}|U#user.buffer]}
end
@@ -241,7 +241,7 @@ send_to_one(Type, Msg, Users, User) ->
if U#user.pid /= undefined ->
%% io:format("Sending ~p to ~p\n", [Msg, U#user.user]),
U#user.pid ! {msgs, [{Type, Msg}]},
- U#user{pid=undefined, last_read = Now};
+ U#user{pid=undefined, last_read = Now};
true ->
U#user{buffer=[{Type,Msg}|U#user.buffer]}
end;
@@ -359,7 +359,7 @@ fmt_msg(User, Msg, Color) ->
%%
-fmt_members(Users) ->
+fmt_members(Users) ->
[[U#user.user,"<br>"] || U <- Users].
%%
View
8 applications/mail/src/attachment.erl
@@ -1,7 +1,7 @@
%%%-------------------------------------------------------------------
%%% File : attachment.erl
%%% Author : <klacke@hyber.org>
-%%% Description :
+%%% Description :
%%%
%%% Created : 4 Feb 2004 by <klacke@hyber.org>
%%%-------------------------------------------------------------------
@@ -28,8 +28,8 @@ err() ->
[{status, 404},
{header, {connection, "close"}}].
-
-
-
+
+
+
View
4 applications/mail/src/defs.hrl
@@ -1,8 +1,8 @@
-% -*- Erlang -*-
+% -*- Erlang -*-
% File: defs.hrl (/mnt/disk2/jb/work/yaws/yaws/applications/mail/src/defs.hrl)
% Author: Johan Bevemyr
% Created: Wed Oct 29 23:39:30 2003
-% Purpose:
+% Purpose:
-ifndef(DEFS_HRL).
-define(DEFS_HRL, true).
View
88 applications/mail/src/mail.erl
@@ -1,20 +1,20 @@
-% -*- Erlang -*-
+% -*- Erlang -*-
% File: mail.erl (~jb/mail.erl)
% Author: Johan Bevemyr
% Created: Sat Oct 25 10:59:24 2003
-% Purpose:
+% Purpose:
% RFC 822
% RFC 1939
-% RFC 2048
+% RFC 2048
-module('mail').
-author('jb@trut.bluetail.com').
-export([parse_headers/1, list/2, list/3, ploop/5,pop_request/4, diff/2,
- session_manager_init/0, check_cookie/1, check_session/1,
+ session_manager_init/0, check_cookie/1, check_session/1,
login/2, display_login/2, stat/3, showmail/2, compose/1, compose/7,
- send/6, send/2, get_val/3, logout/1, base64_2_str/1, retr/4,
+ send/6, send/2, get_val/3, logout/1, base64_2_str/1, retr/4,
delete/2, send_attachment/2, send_attachment_plain/2,
wrap_text/2, getopt/3, decode/1]).
@@ -111,7 +111,7 @@ build_toolbar([{[],Url,Cmd}|Rest], Used) ->
[{td, [nowrap,{width,"2%"},{valign,middle},{align,left}],
[{a, [{class,nolink}, {href,Url}],
{font, [{size,2},{color,"#000000"},{title,Cmd}],Cmd}}]} |
- build_toolbar(Rest, Used+3)];
+ build_toolbar(Rest, Used+3)];
build_toolbar([{Gif,Url,Cmd}|Rest], Used) ->
(if Used == -1 ->
[];
@@ -243,13 +243,13 @@ sendChunk([{head, {"message", _Opts}}|Rest], S) ->
S2 = S#send{port=Port},
MailDomain = maildomain(),
Session = S#send.session,
- CommonHeaders =
+ CommonHeaders =
[mail_header("To: ", S#send.to),
mail_header("From: ", Session#session.user++"@"++MailDomain),
mail_header("Cc: ", S#send.cc),
mail_header("Bcc: ", S#send.bcc),
mail_header("Subject: ", S#send.subject)],
- {Headers,S3} =
+ {Headers,S3} =
case S#send.attached of
"no" ->
{CommonHeaders ++
@@ -523,7 +523,7 @@ file_attachement(N) ->
{input, [{type,"file"},{name,"file"++I},{size,"30"}],[]}}
]
}.
-
+
build_tabs(Tabs) ->
[{script,[{type,"text/javascript"}],
@@ -573,7 +573,7 @@ showmail(Session, MailNr, Count) ->
MailStr = integer_to_list(MailNr),
tick_session(Session#session.cookie),
- Formated =
+ Formated =
case retr(popserver(), Session#session.user,
Session#session.passwd, MailNr) of
{error, Reason} ->
@@ -656,7 +656,7 @@ list_msg(Session, Refresh, Sort, Count) ->
"function setCmd(val) { \n"
" if (val == 'delete') {\n"
" var res = confirm('Are you sure you want"
- " to delete the selected emails?');\n"
+ " to delete the selected emails?');\n"
" if (!res) { \n"
" return;\n"
" }\n"
@@ -825,7 +825,7 @@ format_from(From0) ->
string:strip(From);
N ->
NewF=string:strip(unquote(decode(string:substr(From,1,N-1)))),
- if
+ if
NewF == [] -> From;
true -> NewF
end
@@ -1173,7 +1173,7 @@ add_att(Fname, Ctype, Data, Atts) ->
ctype = Ctype,
data = Data} | Atts]
end.
-
+
session_manager_gc(C, Cfg) ->
lists:zf(fun(Entry={Cookie,Session,Time}) ->
@@ -1184,9 +1184,9 @@ session_manager_gc(C, Cfg) ->
true ->
{true, Entry}
end
- end, C).
+ end, C).
-sm_reply(ttl, From, Cfg) ->
+sm_reply(ttl, From, Cfg) ->
From ! {session_manager, Cfg#cfg.ttl};
sm_reply(popserver, From, Cfg) ->
From ! {session_manager, Cfg#cfg.popserver};
@@ -1214,8 +1214,8 @@ maildomain() -> req(maildomain).
sendtimeout() -> req(sendtimeout).
-
-
+
+
diff({M1,S1,_}, {M2,S2,_}) ->
(M2-M1)*1000000+(S2-S1).
@@ -1331,7 +1331,7 @@ parse_headers([Line|Lines], Headers) ->
Headers;
N ->
Key = lowercase(string:strip(string:sub_string(Line, 1, N-1))),
- Value =
+ Value =
if length(Line) > N+1 ->
string:strip(string:sub_string(Line, N+2));
true ->
@@ -1384,7 +1384,7 @@ add_header("cc", Value, H) ->
H#mail{cc = Value};
add_header("bcc", Value, H) ->
H#mail{bcc = Value};
-add_header("subject", Value, H) ->
+add_header("subject", Value, H) ->
SubjectFmt = lists:flatten(decode(Value)),
H#mail{subject = Value,
subject_fmt = SubjectFmt,
@@ -1410,7 +1410,7 @@ pop_request(Command, Server, User, Password) ->
%%
%% first authenticate then run a bunch of commands
-%%
+%%
ploop(Command, Server, User, Password, From) ->
case gen_tcp:connect(Server, 110, [{active, false},
@@ -1624,7 +1624,7 @@ receive_data(State=#pstate{port=Port,acc=[],more=true,remain=Remain}) ->
more=true},
{more, State2};
{ok, DotState, Lines, NAcc} ->
-
+
State2 = State#pstate{acc=NAcc,
dotstate=DotState,
lines=[Lines|State#pstate.lines],
@@ -1687,7 +1687,7 @@ split_at(L,N) ->
split_at(L,0,Acc) ->
{lists:reverse(Acc),L};
-split_at([C|Cs], N, Acc) ->
+split_at([C|Cs], N, Acc) ->
split_at(Cs, N-1, [C|Acc]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1741,7 +1741,7 @@ dot_escape([$.|Rest], true, Acc) ->
dot_escape(Rest, false, [$.,$.|Acc]);
dot_escape([$\n|Rest], _, Acc) ->
dot_escape(Rest, true, [$\n|Acc]);
-dot_escape([C|Rest], _, Acc) ->
+dot_escape([C|Rest], _, Acc) ->
dot_escape(Rest, false, [C|Acc]).
%%
@@ -1824,7 +1824,7 @@ smtp_expect(Code, Port, Acc, ErrorMsg) ->
smtp_expect(Code, Port, NAcc, ErrorMsg);
N ->
ResponseCode = to_int(NAcc),
- if
+ if
ResponseCode == Code -> ok;
true -> throw({error, ErrorMsg})
end
@@ -1920,9 +1920,9 @@ b642str([H|T], Acc, N, Out) ->
case d(H) of
no ->
b642str(T, Acc, N, Out);
- I ->
+ I ->
Acc1 = (Acc bsl 6) bor I,
- case N of
+ case N of
3 ->
B1 = Acc1 bsr 16,
B2 = (Acc1 band 16#ffff) bsr 8,
@@ -2007,7 +2007,7 @@ int_to_mt(10) -> "Oct";
int_to_mt(11) -> "Nov";
int_to_mt(12) -> "Dec".
-validate_date_and_time([Y1,Y2, Mo, D, H, M, S | Diff])
+validate_date_and_time([Y1,Y2, Mo, D, H, M, S | Diff])
when 0 =< Y1, 0 =< Y2, 0 < Mo, Mo < 13, 0 < D, D < 32, 0 =< H,
H < 24, 0 =< M, M < 60, 0 =< S, S < 61 ->
case check_diff(Diff) of
@@ -2047,7 +2047,7 @@ format_message(Session, Message, MailNr, Depth) ->
Subject = lists:flatten(decode(H#mail.subject)),
CC = lists:flatten(decode(H#mail.cc)),
ToolBar =
- if
+ if
MailNr == -1 ->
[{"tool-newmail.gif", "javascript:setCmd('reply');", "Reply"}];
MailNr == attachment ->
@@ -2180,7 +2180,7 @@ select_alt_body([Prefered|Rest], Bodies) ->
[First|_] ->
First
end.
-
+
has_body_type(Type, {H,B}) ->
case H#mail.content_type of
{CT, _Ops} ->
@@ -2243,7 +2243,7 @@ format_body(Session, H, Msg, Depth) ->
Cookie = Session#session.cookie,
mail_session_manager ! {session_set_attach_data,
self(), Cookie, FileName, ContT, B},
-
+
receive
{session_manager, Num} ->
[{table,[{bgcolor, "lightgrey"}],
@@ -2422,14 +2422,14 @@ decode_message("base64"++_, Msg) ->
end;
decode_message("quoted-printable"++_, Msg) ->
case catch quoted_2_str(lists:flatten(Msg)) of
- {'EXIT', Reason} ->
+ {'EXIT', Reason} ->
io:format("failed to decode quoted-printable ~p\n", [Reason]),
Msg;
Decoded -> Decoded
end;
decode_message(_, Msg) -> Msg.
-
-
+
+
quoted_2_str(Msg) ->
quoted_2_str(Msg, []).
@@ -2555,7 +2555,7 @@ char_class($\r) -> nl;
char_class($ ) -> space;
char_class($\t) -> tab;
char_class(O) -> text.
-
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
sleep(X) ->
@@ -2565,7 +2565,7 @@ sleep(X) ->
X -> ok
end.
-
+
%%%%%%%%%%%%%%%%%%%%%% read cfg file %%%%%%%%%%%%%%%%%%
%% def for root is: /etc/mail/yaws-webmail.conf
@@ -2617,7 +2617,7 @@ read_config(FD, Cfg, Lno, Chars) ->
end;
["popserver", '=', Server] ->
read_config(FD, Cfg#cfg{popserver = Server}, Lno+1, Next);
-
+
["smtpserver", '=', Domain] ->
read_config(FD, Cfg#cfg{smtpserver = Domain}, Lno+1, Next);
["maildomain", '=', Domain] ->
@@ -2636,15 +2636,15 @@ read_config(FD, Cfg, Lno, Chars) ->
"line ~w", [H, Lno]),
read_config(FD, Cfg, Lno+1, Next)
end.
-
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-record(date, {year, month, day, hours, minutes, seconds}).
parse_date([]) -> [];
parse_date(Date) ->
D = parse_date(Date, #date{}),
- if
+ if
integer(D#date.year),integer(D#date.month),
integer(D#date.day),integer(D#date.hours),
integer(D#date.minutes),integer(D#date.seconds) ->
@@ -2690,7 +2690,7 @@ parse_date([D|Ds], Date) ->
_ ->
parse_date(Ds, Date)
end.
-
+
is_month("jan"++Rest) -> {true, 1, Rest};
is_month("feb"++Rest) -> {true, 2, Rest};
is_month("mar"++Rest) -> {true, 3, Rest};
@@ -2745,7 +2745,7 @@ parse_time(Time) ->
{Hour, Minutes, Seconds, Rest};
_ -> error
end.
-
+
format_date({{Year,Month,Day},{Hour,Minutes,Seconds}}) ->
M = enc_month(Month),
io_lib:format("~2..0w ~s ~4..0w ~2..0w:~2..0w:~2..0w",
@@ -2759,7 +2759,7 @@ format_date([]) -> [];
format_date(error) -> [].
send_attachment(Session, Number) ->
- mail_session_manager ! {session_get_attach_data, self(),
+ mail_session_manager ! {session_get_attach_data, self(),
Session#session.cookie, Number},
receive
{session_manager, error} ->
@@ -2803,7 +2803,7 @@ send_attachment(Session, Number) ->
%
send_attachment_plain(Session, Number) ->
- mail_session_manager ! {session_get_attach_data, self(),
+ mail_session_manager ! {session_get_attach_data, self(),
Session#session.cookie, Number},
receive
{session_manager, error} ->
@@ -2838,7 +2838,7 @@ getopt(Key, KeyList, Default) ->
Default;
{value, Tuple} ->
Val = element(2,Tuple),
- if
+ if
Val == undefined -> Default;
true -> Val
end
@@ -2856,7 +2856,7 @@ content_type(FileName) ->
%%
-%% State =
+%% State =
find_dot(Data, State) ->
find_dot(State, Data, []).
View
6 applications/mail/src/mail_html.erl
@@ -1,4 +1,4 @@
-% -*- Erlang -*-
+% -*- Erlang -*-
% File: mail_html.erl
% Author: Johan Bevemyr
% Created: Sat Jun 19 15:13:49 2004
@@ -127,7 +127,7 @@ tokenize([$<,$!,$-,$-|R0], Acc, Tokens, L0) ->
tokenize(R1, Acc, Tokens, L1);
tokenize([$<|R0], Acc, Tokens, L0) ->
{Tag,R1,L1} = scan_tag(R0,L0),
- if
+ if
Acc == [] ->
next_token(Tag, R1, [Tag|Tokens], L1);
true ->
@@ -238,7 +238,7 @@ scan_quote([C=$\r|R], Acc, Q, L) ->
scan_quote(R, [C|Acc], Q, L+1);
scan_quote([C|R], Acc, Q, L) ->
scan_quote(R, [C|Acc], Q, L).
-
+
%
scan_endtag(R, Tag, L) ->
View
12 applications/mail/src/smtp.erl
@@ -1,8 +1,8 @@
-% -*- Erlang -*-
+% -*- Erlang -*-
% File: smtp.erl (~jb/work/yaws/applications/mail/src/smtp.erl)
% Author: Johan Bevemyr
% Created: Tue Feb 24 23:15:59 2004
-% Purpose:
+% Purpose:
-module('smtp').
-author('jb@bevemyr.com').
@@ -12,7 +12,7 @@
%% Example
%
-% smtp:send("mail.bevemyr.com", "jb@bevemyr.com",
+% smtp:send("mail.bevemyr.com", "jb@bevemyr.com",
% ["katrin@bevemyr.com","jb@bevemyr.com"],
% "Test Subject",
% "My Message", [{"file1.txt","text/plain","hej hopp igen"}]).
@@ -22,7 +22,7 @@
send(Server, From, To, Subject, Message, Attached) ->
{ok, Port} = smtp_init(Server, From, To),
Boundary="--Next_Part("++boundary_date()++")--",
- CommonHeaders =
+ CommonHeaders =
[mail_header("To: ", To),
mail_header("From: ", From),
mail_header("Subject: ", Subject)],
@@ -140,7 +140,7 @@ smtp_expect(Code, Port, Acc, ErrorMsg) ->
smtp_expect(Code, Port, NAcc, ErrorMsg);
_N ->
ResponseCode = to_int(NAcc),
- if
+ if
ResponseCode == Code -> ok;
true -> throw({error, ErrorMsg})
end
@@ -182,7 +182,7 @@ dot_escape([$.|Rest], true, Acc) ->
dot_escape(Rest, false, [$.,$.|Acc]);
dot_escape([$\n|Rest], _, Acc) ->
dot_escape(Rest, true, [$\n|Acc]);
-dot_escape([C|Rest], _, Acc) ->
+dot_escape([C|Rest], _, Acc) ->
dot_escape(Rest, false, [C|Acc]).
%%
View
2 applications/wiki/src/utils.erl
@@ -55,7 +55,7 @@ fold_files(Dir, RegExp, Recursive, Fun, InitialAcc) ->
Wrapper = fun
(FullName, false, Acc) ->
NewAcc = case regexp:match(FullName, CompiledRegExp) of
- {match, _, _} ->
+ {match, _, _} ->
Fun(FullName, Acc);
_ ->
Acc
View
200 applications/wiki/src/wiki.erl
@@ -1,11 +1,11 @@
-% -*- Erlang -*-
+% -*- Erlang -*-
% File: wiki.erl (~jb/work/wiki/src/wiki.erl)
% Author: Joe Armstrong
% Author: Johan Bevemyr
% Purpose: Wiki web in Erlang
%%
-%% History: Ported and partly rewritten by Johan Bevemyr for
+%% History: Ported and partly rewritten by Johan Bevemyr for
%% the yaws http server.
%%
@@ -25,7 +25,7 @@
-export([showPage/3, createNewPage/3, showHistory/3, allPages/3,
lastEdited/3, wikiZombies/3, editPage/3, editFiles/3,
- previewNewPage/3, allRefsToMe/3, deletePage/3,
+ previewNewPage/3, allRefsToMe/3, deletePage/3,
editTag/3, finalDeletePage/3, storePage/3, putPassword/3,
storeNewPage/3, previewPage/3, previewTagged/3, copyFiles/3,
deleteFiles/3, addFile/1, addFile/2,
@@ -53,7 +53,7 @@
showPage(Params, Root, Prefix) ->
Page = getopt("node", Params),
- if
+ if
Page == undefined ->
error(invalid_request);
true ->
@@ -103,7 +103,7 @@ create_thumb(SrcPath, DstPath) ->
getThumb(Params, Root, Prefix) ->
Page = getopt("node", Params),
Pict = getopt("pict", Params),
- if
+ if
Page == undefined ->
error(invalid_request);
true ->
@@ -114,7 +114,7 @@ getThumb(Params, Root, Prefix) ->
UpToDate = thumb_up2date(SrcPath, DstPath),
if UpToDate ->
done;
- true ->
+ true ->
create_thumb(SrcPath, DstPath)
end,
{redirect_local, Prefix++FileDir++"/"++ThumbName}
@@ -123,7 +123,7 @@ getThumb(Params, Root, Prefix) ->
getMidSize(Params, Root, Prefix) ->
Page = getopt("node", Params),
Pict = getopt("pict", Params),
- if
+ if
Page == undefined ->
error(invalid_request);
true ->
@@ -136,7 +136,7 @@ getMidSize(Params, Root, Prefix) ->
DstAge = get_age(DstPath),
SrcAge = get_age(SrcPath),
if DstAge > SrcAge -> false;
- true ->
+ true ->
os:cmd("convert -size 400x400 -scale 400x400 '"++
shell_quote(SrcPath)++"' '"++
shell_quote(DstPath)++"'")
@@ -155,7 +155,7 @@ shell_quote([$'|R]) ->
[$\\, $'| shell_quote(R)];
shell_quote([C|R]) ->
[C|shell_quote(R)].
-
+
get_age(Path) ->
case file:read_file_info(Path) of
@@ -257,7 +257,7 @@ addFile([WobFile, FileAtm], Halt) ->
{wik002, Pwd, Email, Time, Who, TxtStr, Files, Patches} =
bin_to_wik002(Bin),
- NewFiles =
+ NewFiles =
case lists:keysearch(File, 2, Files) of
{value, _} ->
Files;
@@ -284,7 +284,7 @@ createNewPage(Params, Root, Prefix) ->
Sid = getopt("sid", Params),
- if
+ if
Sid /= undefined ->
{Txt,Passwd,Email} =
session_get_all(Sid, initial_page_content(), "", ""),
@@ -333,12 +333,12 @@ createNewPage1(Page, Root, Sid, Prefix, Content, Passwd, Email) ->
storePage(Params, Root, Prefix) ->
Password = getopt("password", Params, ""),
- Page = getopt("node", Params),
+ Page = getopt("node", Params),
Cancel = getopt("cancel", Params),
Edit = getopt("edit", Params),
Sid = getopt("sid", Params),
-
- if
+
+ if
Cancel /= undefined ->
session_end(Sid),
redirect({node, Page}, Prefix);
@@ -360,7 +360,7 @@ storePage(Params, Root, Prefix) ->
show({no_such_page,Page}, Root)
end
end.
-
+
storePage1(Params, Root, Prefix) ->
Page = getopt("node",Params),
@@ -381,12 +381,12 @@ storePage1(Params, Root, Prefix) ->
end.
storeNewPage(Params, Root, Prefix) ->
-
+
Page = getopt("node", Params),
Password = getopt("password", Params),
Email0 = getopt("email", Params),
Txt0 = getopt("txt", Params),
-
+
Txt = zap_cr(urlencoded2str(Txt0)),
Email = urlencoded2str(Email0),
%% Check the password
@@ -411,7 +411,7 @@ storeTagged(Params, Root, Prefix) ->
{File,FileDir} = page2filename(Page, Root),
case file:read_file(File) of
{ok, Bin} ->
- Wik = {wik002,_Pwd,_Email,_Time,_Who,OldTxt,_Files,_Patches} =
+ Wik = {wik002,_Pwd,_Email,_Time,_Who,OldTxt,_Files,_Patches} =
bin_to_wik002(Bin),
W = wiki_split:str2wiki(OldTxt),
ITag = list_to_integer(Tag),
@@ -421,7 +421,7 @@ storeTagged(Params, Root, Prefix) ->
wiki_split:putRegion(ITag, W, Txt);
write_append ->
Time = format_time({date(), time()}),
- wiki_split:putRegion(ITag, W,
+ wiki_split:putRegion(ITag, W,
"''" ++ Time ++ "''\n\n" ++
Txt ++ "\n\n____\n" ++ Old)
end,
@@ -468,7 +468,7 @@ addFileInit(Params, Root, Prefix) ->
Page = getopt("node", Params),
Password = getopt("password", Params),
template2(Root, "Add File", Page,
- [form("POST", "addFile.yaws",
+ [form("POST", "addFile.yaws",
[
input("hidden", "node", Page),
input("hidden", "password", Password),
@@ -493,7 +493,7 @@ addFileInit(Params, Root, Prefix) ->
"the zip file and check the 'unzip' checkbox above."
],
false).
-
+
-record(addfile, {
root,
prefix,
@@ -530,14 +530,14 @@ addFile(Arg, Root, Prefix) ->
show({error_on_upload, State#addfile.node}, Root)
end
end.
-
+
prepare_addFile_state(undefined, Root, Prefix) ->
#addfile{root=Root, prefix=Prefix};
prepare_addFile_state(State, Root, Prefix) ->
State#addfile{root=Root, prefix=Prefix}.
-
+
merge_body(undefined, Data) ->
Data;
merge_body(Acc, New) ->
@@ -705,7 +705,7 @@ updateFilesInit(Params, Root, Prefix) ->
end,
NewFiles = [UpdateDesc(F) || F <- OldFiles],
-
+
Time = {date(), time()},
Who = "unknown",
Ds = {wik002,Pwd, Email,Time,Who,Txt,NewFiles,Patches},
@@ -727,7 +727,7 @@ deleteFilesInit(Params, Root, Prefix) ->
{ok, Bin} = file:read_file(File),
Wik = {wik002,Pwd,_Email,_Time, _Who,_Txt,Files,_Patches}
= bin_to_wik002(Bin),
-
+
Extend = fun({file, Name, Desc, _}) ->
{file, Name, Desc, []};
({file, Name, _}) ->
@@ -750,21 +750,21 @@ deleteFilesInit(Params, Root, Prefix) ->
template2(Root, "Confirm", Page,
[List,
- form("POST", "deleteFiles.yaws",
+ form("POST", "deleteFiles.yaws",
[DelList,
input("submit", "delete", "Delete"),
input("submit", "cancel", "Cancel"),
input("hidden", "node", Page),
input("hidden", "password", Password)])
],
false).
-
+
deleteFiles(Params, Root, Prefix) ->
Password = getopt("password", Params, ""),
- Page = getopt("node", Params),
+ Page = getopt("node", Params),
Cancel = getopt("cancel", Params),
-
- if
+
+ if
Cancel /= undefined ->
redirect({node, Page}, Prefix);
true ->
@@ -789,7 +789,7 @@ deleteFiles1(Params, Root, Prefix) ->
{ok, Bin} = file:read_file(File),
Wik = {wik002,Pwd,Email,_Time, _Who,Txt,Files,Patches}
= bin_to_wik002(Bin),
-
+
Extend = fun({file, Name, Desc, _}) ->
{file, Name, Desc, []};
({file, Name, _}) ->
@@ -834,7 +834,7 @@ copyFilesInit(Params, Root, Prefix) ->
{ok, Bin} = file:read_file(File),
Wik = {wik002,Pwd,_Email,_Time, _Who,_Txt,Files,Patches}
= bin_to_wik002(Bin),
-
+
Extend = fun({file, Name, Desc, _}) ->
{file, Name, Desc, []};
({file, Name, _}) ->
@@ -856,14 +856,14 @@ copyFilesInit(Params, Root, Prefix) ->
PageFiles = sort(files(Root, "*.wob")),
Pages = [filename:basename(P,".wob") || P <- PageFiles, P /= File],
-
+
if
length(CheckedFiles) == 0 ->
editFiles(Params, Root, Prefix);
true ->
template2(Root, "Confirm", Page,
[List,
- form("POST", "copyFiles.yaws",
+ form("POST", "copyFiles.yaws",
[CpList,
"Destination: ",
input("select","destination",Pages),
@@ -875,7 +875,7 @@ copyFilesInit(Params, Root, Prefix) ->
false)
end.
-
+
copyFiles(Params, Root, Prefix) ->
Password = getopt("password", Params, ""),
Page = getopt("node", Params),
@@ -896,8 +896,8 @@ copyFiles(Params, Root, Prefix) ->
end.
copyFiles1(Params, Root, Prefix) ->
- Page = getopt("node", Params),
- Dest = getopt("destination", Params),
+ Page = getopt("node", Params),
+ Dest = getopt("destination", Params),
case checkPassword(Dest, "", Root, Prefix) of
true ->
@@ -909,8 +909,8 @@ copyFiles1(Params, Root, Prefix) ->
end.
copyFiles2(Params, Root, Prefix) ->
- Page = getopt("node", Params),
- Dest = getopt("destination", Params),
+ Page = getopt("node", Params),
+ Dest = getopt("destination", Params),
Password = getopt("password", Params, ""),
case checkPassword(Dest, Password, Root, Prefix) of
@@ -923,12 +923,12 @@ copyFiles2(Params, Root, Prefix) ->
end.
copyFiles3(Params, Root, Prefix) ->
- Page = getopt("node", Params),
- Dest = getopt("destination", Params),
-
+ Page = getopt("node", Params),
+ Dest = getopt("destination", Params),
+
{SrcWobFile, SrcFileDir} = page2filename(Page, Root),
{DstWobFile, DstFileDir} = page2filename(Dest, Root),
-
+
SrcFileNames = [lists:nthtail(3,N) ||
{N,S,_} <- Params,
lists:prefix("cp_",N)],
@@ -959,7 +959,7 @@ showHistory(Params, Root, Prefix) ->
{File,FileDir} = page2filename(Page, Root),
case file:read_file(File) of
{ok, Bin} ->
- {wik002,Pwd,Email,_Time,_Who,OldTxt,_Files,Patches} =
+ {wik002,Pwd,Email,_Time,_Who,OldTxt,_Files,Patches} =
bin_to_wik002(Bin),
Links = reverse(mk_history_links(reverse(Patches), Page, 1)),
template2(Root, "History", Page, Links, false);
@@ -985,11 +985,11 @@ redirect_edit(Page, Sid, Password, Prefix) ->
redirect_create(Page, Sid, Prefix) ->
UrlSid = str2urlencoded(Sid),
{redirect_local, Prefix++"createNewPage.yaws?node="++str2urlencoded(Page)++
- "&sid="++UrlSid}.
+ "&sid="++UrlSid}.
redirect_change(Page, Prefix) ->
{redirect_local, Prefix++"changePassword.yaws?node="++
- str2urlencoded(Page)}.
+ str2urlencoded(Page)}.
mk_history_links([{C,Time,Who}|T], Page, N) ->
[["<li>",i2s(N)," modified on <a href='showOldPage.yaws?node=",
@@ -1012,7 +1012,7 @@ allPages(_, Root, Prefix) ->
F = filename:basename(I, ".wob"),
[wiki_to_html:format_link(F, Root),
"<br>"]
- end,
+ end,
Files)], false).
lastEdited(_, Root, Prefix) ->
@@ -1026,7 +1026,7 @@ lastEdited(_, Root, Prefix) ->
S1 = lists:map(fun({{Year,Month,Day},Fx}) ->
[p(),i2s(Year),"-",i2s(Month),"-",i2s(Day),"<p>",
"<ul>",
- lists:map(fun(F) ->
+ lists:map(fun(F) ->
F1 = filename:basename(F, ".wob"),
J = wiki_to_html:format_link(F1, Root),
[J,"<br>"] end, Fx),
@@ -1050,13 +1050,13 @@ collect_this_day(Day, T, L) ->
last_edited_time(File) ->
case file:read_file(File) of
{ok, Bin} ->
- {wik002,Pwd,_Email,Time,_Who,_Txt,_Files,_Patches} =
+ {wik002,Pwd,_Email,Time,_Who,_Txt,_Files,_Patches} =
bin_to_wik002(Bin),
Time;
_ ->
error
end.
-
+
showOldPage(Params, Root, Prefix) ->
Page = getopt("node", Params),
Nt = getopt("index", Params),
@@ -1065,7 +1065,7 @@ showOldPage(Params, Root, Prefix) ->
{File,FileDir} = page2filename(Page, Root),
case file:read_file(File) of
{ok, Bin} ->
- Wik = {wik002,Pwd,_Email,_Time,_Who,Txt,Files,Patches} =
+ Wik = {wik002,Pwd,_Email,_Time,_Who,Txt,Files,Patches} =
bin_to_wik002(Bin),
%% N = #patches to do
N = length(Patches) - Index + 1,
@@ -1104,13 +1104,13 @@ deletePage(Params, Root, Prefix) ->
deletePage1(Params, Root, Prefix) ->
Page = getopt("node", Params),
Password = getopt("password", Params),
-
+
{File,FileDir} = page2filename(Page, Root),
case file:read_file(File) of
{ok, Bin} ->
{wik002, _Pwd,_Email,_Time,_Who,Content,_Files,_Patches} =
bin_to_wik002(Bin),
-
+
Txt = quote_lt(Content),
template2(Root, "Delete", Page,
[p("Reconfirm deleting this page - hit the 'Delete' "
@@ -1151,7 +1151,7 @@ finalDeletePage(Params, Root, Prefix) ->
finalDeletePage1(Params, Root, Prefix) ->
Page = getopt("node", Params),
Txt0 = getopt("text", Params),
-
+
{File,FileDir} = page2filename(Page, Root),
case file:delete(File) of
ok ->
@@ -1242,7 +1242,7 @@ session_manager_init(N,Sessions) ->
% Sessions = [{Pid, Sid}]
session_manager(N,Sessions) ->
- receive
+ receive
{'EXIT', Pid, _} ->
NewS = lists:keydelete(Pid, 1, Sessions),
session_manager(N, NewS);
@@ -1286,7 +1286,7 @@ session_manager(N,Sessions) ->
Unknown ->
session_manager(N, Sessions)
end.
-
+
session_proc(Sid,State) ->
receive
stop ->
@@ -1318,7 +1318,7 @@ to_sm(Msg) ->
session_end(undefined) -> done;
session_end(Sid) -> to_sm({to_sid, self(), Sid, stop}).
-
+
session_new(Txt) ->
session_new(Txt, "", "").
@@ -1335,7 +1335,7 @@ session_new(Sid, Txt, Passwd, Email) ->
receive
{session_id, Sid} -> Sid
end.
-
+
session_get_text(undefined, OldTxt) -> OldTxt;
session_get_text(Sid, OldTxt) ->
to_sm({to_sid, self(), Sid, {get_text, self()}}),
@@ -1452,7 +1452,7 @@ checkPassword(Page, Password, Root, Prefix) ->
{ok, Bin} ->
{wik002, Pwd,_Email,_Time,_Who,_TxtStr,Files,_Patches} =
bin_to_wik002(Bin),
- case Pwd of
+ case Pwd of
"" -> true;
Password -> true;
_ -> false
@@ -1484,7 +1484,7 @@ editFiles1(Page, Password, Root, Prefix) ->
lists:map(fun({file,Name,Description,_Content}) ->
["<tr><td align=left valign=top>",
input("checkbox","cb_"++Name,"on", ""),
- Name,
+ Name,
"</td><td width='70%' align=left "
"valign=top>",
textarea("cbt_"++Name, 2, 20, Description),
@@ -1606,12 +1606,12 @@ nextSlide(Index, Direction, Page, Root, Prefix) ->
true -> []
end,
F1 = add_blanks_nicely(Page),
- TopHeader =
+ TopHeader =
["<a href='showPage.yaws?node=",
str2urlencoded(Page),
"'>",F1,"</a>\n"],
Locked = Pwd /= "",
- Link =
+ Link =
wiki_templates:template(Page, Root,
[DeepStr, Auto],
utils:time_to_string(Time),
@@ -1633,23 +1633,23 @@ thumbIndex(Params, Root, Prefix) ->
1, lists:keysort(2,Files)),
Pics = [{F,N} || {F,N} <- NumFiles, pict_suffix(F)],
Node = str2urlencoded(Page),
- DeepStr =
+ DeepStr =
["<table>",
build_thumb_table(Pics, Node, Prefix, Root, FileDir),
"</table>"],
F1 = add_blanks_nicely(Page),
- TopHeader =
+ TopHeader =
["<a href='showPage.yaws?node=",Node,"'>",
F1,"</a>\n"],
Locked = Pwd /= "",
- Link =
+ Link =
wiki_templates:template(Page, Root, DeepStr,
utils:time_to_string(Time),
Locked);
_ ->
show({no_such_page,Page}, Root)
end.
-
+
build_thumb_table([], _Node, _Prefix, _Root, _FileDir) -> [];
build_thumb_table(Pics, Node, Prefix, Root, FileDir) ->
build_thumb_rows(Pics, Node, Prefix, Root, FileDir, 0, 5, ["<tr>"]).
@@ -1719,7 +1719,7 @@ get_img(Index, Direction, Files) ->
end
end
end.
-
+
editTag(Params, Root, Prefix) ->
Page = getopt("node", Params),
@@ -1732,7 +1732,7 @@ editTag(Params, Root, Prefix) ->
bin_to_wik002(Bin),
Wik = wiki_split:str2wiki(OldTxt),
{Type, Str} = wiki_split:getRegion(list_to_integer(Tag), Wik),
- Str1 = case Type of
+ Str1 = case Type of
open -> quote_lt(Str);
write_append -> ""
end,
@@ -1833,7 +1833,7 @@ previewPage1(Params, Root, Prefix) ->
Password = getopt("password", Params),
Txt0 = getopt("text", Params),
Sid = getopt("sid", Params,"undefined"),
-
+
Txt = zap_cr(Txt0),
Wik = wiki_split:str2wiki(Txt),
session_set_text(Sid, Txt),
@@ -1848,7 +1848,7 @@ previewPage1(Params, Root, Prefix) ->
input("hidden", "node", Page),
input("hidden", "password", Password),
input("hidden", "txt", str2formencoded(Txt))]),
- p(),hr(),h1(Page),
+ p(),hr(),h1(Page),
wiki_to_html:format_wiki(Page, Wik, Root, preview)], false).
%% Preview Tagged
@@ -1875,7 +1875,7 @@ previewTagged(Params, Root, Prefix) ->
input("hidden", "node", Page),
input("hidden", "tag", Tag),
input("hidden", "txt", str2formencoded(Txt))]),
- p(),hr(),
+ p(),hr(),
wiki_to_html:format_wiki(Page,{txt,10000,Txt},Root)],
false);
false ->
@@ -1887,12 +1887,12 @@ previewTagged(Params, Root, Prefix) ->
legal_flat_text("<" ++ _) -> false;
legal_flat_text(X) -> legal_flat_text1(X).
-
+
legal_flat_text1("\n<" ++ _) -> false;
legal_flat_text1("\n>" ++ _) -> false;
legal_flat_text1([_|T]) -> legal_flat_text1(T);
legal_flat_text1([]) -> true.
-
+
previewNewPage(Params, Root, Prefix) ->
Page = getopt("node", Params),
P1 = getopt("password1", Params),
@@ -1904,7 +1904,7 @@ previewNewPage(Params, Root, Prefix) ->
Txt = zap_cr(Txt0),
Wik = wiki_split:str2wiki(Txt),
session_set_text(Sid, Txt),
- if
+ if
P1 == P2 ->
session_set_all(Sid,Txt,P1,Email),
template2(Root, "Preview",
@@ -1949,10 +1949,10 @@ send(To, Subject, Data) ->
io:format("sending ...~n", []),
os:cmd("/usr/sbin/sendmail -t > /dev/null < " ++ TmpFile),
file:delete(TmpFile).
-
+
open_tmp_file(RootName, Suffix) ->
open_tmp_file(10, RootName, Suffix).
-
+
open_tmp_file(0, _, Suffix) ->
exit({cannot_open_a_temporay_file, Suffix});
open_tmp_file(N, RootName, Suffix) ->
@@ -1964,7 +1964,7 @@ open_tmp_file(N, RootName, Suffix) ->
{FileName, Stream};
{error, _} ->
open_tmp_file(N-1, RootName, Suffix)
- end.
+ end.
ls(Root) ->
@@ -1986,7 +1986,7 @@ error(invalid_request) ->
bin_to_wik002(Bin) ->
case binary_to_term(Bin) of
- {wik001,Pwd,Email,Time,Who,OldTxt,Patches} ->
+ {wik001,Pwd,Email,Time,Who,OldTxt,Patches} ->
{wik002,Pwd,Email,Time,Who,OldTxt,[],Patches};
{wik002,Pwd,Email,Time,Who,OldTxt,Files,Patches} ->
{wik002,Pwd,Email,Time,Who,OldTxt,Files,Patches}
@@ -2120,7 +2120,7 @@ big_letter($
big_letter() -> true;
big_letter() -> true;
big_letter(_) -> false.
-
+
little_letter(H) when $a =< H, H =< $z -> true;
little_letter() -> true;
little_letter() -> true;
@@ -2169,20 +2169,20 @@ quote_lt([]) -> [].
%% The default encoding for all forms is `application/x-www-form-urlencoded'.
%% A form data set is represented in this media type as follows:
-%%
+%%
%% 1. The form field names and values are escaped: space characters are
%% replaced by `+', and then reserved characters are escaped as per [URL];
%% that is, non-alphanumeric characters are replaced by `%HH', a percent
%% sign and two hexadecimal digits representing the ASCII code of the
%% character. Line breaks, as in multi-line text field values, are
%% represented as CR LF pairs, i.e. `%0D%0A'.
-%%
+%%
%% 2. The fields are listed in the order they appear in the document with the
%% name separated from the value by `=' and the pairs separated from each
%% other by `&'. Fields with null values may be omitted. In particular,
%% unselected radio buttons and checkboxes should not appear in the
%% encoded data, but hidden fields with VALUE attributes present should.
-%%
+%%
str2fileencoded([$_|T]) ->
@@ -2273,15 +2273,15 @@ hex2dec($e) -> 14;
hex2dec($f) -> 15.
-%%
+%%
%% MR: Is this really necessary ?
%% We can now use filelib:fold_files/5
-files(Dir, Re) ->
+files(Dir, Re) ->
Re1 = regexp:sh_to_awk(Re),
find_files(Dir, Re1, []).
-find_files(Dir, Re, L) ->
+find_files(Dir, Re, L) ->
case file:list_dir(Dir) of
{ok, Files} -> find_files(Files, Dir, Re, L);
{error, _} -> L
@@ -2292,12 +2292,12 @@ find_files([File|T], Dir, Re, L) ->
case file_type(FullName) of
regular ->
case regexp:match(FullName, Re) of
- {match, _, _} ->
+ {match, _, _} ->
find_files(T, Dir, Re, [FullName|L]);
_ ->
find_files(T, Dir, Re, L)
end;
- _ ->
+ _ ->
find_files(T, Dir, Re, L)
end;
find_files([], _, _, L) ->
@@ -2360,7 +2360,7 @@ check_precon([F|Fs], Args) ->
NotOk ->
NotOk
end.
-
+
%%
getopt(Key, KeyList) ->
@@ -2374,7 +2374,7 @@ getopt(Key, KeyList, Default) ->
Default;
{value, Tuple} ->
Val = element(2,Tuple),
- if
+ if
Val == undefined -> Default;
true -> Val
end
@@ -2462,27 +2462,27 @@ searchPages(SearchPost, Root, Prefix) ->
[input("submit", "searchstart", "Search"),
input("text", "search", "")])],
template2(Root,"Search", "Wiki page search",
- [S0, "<hr>",
- h1("Nothing to find")],
+ [S0, "<hr>",
+ h1("Nothing to find")],
false);
{error, Error} ->
S0 = [forms("POST", "searchPage.yaws",
[input("submit", "searchstart", "Search"),
input("text", "search", "")])],
template2(Root,"Search", "Wiki page search",
- [S0, "<hr>",
+ [S0, "<hr>",
h1(io_lib:format("Error in the regular "
- "expression \"~p\"",
- [Error]))],
- false);
+ "expression \"~p\"",
+ [Error]))],
+ false);
Search ->
Files = sort(files(Root, "*.wob")),
- {Sres, _S} = lists:mapfoldl(fun(F, S) ->
- {searchPage(F, S), S} end,
+ {Sres, _S} = lists:mapfoldl(fun(F, S) ->
+ {searchPage(F, S), S} end,
Search, Files),
Sres_sort = reverse(sort(Sres)),
S1 = lists:map(fun({Matches, Fx}) ->
- [p(),i2s(Matches)," ",
+ [p(),i2s(Matches)," ",
wiki_to_html:format_link(
filename:basename(Fx, ".wob"), Root),
"</p>"]
@@ -2491,8 +2491,8 @@ searchPages(SearchPost, Root, Prefix) ->
[input("submit", "searchstart", "Search"),
input("text", "search", Search)])],
template2(Root,"Search", "Wiki page search",
- [S0, "<hr>",
- h1("Number of matches found per page"), S1],
+ [S0, "<hr>",
+ h1("Number of matches found per page"), S1],
false)
end.
View
4 applications/wiki/src/wiki_diff.erl
@@ -79,7 +79,7 @@ extend_match([{_,S}|T1], [{L2,S}|T2], L1, _) -> extend_match(T1, T2, L1, L2);
extend_match(X, _, L1, L2) -> {yes, L1, L2, X}.
str2lines(L) -> str2lines(L, 1, [], []).
-
+
str2lines([H|T], Line, C, L) ->
case H of
$\n -> str2lines(T, Line+1,[],[{Line,reverse([$\n|C])}|L]);
@@ -89,4 +89,4 @@ str2lines([], Line, [], L) ->
reverse(L);
str2lines([], Line, C, L) ->
reverse([{Line,reverse(C)}|L]).
-
+
View
24 applications/wiki/src/wiki_format_txt.erl
@@ -5,8 +5,8 @@
%% : Johan Bevemyr, minor modifications (jb@bevemyr.com)
%% Purpose : Wiki formatting engine
%%
-%% Rules:
-%% Inline annotations:
+%% Rules:
+%% Inline annotations:
%% * Bold
%% '' Italic
%% ''' Code
@@ -26,7 +26,7 @@
%% {{ Embedded HTML
%% ...
%% }}
-%% < Writable region within a
+%% < Writable region within a
%% ... locked page
%% >
%% << Write append region within
@@ -40,7 +40,7 @@
%% the number of -'s
%% * is the bullet. Then the text
%% - [Header] Text Is a displayed list.
-%%
+%%
%% Blanks or tabs between the - mark
%% and the * (or Header) and Text
%% are not significant.
@@ -59,7 +59,7 @@
h2 = false,
h3 = false,
u = false,
- n = 0,
+ n = 0,
dl = false
}).
@@ -130,7 +130,7 @@ format_txt("slideshow:" ++ T, Env, L, Doc) ->
format_txt(T1, Env, reverse(Txt, L), Doc);
format_txt("mailto:" ++ T, Env, L, Doc) ->
{X, T1} = collect_mail(T, []),
- Txt = "<a href='mailto:" ++ X ++ "'>" ++
+ Txt = "<a href='mailto:" ++ X ++ "'>" ++
"<img border=0 src='WikiPreferences.files/mailto.png'>"
++ X ++ "</a>",
format_txt(T1, Env, reverse(Txt, L), Doc);
@@ -167,7 +167,7 @@ collect_url(S=[$.,$\r|_], L) -> {reverse(L), S};
collect_url(S=[$.,$\t|_], L) -> {reverse(L), S};
collect_url(S=[$\n|_], L) -> {reverse(L), S};
collect_url([H|T], L) -> collect_url(T, [H|L]);
-collect_url([], L) -> {reverse(L), []}.
+collect_url([], L) -> {reverse(L), []}.
collect_mail(S=[$ |_], L) -> {reverse(L), S};
collect_mail(S=[$)|_], L) -> {reverse(L), S};
@@ -179,7 +179,7 @@ collect_mail(S=[$.,$\r|_], L) -> {reverse(L), S};
collect_mail(S=[$.,$\t|_], L) -> {reverse(L), S};
collect_mail(S=[$\n|_], L) -> {reverse(L), S};
collect_mail([H|T], L) -> collect_mail(T, [H|L]);
-collect_mail([], L) -> {reverse(L), []}.
+collect_mail([], L) -> {reverse(L), []}.
get_mailto([$\\,C|T], L) ->
get_mailto(T, L);
@@ -201,7 +201,7 @@ format_external_url(F, Scheme) ->
true ->
"<img src=\"" ++ F1 ++ "\">";
false ->
- "<a href=\"" ++ F1 ++ "\">" ++
+ "<a href=\"" ++ F1 ++ "\">" ++
"<img border=0 src='WikiPreferences.files/http.png'>"
++ F1 ++ "</a> "
end.
@@ -290,7 +290,7 @@ date_less(D1,D2) ->
year,
month,
day,
- hours,
+ hours,
minutes,
seconds
}).
@@ -434,7 +434,7 @@ note_start() ->
<td bgcolor=\"yellow\"><font size=\"-1\">".
note_end() -> "</font></td></tr></table><p>\n".
-
+
mk_list(T, Env, L, Doc) ->
{Lev, T1} = count_indent_levels(T, 0),
{Env1, L1} = adjust_indents(Env, Lev, L),
@@ -466,7 +466,7 @@ add_dl([H|T], Env, L, Doc) ->
add_dl(T, Env, [H|L], Doc);
add_dl([], Env, L, Doc) ->
format_txt([], Env, reverse("</dt>", L), Doc).
-
+
count_indent_levels([$-|T], N) -> count_indent_levels(T, N+1);
count_indent_levels(T, N) -> {N, T}.
View
6 applications/wiki/src/wiki_plugin_backlinks.erl
@@ -19,8 +19,8 @@ run(Page, ArgList) ->
Root = Sconf#sconf.docroot,
AllRefs = wiki_utils:getallrefs(Page, Root),
-
- lists:map(fun(F) ->
- [wiki_to_html:format_link(F, Root),"<br>"] end,
+
+ lists:map(fun(F) ->
+ [wiki_to_html:format_link(F, Root),"<br>"] end,
AllRefs).
View
6 applications/wiki/src/wiki_plugin_menu.erl
@@ -25,9 +25,9 @@ run(_Page, ArgList) ->
%% Get all page starting with a given word
Pages = wiki_utils:getpages_by_prefix(Prefix, Root),
-
- lists:map(fun(F) ->
- [wiki_to_html:format_menu_link(Prefix, F, Root),"<br>"] end,
+
+ lists:map(fun(F) ->
+ [wiki_to_html:format_menu_link(Prefix, F, Root),"<br>"] end,
Pages).
View
14 applications/wiki/src/wiki_split.erl
@@ -24,9 +24,9 @@
%% +deftype wikiText() = {wik, [{text,tag(),string()} |
%% {open,tag(),string()} |
%% {write_append, tag(), string()}]}
-%% +deftype tag() = int().
+%% +deftype tag() = int().
--export([str2wiki/1, wiki2str/1,
+-export([str2wiki/1, wiki2str/1,
getRegion/2, putRegion/3, writeAppendRegion/3]).
-import(lists, [reverse/1]).
@@ -42,10 +42,10 @@ number_blocks([], _) -> [].
str2wiki(Str, L) ->
{Before, Stuff} = collect_str(Str),
case Stuff of
- "<<\n" ++ T ->
+ "<<\n" ++ T ->
{In, Str3} = collect_write_append([$\n|T], []),
str2wiki(Str3, [{write_append,In},{txt,Before}|L]);
- "<\n" ++ T ->
+ "<\n" ++ T ->
{In, Str3} = collect_open_region([$\n|T], []),
str2wiki(Str3, [{open,In},{txt,Before}|L]);
[] ->
@@ -54,7 +54,7 @@ str2wiki(Str, L) ->
%% collect_str(Str) -> {Str1, Str2}
%% where Str2 == [], "<" ++ _ | "<<" ++ _
-
+
collect_str(Str) -> collect_after_nl(Str, []).
collect_after_nl(S = "<<\n" ++ _, L) -> {reverse(L), S};
@@ -81,15 +81,15 @@ wiki2str1([{txt,_,Str}|T]) -> [Str|wiki2str1(T)];
wiki2str1([{open,_,Str}|T]) -> ["<\n",Str,"\n>"|wiki2str1(T)];
wiki2str1([{write_append,_,Str}|T]) -> ["<<\n",Str,"\n>>"|wiki2str1(T)];
wiki2str1([]) -> [].
-
+
sneaky_flatten(L) ->
binary_to_list(list_to_binary(L)).
getRegion(Tag, {wik, L}) -> getRegion1(Tag, L).
getRegion1(Tag, [{Type,Tag,Str}|_]) -> {Type, Str};
getRegion1(Tag, [_|T]) -> getRegion1(Tag, T).
-
+
putRegion(Tag, {wik, L}, Str1) -> {wik, putRegion1(Tag, L, Str1)}.
putRegion1(Tag, [{Type,Tag,_}|T], New) -> [{Type,Tag,New}|T];
View
78 applications/wiki/src/wiki_templates.erl
@@ -5,7 +5,7 @@
%% B = normal | locked | old
template(Node,Root,Data,Modified,Locked) ->
MenuId =
- if Locked == true -> "lockedmenuframe" ;
+ if Locked == true -> "lockedmenuframe" ;
true -> "menuframe"
end,
@@ -37,7 +37,7 @@ template(Node,Root,Data,Modified,Locked) ->
template2(Root,Title,Header,Data,Locked) ->
MenuId =
- if Locked == true -> "lockedmenuframe" ;
+ if Locked == true -> "lockedmenuframe" ;
true -> "menuframe"
end,
@@ -63,7 +63,7 @@ template2(Root,Title,Header,Data,Locked) ->
template_file() ->
<<"<html>
-<head>
+<head>
<title> @@NODE@@ </title>
<style type=\"text/css\">
<!--
@@ -73,11 +73,11 @@ template_file() ->
</head>
<body>
<table width='100%' border=0>
-<tr>
-<td>
-<table width='100%' border=0>
-<tr>
-<!-- the menu -->
+<tr>
+<td>
+<table width='100%' border=0>
+<tr>
+<!-- the menu -->
<td id=\"@@MENUID@@\" valign='top' width='90%'>
<table width=\"100%\"><tr><td id=\"menu\">
<a href=\"@@HOME@@\"><img border=0 src='WikiPreferences.files/home.gif' alt='Home' title='Go to initial page'></a>&nbsp;&nbsp;
@@ -90,30 +90,30 @@ template_file() ->
</td></tr></table>
</td>
</tr>
-<tr>
-<td>
+<tr>
+<td>
<p>&nbsp;<br>
-
+
<!-- the generated page -->
<h1><a href='@@ALLREFS@@'>@@NODE@@</a></h1>
@@DATA@@
<hr><p>Last Modified: @@MODIFIED@@
-</td>
-</tr>
-</table>
-</td>
-
-<!-- the right hand image -->
-<td width=10 align='right' valign='top'></td>
-</tr>
-</table>
+</td>
+</tr>
+</table>
+</td>
+
+<!-- the right hand image -->
+<td width=10 align='right' valign='top'></td>
+</tr>
+</table>
</body>
</html>
">>.
template_info_file() ->
<<"<html>
-<head>
+<head>
<title> @@TITLE@@ </title>
<style type=\"text/css\">
<!--
@@ -123,30 +123,30 @@ template_info_file() ->
</head>
<body>
<table width='100%' border=0>
-<tr>
-<td>
-<table width='100%' border=0>
-<tr>
-<!-- the menu -->
+<tr>
+<td>
+<table width='100%' border=0>
+<tr>
+<!-- the menu -->
<td id=\"@@MENUID@@\" valign='top' width='90%'>
</td>
-</tr>
-<tr>
-<td>
+</tr>
+<tr>
+<td>
<p>&nbsp;<br>
-
+
<!-- the generated page -->
<h1>@@HEADER@@</h1>
@@DATA@@
-</td>
-</tr>
-</table>
-</td>
-
-<!-- the right hand image -->
-<td width=10 align='right' valign='top'></td>
-</tr>
-</table>
+</td>
+</tr>
+</table>
+</td>
+
+<!-- the right hand image -->
+<td width=10 align='right' valign='top'></td>
+</tr>
+</table>
</body>
</html>
">>.
View
12 applications/wiki/src/wiki_to_html.erl
@@ -21,8 +21,8 @@ format_wiki_files(Page, FileDir, Files, Root) ->
format_wiki_files(Page, FileDir, Files, Root, Heading) ->
LinkFun = fun(I) -> format_link(I, FileDir, Page, Root, show) end,
- ("<hr><b><p>" ++ Heading ++ "</b><br>\n"
- "<table cellspacing=10 width = \"100%\">\n"
+ ("<hr><b><p>" ++ Heading ++ "</b><br>\n"
+ "<table cellspacing=10 width = \"100%\">\n"
++ lists:map(LinkFun, lists:keysort(2,Files)) ++
"</table></p>\n").
@@ -59,7 +59,7 @@ format_link({file, FileName, Description, _}, FileDir, Page, Root,_) ->
["<tr><td valign=top align=left><a href=\"",
wiki:str2urlencoded(FileDir),
"/", wiki:str2urlencoded(FileName),"\" title='",Size,"'>",
- FileName,
+ FileName,
"</a></td><td align=left valign=top>",
Description, "</td></tr>\n"].
@@ -92,7 +92,7 @@ get_filesize(File) ->
io_lib:format("~.1fKB",[Size]);
_ -> "unknown"
end.
-
+
i2s(X) ->
integer_to_list(X).
@@ -101,9 +101,9 @@ pp({wik,L}, F, Node, Root) ->
map(fun(I) -> pp(I, F, Node, Root) end, L);
pp({txt,_,Str}, F, Node, Root) ->
wiki_format_txt:format(Str, F, Node);
-pp({open,Tag,Str}, F, Node, Root) ->
+pp({open,Tag,Str}, F, Node, Root) ->
open("#CCFFCC",Tag,F,pp({txt,9999,Str}, F, Node, Root));
-pp({write_append,Tag,Str}, F, Node, Root) ->
+pp({write_append,Tag,Str}, F, Node, Root) ->
open("#99FFFF",Tag,F,pp({txt,8888,Str}, F, Node, Root));
pp(Other, F, Node, Root) ->
wiki:show({cannot,format,Other}, Root).
View
16 applications/wiki/src/wiki_utils.erl
@@ -23,10 +23,10 @@ findallrefsto(Page, Root) ->
["<p>The following pages contain references to ",