Permalink
Browse files

[fix] OpaPrint: braces required in case of `string for dom actions

  • Loading branch information...
1 parent 2a0e8bb commit 5ec0f776b44a1672ff2bf95dc2ffc2dbb4f51a61 @cedricss cedricss committed Feb 15, 2012
Showing with 12 additions and 8 deletions.
  1. +12 −8 opalang/opaPrint.ml
View
@@ -458,14 +458,18 @@ module Sugar = struct
let pp_dst original_name ppe e =
match clear_directives e with
- | Apply((Ident(id),_),([_,e],_)),_ ->
- let op = match original_name id with
- | "Dom_select_id" -> "#"
- | "Dom_select_class" -> "."
- | _ -> raise Fallback
- in
- fun f () ->
- pp f "%s%a" op (String.pp_expr_or_string ~quote:false ppe) e
+ | Apply((Ident(id),_),([_,e],_)),_ -> (
+ let op = match original_name id with
+ | "Dom_select_id" -> "#"
+ | "Dom_select_class" -> "."
+ | _ -> raise Fallback
+ in
+ fun f () -> (
+ match fst e with
+ | Directive(`string,l,_) -> pp f "%s{%a}" op (String.pp_expr ppe) l
+ | _ -> pp f "%s%a" op (String.pp_expr_or_string ~quote:false ppe) e
+ )
+ )
| _ -> raise Fallback
let str s f () = pp f "%s" s

0 comments on commit 5ec0f77

Please sign in to comment.