(************************************************************************)
(* This file is part of SKS. SKS is free software; you can
redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA *)
(***********************************************************************)
open Printf
open StdLabels
open MoreLabels
module Unix = UnixLabels
open Unix
open Packet
let html_quote string =
let sin = new Channel.string_in_channel string 0 in
let sout = Channel.new_buffer_outc (String.length string + 10) in
try
while true do
match sin#read_char with
| '<' -> sout#write_string "<"
| '>' -> sout#write_string ">"
| '&' -> sout#write_string "&"
| '"' -> sout#write_string """
| c -> sout#write_char c
done;
""
with
End_of_file ->
sout#contents
let br_regexp = Str.regexp_case_fold "
"
let page ~title ~body =
sprintf
"
%s" (String.concat ~sep:"\r\n" elements ^ "\r\n")