Nleyten

To content | To menu | To search

Tag - ocsigen

Entries feed

Tuesday 19 August 2014

Announcing Camlhighlight 3.0

I'm happy to announce release 3.0 of Camlhighlight, a library offering syntax highlighting and pretty-printing facilities for displaying code samples in Ocsigen applications. The library works by interfacing with the library portion of GNU Source-highlight, a popular application supporting the most common programming and markup languages.

This version features a smaller dependency set, now requiring Tyxml instead of forcing a dependency on Eliom. However, full compatibility with Eliom applications is maintained. The functorial interface used seems hairy at first glance, but it's actually not that complicated in practice. As an example, if your application uses only Tyxml and you wish to write a syntax-highlighted sample as a Html5.elt, you will first need to apply the Camlhighlight_write_html5.Make functor using Tyxml's Html5 and Svg modules as parameter:

module Html5_writer = Camlhighlight_write_html5.Make
(struct
include Html5.M
module Svg = Svg.M
end)

Similarly, if you intend the Html5_writer module to be Eliom compatible, then use Eliom's Html5.F.Raw and Svg.F.Raw modules as parameter:

module Html5_writer = Camlhighlight_write_html5.Make
(struct
include Eliom_content.Html5.F.Raw
module Svg = Eliom_content.Svg.F.Raw
end)

The package should be hitting the OPAM repository soon. Eliom users should beware that Camlhighlight requires Tyxml >= 3.2, whereas Eliom 4.0.0 requires Tyxml < 3.2. Therefore, should you want to use Camlhighlight in an Eliom application, you are advised to install the development version of Eliom (please see the Ocsigen site for instructions regarding Ocsigen's development repo for OPAM).

Tuesday 27 May 2014

Announcing Litiom 3.0

I'm happy to announce the release 3.0 of Litiom, a small library aiming to complement Eliom, the web programming framework part of the Ocsigen project. Litiom is basically a collection of modules offering high-level constructs for Web programming.

Along with some minor adjustments so that Litiom works with the newly release Eliom 4.0, Litiom 3.0 takes advantage of the bump in major version number to make a long sought reorganisation of the API. Yes, this means that Litiom 3.0 is not backwards-compatible with Litiom 2.1. On the bright side, porting code using the old Litiom to the new one is mostly a matter of search & replace, and should not require any major refactoring. Here's the changelog:

  • Split off choose related code into Litiom_choice module. As a consequence, functors and interfaces have been renamed.
  • In CHOOSABLE signature, rename elems to all for compatibility with Jane Street's Enumerate syntax extension.
  • Function choose now accepts transform optional function as parameter (defaults to String.Capitalize).
  • List of elements now of type t list (may be empty) instead of t * t list. Accordingly, parameter allowed in function choose is now also of type t list. (The function will raise Invalid_argument if provided with an empty list, however).
  • Check for value only once in function choose.
  • Select now takes required optional parameter, in track with changes in Eliom 4.0.

If you're porting code from Litiom 2.1 to 3.0 and you've never used the choose related code, then you'll just have to rename some modules/signatures/functors. For instance, signature Litiom_type.SIMPLE_BASE is now called Litiom_type.STRINGABLE, and functor Litiom_type.Make_simple is now just Litiom_type.Make. If on the other hand you used choose facilities, bear in mind that those have moved into their own Litiom_choice module. Therefore, the old functor Litiom_type.Make_choice is now Litiom_choice.Make.

The API documentation is available online, and includes some concrete examples to get you up-to-speed. Also, the package is already available in OPAM. Happy hacking!