Permalink
Browse files

""

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@147 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent cc675cb commit 20f2862146cd51c1e06b1363af5d07b7f4140ddd @klacke committed Sep 2, 2002
Showing with 16 additions and 6 deletions.
  1. +14 −5 src/yaws_api.erl
  2. +2 −1 www/readpcookie.yaws
View
19 src/yaws_api.erl
@@ -13,8 +13,10 @@
-export([parse_post_data/1, code_to_phrase/1, ssi/2, redirect/1]).
-export([setcookie/2, setcookie/3, setcookie/4, setcookie/5]).
--export([pre_ssi_files/2, pre_ssi_string/1, htmlize/1, f/2, fl/1]).
+-export([pre_ssi_files/2, pre_ssi_string/1, pre_ssi_string/2,
+ htmlize/1, f/2, fl/1]).
-export([find_cookie_val/2, secs/0, url_decode/1]).
+-export([get_line/1, mime_type/1]).
%% these are a bunch of function that are useful inside
%% yaws scripts
@@ -413,9 +415,9 @@ pre_ssi_string(Str) ->
pre_ssi_string(Str, "box").
pre_ssi_string(Str, Class) ->
- {html, ["<br><br>\n<div class=\"", Class, "\"> <pre>",
+ {html, ["<br><br>\n<div class=\"", Class, "\"> <pre>\n",
htmlize_l(Str),
- "</pre></div>\n<br>\n\n"]}.
+ "\n</pre></div>\n<br>\n\n"]}.
%% convenience
@@ -463,8 +465,15 @@ htmlize_l([$<|Tail], Acc) ->
htmlize_l(Tail, [$;,$t,$l,$&|Acc]);
htmlize_l([$&|Tail], Acc) ->
htmlize_l(Tail, [$;,$p,$m,$a,$&|Acc]);
-htmlize_l([X|Tail], Acc) ->
- htmlize_l(Tail, [X|Acc]).
+htmlize_l([X|Tail], Acc) when integer(X) ->
+ htmlize_l(Tail, [X|Acc]);
+htmlize_l([X|Tail], Acc) when binary(X) ->
+ X2 = htmlize_l(binary_to_list(X)),
+ htmlize_l(Tail, [X2|Acc]);
+htmlize_l([X|Tail], Ack) when list(X) ->
+ X2 = htmlize_l(X),
+ htmlize_l(Tail, [X2|Ack]).
+
secs() ->
View
3 www/readpcookie.yaws
@@ -1,6 +1,6 @@
<html>
-<h2> Read persitant cookie </h2>
+<h2> Read persistant cookie </h2>
<erl>
@@ -36,6 +36,7 @@ out(A) ->
The code to read the cookie, is simple, we get the cookie passed to the yaws
code in the #arg structure which is the argument supplied to the out/1 function.
The code is:
+
<erl>
out(A) ->
yaws_api:pre_ssi_files(A#arg.docroot, ["readpcookie.yaws"]).

0 comments on commit 20f2862

Please sign in to comment.