Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Let the compiler infer the type of the (X)HTML output for the entries.

  • Loading branch information...
commit e5048a971f3e4289855214418338ac032f11ea4c 1 parent 298c05b
@mfp authored
View
42 catalog.ml
@@ -4,28 +4,28 @@ open ExtString
module type ENTRY =
sig
- type entry
+ type 'a entry
type sort_criterion
- val name : entry -> string
- val tags : entry -> string list
- val deps : entry -> string list
- val signal_deps_changed : entry -> unit
+ val name : _ entry -> string
+ val tags : _ entry -> string list
+ val deps : _ entry -> string list
+ val signal_deps_changed : _ entry -> unit
val compare :
- ?secondary : sort_criterion list -> sort_criterion -> entry -> entry -> int
+ ?secondary : sort_criterion list -> sort_criterion -> 'a entry -> 'a entry -> int
end
module type S =
sig
- type entry
+ type 'a entry
type sort_criterion
- type t
- val refresh : t -> unit
- val entries : t -> entry list
+ type 'a t
+ val refresh : _ t -> unit
+ val entries : 'a t -> 'a entry list
val sorted_entries :
?reverse : bool ->
- ?secondary : sort_criterion list -> sort_criterion -> t -> entry list
- val get_entry : t -> string -> entry option
- val has_entry : t -> string -> bool
+ ?secondary : sort_criterion list -> sort_criterion -> 'a t -> 'a entry list
+ val get_entry : 'a t -> string -> 'a entry option
+ val has_entry : _ t -> string -> bool
end
let compare_by_criteria basic_comparison ?(extra = []) crit =
@@ -44,29 +44,29 @@ let dir_filter_map f dir =
module Make(Entry : sig
include ENTRY
- val make : name:string -> file:string -> entry
+ val make : name:string -> file:string -> 'a entry
end)
: sig
- include S with type entry = Entry.entry
+ include S with type 'a entry = 'a Entry.entry
and type sort_criterion = Entry.sort_criterion
- val make : string -> t
+ val make : string -> 'a t
end =
struct
module M = Map.Make(String)
module S = Set.Make(String)
- type entry = Entry.entry
+ type 'a entry = 'a Entry.entry
type sort_criterion = Entry.sort_criterion
- type t = {
+ type 'a t = {
basedir : string;
- mutable entries : entry_info M.t;
+ mutable entries : 'a entry_info M.t;
}
- and entry_info = {
+ and 'a entry_info = {
e_time : float;
e_name : string;
- e_data : entry;
+ e_data : 'a entry;
}
let (/^) = Filename.concat
View
4 node.ml
@@ -4,12 +4,12 @@ open Printf
module S = Set.Make(String)
-type entry = {
+type 'html entry = {
name : string;
title : string;
date : float;
markup : Simple_markup.paragraph list;
- mutable html : Simple_markup__html.html_output XHTML.M.elt list option;
+ mutable html : 'html XHTML.M.elt list option;
deps : string list Lazy.t;
tags : string list;
syndicated : bool;
View
17 node.mli
@@ -3,16 +3,15 @@ include Catalog.ENTRY with type sort_criterion = [ `Date | `Title ]
val split_headers_body : string -> (string * string) list * string list
-val make : name:string -> file:string -> entry
-val date : entry -> float
-val markup : entry -> Simple_markup.paragraph list
-val syndicated : entry -> bool
-val allow_comments : entry -> bool
-val title : entry -> string
+val make : name:string -> file:string -> 'html entry
+val date : _ entry -> float
+val markup : _ entry -> Simple_markup.paragraph list
+val syndicated : _ entry -> bool
+val allow_comments : _ entry -> bool
+val title : _ entry -> string
val get_html :
- (Simple_markup.paragraph list ->
- Simple_markup__html.html_output XHTML.M.elt list) ->
- entry -> Simple_markup__html.html_output XHTML.M.elt list
+ (Simple_markup.paragraph list -> 'html XHTML.M.elt list) ->
+ 'html entry -> 'html XHTML.M.elt list
val is_inner_link : string -> bool
View
1  ocsiblog.mli
@@ -0,0 +1 @@
+(* No functionality exported by the Ocsiblog module *)
View
8 simple_markup__html.ml
@@ -3,11 +3,6 @@
open Simple_markup
open XHTML.M
-type html_output =
- [`Address | `Blockquote | `Del | `Div | `Dl | `Fieldset
- | `Form | `H1 | `H2 | `H3 | `H4 | `H5 | `H6 | `Hr | `Ins
- | `Noscript | `Ol | `P | `Pre | `Script | `Table | `Ul ]
-
let rec elm_to_html ~render_pre ~render_link ~render_img elm =
let self = elm_to_html ~render_pre ~render_link ~render_img in
let item l = li (List.map self l)
@@ -50,6 +45,5 @@ and text_to_html ~render_link ~render_img = function
end
| Image href -> render_img href
-let to_html ~render_pre ~render_link ~render_img l :
- [> html_output] XHTML.M.elt list =
+let to_html ~render_pre ~render_link ~render_img l =
List.map (elm_to_html ~render_pre ~render_link ~render_img) l
Please sign in to comment.
Something went wrong with that request. Please try again.