Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 5ec0f776b44a1672ff2bf95dc2ffc2dbb4f51a61 1 parent 2a0e8bb
Cédric Soulas authored February 15, 2012

Showing 1 changed file with 12 additions and 8 deletions. Show diff stats Hide diff stats

  1. 20  opalang/opaPrint.ml
20  opalang/opaPrint.ml
@@ -458,14 +458,18 @@ module Sugar = struct
458 458
 
459 459
     let pp_dst original_name ppe e =
460 460
       match clear_directives e with
461  
-      | Apply((Ident(id),_),([_,e],_)),_  ->
462  
-        let op = match original_name id with
463  
-          | "Dom_select_id" -> "#"
464  
-          | "Dom_select_class" -> "."
465  
-          | _ ->  raise Fallback
466  
-        in
467  
-        fun f () ->
468  
-          pp f "%s%a" op (String.pp_expr_or_string ~quote:false ppe) e
  461
+      | Apply((Ident(id),_),([_,e],_)),_  -> (
  462
+          let op = match original_name id with
  463
+            | "Dom_select_id" -> "#"
  464
+            | "Dom_select_class" -> "."
  465
+            | _ ->  raise Fallback
  466
+          in
  467
+          fun f () -> (
  468
+            match fst e with
  469
+            | Directive(`string,l,_) -> pp f "%s{%a}" op (String.pp_expr ppe) l
  470
+            | _ ->  pp f "%s%a" op (String.pp_expr_or_string ~quote:false ppe) e
  471
+          )
  472
+        )
469 473
       | _ -> raise Fallback
470 474
 
471 475
     let str s f () = pp f "%s" s

0 notes on commit 5ec0f77

Please sign in to comment.
Something went wrong with that request. Please try again.