Skip to content

Commit

Permalink
remove dead code from Pages and rationalize columns
Browse files Browse the repository at this point in the history
  • Loading branch information
avsm committed Dec 21, 2013
1 parent dd0323a commit fbcb0f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 77 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -9,3 +9,5 @@ src/static_files.ml
src/static_files.mli
src/static_tmpl.ml
src/static_tmpl.mli
*.bak
*.img
85 changes: 8 additions & 77 deletions src/pages.ml
Expand Up @@ -17,24 +17,11 @@ let read_file tmpl_read f =
printf "Pages.read_file: exception %s\n%!" (Printexc.to_string exn);
exit 1

let col_files l r = <:xml<
<div class="left_column">
<div class="summary_information"> $l$ </div>
let two_cols l r = <:html<
<div class="row">
<div class="large-6 columns">$l$</div>
<div class="large-6 columns">$r$</div>
</div>
<div class="right_column"> $r$ </div>
>>

let column_css = <:css<
/* Column Styling */
.left_column {
float: left;
width: 475px;
text-align: justify;
}
.right_column {
float: right;
width: 475px;
}
>>

let none : Html.t = []
Expand Down Expand Up @@ -63,12 +50,8 @@ end
module Index = struct

let body read_fn =
lwt l1 =
read_file read_fn "/intro.md"
>|= (fun l -> col_files l none) in
lwt l2 =
read_file read_fn "/intro-r.html"
>|= (fun l -> col_files l none) in
lwt l1 = read_file read_fn "/intro.md" in
lwt l2 = read_file read_fn "/intro-r.html" in
return (<:xml<
<div class="row">
<div class="large-6 columns">$l1$</div>
Expand All @@ -83,11 +66,10 @@ module Index = struct

end


module Resources = struct
let body read_fn =
read_file read_fn "/docs.md"
>|= (fun l -> col_files l Paper.html)
>|= (fun l -> two_cols l Paper.html)

let t read_fn =
Template.t read_fn "Resources" "resources" (body read_fn)
Expand All @@ -99,64 +81,13 @@ module About = struct
let body read_fn =
lwt l = read_file read_fn "/about.md" in
lwt r = read_file read_fn "/about-r.md" in
return (col_files l r)
return (two_cols l r)

let t read_fn =
Template.t read_fn "About" "about" (body read_fn)
>|= Html.to_string
end

(*
module Blog = struct
open Blog
(* Make a full Html.t including RSS link and headers from a list
of Html.t entry fragments *)
let make ?title body read_fn =
let url = sprintf "/blog/atom.xml" in
let extra_header = <:xml<
<link rel="alternate" type="application/atom+xml" href=$str:url$ />
>> in
let title = "blog" ^ match title with None -> "" | Some x -> " :: " ^ x in
lwt html = Template.t read_fn ~extra_header "Blog" title body in
return (Html.to_string html)
(* Main blog page Html.t fragment with all blog posts *)
let main_page (read_fn:string -> string Lwt.t) =
make (Blog.html_of_entries (read_file read_fn) Blog.entries) read_fn
let init read_fn =
let ent_bodies = Hashtbl.create 1 in
List.iter (fun entry ->
let title = entry.subject in
let body = Blog.html_of_entries ~disqus:entry.permalink
(read_file read_fn) [entry] in
Hashtbl.add ent_bodies entry.permalink (make ~title body read_fn);
) Blog.entries;
ent_bodies
let atom_feed read_fn =
lwt f = Blog.atom_feed (read_file read_fn) Blog.entries in
return (Xml.to_string (Atom.xml_of_feed ~self:("/blog/atom.xml") f))
let not_found ent_bodies x =
return (sprintf "Not found: %s (known links: %s)"
(String.concat " ... " x)
(String.concat " "
(Hashtbl.fold (fun k v a -> k :: a)
ent_bodies [])))
let content_type_xhtml = ["content-type", "text/html"]
let t ent_bodies read_fn =
function
| [] -> content_type_xhtml, (main_page read_fn)
| ["atom.xml"] -> ["content-type","application/atom+xml; charset=UTF-8"], (atom_feed read_fn)
| [x] when permalink_exists x -> content_type_xhtml, (Hashtbl.find ent_bodies x)
| x -> content_type_xhtml, (not_found ent_bodies x)
end
*)
module Wiki = struct
open Wiki

Expand Down

0 comments on commit fbcb0f4

Please sign in to comment.