Skip to content

Commit ec52dff

Browse files
committed
Add conditional simplification for markup_to_expr.
1 parent 4c524a0 commit ec52dff

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ppx/ppx_tyxml.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ let context_of_lang = function
278278
(** Given the payload of a [%html ...] or [%svg ...] expression,
279279
converts it to a TyXML expression representing the markup
280280
contained therein. *)
281-
let markup_to_expr lang loc expr =
281+
let markup_to_expr ?(simplify=true) lang loc expr =
282282
let context = context_of_lang lang in
283283

284284
let input_stream, adjust_location = ast_to_stream expr in
@@ -331,7 +331,7 @@ let markup_to_expr lang loc expr =
331331
in
332332

333333
match l with
334-
| [ Val x | Antiquot x ] -> x
334+
| [ Val x | Antiquot x ] when simplify -> x
335335
| l -> Ppx_common.list_wrap_value lang loc l
336336

337337
let markup_to_expr_with_implementation lang modname loc expr =

ppx/ppx_tyxml.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*)
2626

2727
val markup_to_expr :
28+
?simplify:bool ->
2829
Ppx_common.lang ->
2930
Location.t -> Parsetree.expression list -> Parsetree.expression
3031
(** Given the payload of a [%html ...] or [%svg ...] expression,

0 commit comments

Comments
 (0)