Source: site.view [edit]
Function name: tlidRender
Arguments: data
Description: A render function for results returned by functions created using tLID.
Page type: webl
Render function:  
Module: global

Page source:

var renderObj = fun(data)

   var res = Type(data);

   if Type(data) == "pieceset" then
      res = "<ul>\n";
      every d in data do
         res = res + "<LI>" + Text(d) + "</LI>\n"
      end;
      res = res + "</ul>\n"

   elsif Type(data) == "piece" then
      res = Markup(data)

  elsif Type(data) == "object" then
      res = ToString(data)

   else
      res = ToString(data)
   end;

   return res
end;

var res2 = "";
var ret = "";

if Type(data) == "list" then
   every d in data do
      res2 = res2 + "<LI>" + renderObj(d) + "</LI>\n"
   end;
   ret = NewPiece(res2, "text/html")

elsif Type(data) == "page" then
   ret = NewPage(Markup(data), "text/html")

else
   res2 = renderObj(data);
   ret = NewPiece(res2, "text/html")
end;

ret;