package tyxml-ppx

  1. Overview
  2. Docs
PPX to write TyXML documents with the HTML syntax

Install

dune-project
 Dependency

Authors

Maintainers

Sources

tyxml-4.5.0.tbz
sha256=c69accef5df4dd89d38f6aa0baad01e8fda4e9e98bb7dad61bec1452c5716068
sha512=772535441b09c393d53c27152e65f404a0a541aa0cea1bda899a8d751ab64d1729237e583618c3ff33d75e3865d53503d1ea413c6bbc8c68c413347efd1709b3

doc/src/tyxml_ppx_register/tyxml_ppx_register.ml.html

Source file tyxml_ppx_register.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
open Ppxlib

let str_item_expansion name lang =
  Extension.declare_with_path_arg
    name
    Extension.Context.structure_item
    Ast_pattern.(pstr ((pstr_value __ __) ^:: nil))
    (Tyxml_ppx.expand_str_item ~lang)

let expr_expansion name lang =
  Extension.declare_with_path_arg
    name
    Extension.Context.expression
    Ast_pattern.(pstr ((pstr_eval __ __) ^:: nil))
    (Tyxml_ppx.expand_expr ~lang)

let () =
  let extensions = [
    expr_expansion "tyxml.html" Html;
    expr_expansion "tyxml.svg" Svg;
    str_item_expansion "tyxml.html" Html;
    str_item_expansion "tyxml.svg" Svg;
  ]
  in    
  Ppxlib.Driver.register_transformation ~extensions "tyxml"