Skip to content

Commit e302d3c

Browse files
committed
Add conditional simplification for markup_to_expr.
1 parent f49d79a commit e302d3c

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
@@ -218,7 +218,7 @@ let context_of_lang = function
218218
(** Given the payload of a [%html ...] or [%svg ...] expression,
219219
converts it to a TyXML expression representing the markup
220220
contained therein. *)
221-
let markup_to_expr lang loc expr =
221+
let markup_to_expr ?(simplify=true) lang loc expr =
222222
let context = context_of_lang lang in
223223

224224
let input_stream, adjust_location = ast_to_stream expr in
@@ -270,7 +270,7 @@ let markup_to_expr lang loc expr =
270270
in
271271

272272
match l with
273-
| [ Val x | Antiquot x ] -> x
273+
| [ Val x | Antiquot x ] when simplify -> x
274274
| l -> Ppx_common.list_wrap_value lang loc l
275275

276276
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)