package ppx_dream_eml
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ff3c93a02b418ae319918c0629dcb21f
sha512=503ef7735fe4421ea234b7d7d57845cbf3e016cb6f29838edad162c96fefdaac6512a1da34cfd0a432638171eba10dc6f556edaf8a610ffaf45fc73646592814
Description
ppx_dream_eml allows processing Dream's Embedded ML syntax inline without the need to create dune directives and separate files.
README
ppx_dream_eml
A very straightforward extension that allows you to write Dream's .eml templates directly in your OCaml code without the need to add directives to dune.
This also has the benefit of playing nice with your syntax highlighting and code editor, since the code produced will be valid OCaml.
The processing code is lifted directly from the Dream repository.
Usage
Add the ppx to your dune file:
...
(preprocess (pps ... ppx_dream_eml))
...
And then use the eml
extension in your OCaml code and write .eml templates as you normally would, except put the template part inside the extension:
let render message = {%eml|
<html>
<body>
<p>The message is <b><%s message %></b>!</p>
</body>
</html>
|}
Known issues
Errors won't quite map to the right places in your eml. Could perhaps be fixed with a more complicated implementation.