Commit e209f783 authored by Dario Pinto's avatar Dario Pinto
Browse files

apply reviews, add Atom::feed::entry fields, fix some bugs and HTML layout

parent ccde0fa5
opam-version: "2.0"
name: "ocpsite"
version: "~dev"
license: "ISC"
depends: [
"angstrom" {= "0.15.0"}
"base-bigarray" {= "base"}
"base-bytes" {= "base"}
"base-threads" {= "base"}
"base-unix" {= "base"}
"base64" {= "3.5.0"}
"bigarray-compat" {= "1.0.0"}
"bigarray-overlap" {= "0.2.0"}
"bigstringaf" {= "0.8.0"}
"biniou" {= "1.2.1"}
"caqti" {= "1.6.0"}
"caqti-lwt" {= "1.6.0"}
"cmdliner" {= "1.0.4"}
"conf-libev" {= "4-12"}
"conf-libssl" {= "3"}
"conf-pkg-config" {= "2"}
"cppo" {= "1.6.7"}
"crunch" {= "3.2.0"}
"csexp" {= "1.5.1"}
"cstruct" {= "6.0.1"}
"digestif" {= "1.0.1"}
"dream" {= "1.0.0~alpha2"}
"dune" {= "2.9.1"}
"dune-configurator" {= "2.9.1"}
"duration" {= "0.2.0"}
"easy-format" {= "1.3.2"}
"eqaf" {= "0.8"}
"faraday" {= "0.8.1"}
"faraday-lwt" {= "0.8.1"}
"faraday-lwt-unix" {= "0.8.1"}
"fmt" {= "0.8.9"}
"graphql" {= "0.13.0"}
"graphql-lwt" {= "0.13.0"}
"graphql_parser" {= "0.13.0"}
"hmap" {= "0.8.1"}
"ke" {= "0.4"}
"lambdasoup" {= "0.7.2"}
"logs" {= "0.7.0"}
"lwt" {= "5.4.2"}
"lwt_ppx" {= "2.0.2"}
"lwt_ssl" {= "1.1.3"}
"magic-mime" {= "1.2.0"}
"markup" {= "1.0.2"}
"menhir" {= "20210419"}
"menhirLib" {= "20210419"}
"menhirSdk" {= "20210419"}
"mirage-crypto" {= "0.10.3"}
"mirage-crypto-rng" {= "0.10.3"}
"mmap" {= "1.1.0"}
"mtime" {= "1.2.0"}
"multipart_form" {= "0.3.0"}
"ocaml" {= "4.12.1"}
"ocaml-compiler-libs" {= "v0.12.4"}
"ocaml-config" {= "2"}
"ocaml-syntax-shims" {= "1.0.0"}
"ocamlbuild" {= "0.14.0"}
"ocamlfind" {= "1.9.1"}
"ocplib-endian" {= "1.1"}
"omd" {= "2.0.0~alpha2"}
"pecu" {= "0.6"}
"ppx_derivers" {= "1.2.1"}
"ppxlib" {= "0.23.0"}
"prettym" {= "0.0.1"}
"psq" {= "0.2.0"}
"ptime" {= "0.8.5"}
"re" {= "1.10.3"}
"result" {= "1.5"}
"rresult" {= "0.6.0"}
"seq" {= "base"}
"sexplib0" {= "v0.14.0"}
"ssl" {= "0.5.10"}
"stdlib-shims" {= "0.3.0"}
"stringext" {= "1.6.0"}
"topkg" {= "1.0.3"}
"ubase" {= "0.04"}
"uchar" {= "0.0.2"}
"unstrctrd" {= "0.2"}
"uri" {= "4.2.0"}
"uutf" {= "1.0.2"}
"yojson" {= "1.7.0"}
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
\ No newline at end of file
......@@ -64,8 +64,8 @@ let rec handle_inline = function
| Code (_attr, s) -> s
| Hard_break _attr -> " "
| Soft_break _attr -> " "
| Link (_attr, attr_link) -> Option.value attr_link.title ~default:""
| Image (_attr, attr_link) -> Option.value attr_link.title ~default:""
| Link (_attr, attr_link) -> handle_inline attr_link.label
| Image (_attr, attr_link) -> handle_inline attr_link.label
| Html (_attr, str) -> handle_html str
let rec handle_block = function
......@@ -251,16 +251,16 @@ let categories_count =
let links_to_home_pages =
Format.sprintf
{|<div class="row">
<h5>
<a href="/blog">Home!</a>
</h5>
<h5>
<a href="/blog/category">All categories here!</a>
</h5>
</div>
<hr class="featurette-divider"/>
|}
{|
<div class="row">
<h5>
<a href="/blog">Home!</a>
</h5>
<h5>
<a href="/blog/category">All categories here!</a>
</h5>
</div>
<hr class="featurette-divider"/>|}
let pp_article_excerpt fmt article =
let year, month, day = article.date in
......@@ -288,9 +288,7 @@ let pp_article_excerpt fmt article =
</div>
</div>
<br />
%s <a href="/blog/%s">(Read more)</a>
<hr class="featurette-divider"/>
<br />|}
%s <a href="/blog/%s">(Read more)</a>|}
article.url article.title
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
......@@ -306,7 +304,12 @@ let pp_article_excerpt fmt article =
article.tags (preview article.content) article.url
let pp_blog_posts fmt articles_data_list =
List.iter (Format.fprintf fmt "%a" pp_article_excerpt) articles_data_list
Format.fprintf fmt "%a"
(Format.pp_print_list
~pp_sep:(fun fmt () ->
Format.fprintf fmt {|<hr class="featurette-divider" /><br />|} )
pp_article_excerpt )
articles_data_list
(** [specific_article_header title author (year, month, day) category tags]
prints the header for a given blog post *)
......@@ -333,8 +336,7 @@ let specific_article_header title authors (year, month, day) category tags =
</div>
<br />
<hr class="featurette-divider"/>
<br />
|}
<br />|}
title
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
......
title=News from May and June
authors=Çagdas Bozman
date=2013-07-1
date=2013-07-01
category=OCamlPro
tags=Compiler,Devleopment Tools,OCaml,OCamlPro,wxocaml
tags=Compiler,Development Tools,OCaml,OCamlPro,wxocaml
It is time to give a brief summary of our recent activities. As usual, our contributions were focused on three main objectives:
- make the OCaml compiler faster and easier to use;
......@@ -53,4 +53,4 @@ We are now preparing our next [OUPS](http://www.meetup.com/ocaml-paris/events/12
Not really related to OCaml, we also attend the [Teratec 2013 Forum](http://www.teratec.eu/gb/forum/index.html) which brings together a lot of [Scilab](http://www.scilab.org/) users. This is part of the [Richelieu](http://www.richelieu.pro) research project that [Michael](http://www.linkedin.com/profile/view?id=130990583) is working on: his goal is to analyze Scilab code, before just-in-time compilation. It requires a basic type-inference algorithm, but for a language that has not been designed for that ! He is currently struggling with the dynamic aspects of Scilab language. After some work on preprocessing `eval` and `evalstr` functions, he is now focusing on how Scilab programers usually write functions. He is currently using different kinds of analyses on real-world Scilab programs to understand how they are structured.
Finally, we are happy to announce that we finally found the time to release the [sources](https://github.com/OCamlPro/ocaml-cheat-sheets) of our OCaml [cheat-sheets](http://www.typerex.org/cheatsheets.html). Feel free to contribute by sending patches if you are interested to improve them!
\ No newline at end of file
Finally, we are happy to announce that we finally found the time to release the [sources](https://github.com/OCamlPro/ocaml-cheat-sheets) of our OCaml [cheat-sheets](http://www.typerex.org/cheatsheets.html). Feel free to contribute by sending patches if you are interested to improve them!
title=News from July
authors=Çagdas Bozman
date=2013-08-5
date=2013-08-05
category=OCamlPro
tags=editor,OCaml,OCamlPro,OCamlTop
......@@ -52,4 +52,4 @@ Meanwhile, most of my time last month has been spent preparing the next release
## Community
We are proud to be well represented at the [OCaml Developer Workshop 2013](http://ocaml.org/meetings/ocaml/2013/program.html). This year it happens in Boston, in September, co-located with the [Conference of Users of Functional Programming](http://cufp.org/conference/schedule/2013). Both conferences will contains a lot of OCaml-related talks: I am especially excited to hear about [PHP type-inference efforts](http://cufp.org/conference/schedule/2013) at Facebook using OCaml! If you are in the area around the 22/23 and 24 of September and you want to chat about OCamlPro and OCaml, we will be around!
\ No newline at end of file
We are proud to be well represented at the [OCaml Developer Workshop 2013](http://ocaml.org/meetings/ocaml/2013/program.html). This year it happens in Boston, in September, co-located with the [Conference of Users of Functional Programming](http://cufp.org/conference/schedule/2013). Both conferences will contains a lot of OCaml-related talks: I am especially excited to hear about [PHP type-inference efforts](http://cufp.org/conference/schedule/2013) at Facebook using OCaml! If you are in the area around the 22/23 and 24 of September and you want to chat about OCamlPro and OCaml, we will be around!
let t = Unix.localtime @@ Unix.gettimeofday ()
let date year month day hour min sec =
Format.sprintf "%d-%02d-%02dT%02d:%02d:%02dZ" year month day hour min sec
let date year month day time =
match time with
| Some (hour, min, sec) ->
Format.sprintf "%d-%02d-%02dT%02d:%02d:%02dZ" year month day hour min sec
| None -> Format.sprintf "%d-%02d-%02d" year month day
let author_fields fmt author =
Format.fprintf fmt
......@@ -21,46 +24,26 @@ let entry fmt article =
{|
<entry>
<title>%s</title>
<link rel="self" href="https://www.ocamlpro.com/blog/%s"/>
%a
<id>%s</id>
<link rel="alternate" href="https://www.ocamlpro.com/blog/%s"/>
<updated>%s</updated>
<summary>%s</summary>
<category>%s</category>
</entry>
|}
(Dream.html_escape article.title)
article.url
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt "@.")
author_fields )
article.authors (date y m d 0 0 0)
(Dream.html_escape (Blog.preview article.content))
article.category )
article
let most_recent_entry fmt article =
let open Blog in
Format.fprintf fmt {|%a|}
(fun fmt article ->
let y, m, d = article.date in
Format.fprintf fmt
{|
<entry>
<title>%s</title>
<link rel="self" href="https://www.ocamlpro.com/blog/%s"/>
<published>%s</published>
%a
<updated>%s</updated>
<summary>%s</summary>
<category>%s</category>
<content>%s</content>
</entry>
|}
(Dream.html_escape article.title)
article.url
(Dream.html_escape article.title)
article.url (date y m d None) (date y m d None)
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt "@.")
author_fields )
article.authors
(date y m d t.tm_hour t.tm_min t.tm_sec)
(Blog.preview article.content) )
(Dream.html_escape (Blog.preview article.content))
(Dream.html_escape article.content)
article.category )
article
let entries fmt articles =
......@@ -70,34 +53,32 @@ let entries fmt articles =
entry )
articles
let feed_head fmt feed_title =
let feed_head fmt () =
Format.fprintf fmt
{|
<title>%s</title>
<title>OCamlPro Feed</title>
<link rel="self" type="application/atom+xml" href="https://www.ocamlpro.com/blog/feed" />
<link href="https://www.ocamlpro.com/blog/feed"/>
<link href="https://www.ocamlpro.com/blog"/>
<link href="https://www.ocamlpro.com"/>
<updated>%s</updated>
<author>
<name>OCamlPro</name>
<email>contact@ocamlpro.com</email>
</author>
<rights>Copyright (c) 20112021 OCamlPro</rights>
<id>OCamlPro Atom Feed</id>
|}
feed_title
(date (1900 + t.tm_year) (1 + t.tm_mon) t.tm_mday t.tm_hour t.tm_min
t.tm_sec )
(date (1900 + t.tm_year) (1 + t.tm_mon) t.tm_mday
(Some (t.tm_hour, t.tm_min, t.tm_sec)) )
let generate =
let open Blog in
let articles_by_date = List.sort compare_articles articles_data in
let article = List.hd articles_by_date in
let articles = List.tl articles_by_date in
Format.asprintf
{|<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
%a
%a
%a
</feed>|}
feed_head "OCamlPro Feed" most_recent_entry article entries articles
feed_head () entries articles_by_date
......@@ -11,10 +11,7 @@ let blog_asset_loader _root path _request =
| None -> Dream.empty `Not_Found
| Some asset -> Dream.respond asset
let feed_loader _root path _loader =
match Content.read path with
| None -> Dream.respond Feed.generate
| Some feed -> Dream.respond feed
let feed_loader _root _path _loader = Dream.respond Feed.generate
let page path =
match Content.read (path ^ ".md") with
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment