Source: site.view [edit]
Function name: KnockKnockParse
Arguments:
Description:
Page type: webl
Render function:  
Module: sandbox

Page source:

var lines = Str_Split(WubCall("knockKnockJokes", []), "\n");

var res = [];
var term = "";
every line in lines do
  line = Str_Trim(line);
  if (Str_StartsWith(line, "Q:")) then
     term = Select(line, 3, Size(line) - 4)
  elsif (Str_StartsWith(line, "A:")) then
     res = res + [ [. term = term, punch = Select(line, 3, Size(line)) .] ]
  end;  
end;
  
res;