Permalink
Browse files

Remove Xhtmlcompact_lite module: integrated in Ocsigen 1.2 as Xhtmlco…

…mpact.
  • Loading branch information...
1 parent f924445 commit 0892aa3711dd4f4cb7779726574985ee649138b8 @mfp committed Mar 23, 2009
Showing with 2 additions and 204 deletions.
  1. +0 −1 OMakefile
  2. +2 −2 ocsiblog.ml
  3. +0 −161 xhtmlcompact_lite.ml
  4. +0 −40 xhtmlcompact_lite.mli
View
@@ -44,7 +44,6 @@ EXE_FILES[] =
node
rss
comments
- xhtmlcompact_lite
ocsiblog
ocsiblog_main
View
@@ -94,7 +94,7 @@ let rec page_with_title sp thetitle thebody =
(html
(head (title (pcdata thetitle)) [css_link css_uri (); ctype_meta; rss2_link sp; jquery_js])
(body (thebody @ analytics))) in
- let txt = Xhtmlcompact_lite.xhtml_print ~version:`HTML_v04_01 ~html_compat:true html
+ let txt = Xhtmlcompact.xhtml_print ~version:`HTML_v04_01 ~html_compat:true html
in return (txt, "text/html")
and render_link_aux ~link_attachment ~link_page href =
@@ -280,7 +280,7 @@ and render_node_for_rss ~sp node =
uri
end
(Node.markup node)
- in Xhtmlcompact_lite.xhtml_list_print ~html_compat:true (html_summary ~sp node html)
+ in Xhtmlcompact.xhtml_list_print ~html_compat:true (html_summary ~sp node html)
and html_summary ?(absolute = true) ~sp node l =
let rec loop acc = function
View
@@ -1,161 +0,0 @@
-(* Ocsigen
- * Copyright (C) 2008 Vincent Balat, Mauricio Fernandez
- * Laboratoire PPS - CNRS Université Paris Diderot
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, with linking exception;
- * either version 2.1 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 XML
-
-module B = Buffer
-
-let mem_func l =
- let h = Hashtbl.create (List.length l) in
- List.iter (fun x -> Hashtbl.add h x true) l;
- fun x -> Hashtbl.mem h x
-
-(* as per XHTML 1.0, appendix C.8; name attr deprecated in 1.1 *)
-let need_name = ["a"; "applet"; "form"; "frame"; "iframe"; "img"; "map"]
-let needs_id2name = mem_func need_name
-
-let emptytags = ["hr"; "br"; "img"; "meta"; "link"; "input";
- "col"; "area"; "param"; "base"; "basefont";
- "isindex"; "frame"]
-let is_emptytag = mem_func emptytags
-
-(* FIXME: ugly & unsafe. XML.attrib is abstract, so we copy the definition and
- * use Obj.magic*)
-type attrib =
- | AInt of aname * int
- | AStr of aname * string
- | AStrL of separator * aname * string list
-
-let x_print, xh_print =
-
- let aux b ~encode ?(html_compat = false) doctype arbre =
- let endemptytag = if html_compat then ">" else " />" in
- let rec xh_print_attrs doid2name encode attrs = match attrs with
- [] -> ();
- | attr::queue ->
- B.add_char b ' ';
- B.add_string b (XML.attrib_to_string encode attr);
- (* FIXME: report to ocsigen devels, need means to operate on attrib *)
- if doid2name then begin match (Obj.magic attr : attrib) with
- AStr ("id", id) ->
- B.add_char b ' ';
- B.add_string b (XML.attrib_to_string encode (string_attrib "name" id))
- | _ -> ()
- end;
- xh_print_attrs doid2name encode queue
-
- and xh_print_closedtag encode tag attrs =
- if html_compat && not (is_emptytag tag) then begin
- B.add_char b '<';
- B.add_string b tag;
- xh_print_attrs (html_compat && needs_id2name tag) encode attrs;
- B.add_string b "></";
- B.add_string b tag;
- B.add_string b ">"
- end else begin
- B.add_char b '<';
- B.add_string b tag;
- xh_print_attrs (html_compat && needs_id2name tag) encode attrs;
- B.add_string b endemptytag;
- end
-
- and xh_print_tag encode tag attrs taglist =
- if taglist = []
- then xh_print_closedtag encode tag attrs
- else begin
- B.add_string b ("<" ^ tag);
- xh_print_attrs (html_compat && needs_id2name tag) encode attrs;
- B.add_char b '>';
- xh_print_taglist taglist;
- B.add_string b ("</" ^ tag);
- B.add_char b '>';
- end
-
- and print_nodes name xh_attrs xh_taglist queue =
- xh_print_tag encode name xh_attrs xh_taglist;
- xh_print_taglist queue
-
- and xh_print_taglist taglist =
- match taglist with
-
- | [] -> ()
-
- | (Comment texte)::queue ->
- (* REVIEW: strip comments? *)
- Buffer.add_string b "<!--";
- Buffer.add_string b (encode texte);
- Buffer.add_string b "-->";
- xh_print_taglist queue;
-
- | (Entity e)::queue ->
- B.add_string b ("&"^e^";"); (* no encoding *)
- xh_print_taglist queue;
-
- | (PCDATA texte)::queue ->
- B.add_string b (encode texte);
- xh_print_taglist queue;
-
- | (EncodedPCDATA texte)::queue ->
- B.add_string b texte;
- xh_print_taglist queue;
-
- (* Nodes and Leafs *)
- | (Element (name, xh_attrs, xh_taglist))::queue
- | (BlockElement (name, xh_attrs, xh_taglist))::queue
- | (SemiBlockElement (name, xh_attrs, xh_taglist))::queue
- | (Node (name, xh_attrs, xh_taglist))::queue ->
- print_nodes name xh_attrs xh_taglist queue
-
- | (Leaf (name,xh_attrs))::queue ->
- print_nodes name xh_attrs [] queue
-
- (* Whitespaces *)
- | (Whitespace(texte))::queue ->
- B.add_string b (encode texte);
- xh_print_taglist queue
-
- | Empty::queue ->
- xh_print_taglist queue
-
- in
- xh_print_taglist [arbre]
- in
- ((fun ?header ?(encode = encode_unsafe) ?html_compat doctype foret ->
- let b = B.create 16384 in
- (match header with Some s -> B.add_string b s | None -> ());
- List.iter (aux b ?encode ?html_compat doctype) foret;
- B.contents b),
-
- (fun ?header ?(encode = encode_unsafe) ?html_compat doctype arbre ->
- let b = B.create 16384 in
- (match header with Some s -> B.add_string b s | None -> ());
- B.add_string b doctype;
- aux b ?encode ?html_compat doctype arbre;
- B.contents b))
-
-
-let xhtml_print ?(header = "") ?(version=`XHTML_01_01) ?encode ?html_compat arbre =
- xh_print ~header ?encode ?html_compat
- (XHTML.M.doctype version) (XHTML.M.toelt arbre)
-
-let xhtml_list_print ?(header = "") ?(version=`XHTML_01_01)
- ?encode ?html_compat foret =
- x_print ~header ?encode ?html_compat
- (XHTML.M.doctype version) (XHTML.M.toeltl foret)
-
View
@@ -1,40 +0,0 @@
-(* Ocsigen
- * Copyright (C) 2005 Vincent Balat
- * Laboratoire PPS - CNRS Université Paris Diderot
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, with linking exception;
- * either version 2.1 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 Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- *)
-
-(** XHTML "compact printing" (no pretty printing, no line breaks added) *)
-
-(** Ocsigen's compact printer for xhtml. [html_compat] is an option to set
- if you want to print with a syntax closer to html (not xml).
- *)
-val xhtml_print :
- ?header:string ->
- ?version:[< `HTML_v03_02 | `HTML_v04_01 | `XHTML_01_00 | `XHTML_01_01 > `XHTML_01_01 ] ->
- ?encode:(string -> string) ->
- ?html_compat:bool ->
- [ `Html ] XHTML.M.elt -> string
-
-(** Ocsigen's compact printer for xhtml portions.
- [html_compat] is an option to set
- if you want to print with a syntax closer to html (not xml). *)
-val xhtml_list_print :
- ?header:string ->
- ?version:[< `HTML_v03_02 | `HTML_v04_01 | `XHTML_01_00 | `XHTML_01_01 > `XHTML_01_01 ] ->
- ?encode:(string -> string) ->
- ?html_compat:bool ->
- 'a XHTML.M.elt list -> string

0 comments on commit 0892aa3

Please sign in to comment.