Skip to content

skydeck/insideout

Repository files navigation

insideout

Description

Convert a template into an OCaml function with labelled arguments.

This is a camlp4-free replacement of the "interpolate file" feature of xstrp4.

Hello ${name}

becomes:

let gen ~name = "Hello " ^ name

Use a backslash character to escape $ or \ itself (\${x} gives ${x}).

Printf formatting:

${x %f}

(formats the argument x using Printf.sprintf "%f" x)

File inclusion (as-is, no escaping, no substitutions):

${@foo/bar}

(includes the contents of file foo/bar)

Default values (useful for previews or suggested usage):

${title:Here goes the title}

Use insideout -help to see the command-line options.

Installation

(requires a standard OCaml installation)

$ make
$ make install

Example

See file example.html and run demo with:

$ make demo

TODO

  • add support for search path for included files
  • support inclusion of templates (as opposed to verbatim inclusion already supported)

About

Minimalistic template processing for OCaml

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages