From 6db5672ac506b535728d700d9069a586d122a4cd Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Thu, 7 Jun 2012 13:42:46 -0600 Subject: [PATCH] Fixes PR12767 --- .../scribblings/tutorial/continue.scrbl | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/collects/web-server/scribblings/tutorial/continue.scrbl b/collects/web-server/scribblings/tutorial/continue.scrbl index 1b4c629226..029ccc24c3 100644 --- a/collects/web-server/scribblings/tutorial/continue.scrbl +++ b/collects/web-server/scribblings/tutorial/continue.scrbl @@ -214,22 +214,24 @@ another list that acts as a template. For example, given the list of @|xexpr|s @racket['((li "Larry") (li "Curly") (li "Moe"))], we may want to create the single @|xexpr| -@racket['(ul (li "Larry") - (li "Curly") - (li "Moe"))] +@racketblock[ +'(ul (li "Larry") + (li "Curly") + (li "Moe")) +] -This can't be done using plain unquoting, because placing a comma in front of -@racket['("Larry" "Curly" "Moe")] will unquote the entire list, yielding -the malformed expression @racket['(ul ((li "Larry") (li "Curly") (li +This can't be done using plain unquoting, because placing a comma in +front of @racket['((li "Larry") (li "Curly") (li "Moe"))] will unquote +the entire list, yielding the malformed expression +@racket['(ul ((li "Larry") (li "Curly") (li "Moe")))]. Instead, we must splice the list in, like so: @racket[`(ul ,@((li "Larry") (li "Curly") (li "Moe")))]. The unquote-splicing form, @racket[,@expression], allows us conveniently to splice a list of @|xexpr| fragments into a -larger template list. To generalize -the example, here are two helper functions that convert any list of -@|xexpr|s into one -@|xexpr| representing an unordered, itemized HTML list: +larger template list. To generalize the example, here are two helper +functions that convert any list of @|xexpr|s into one @|xexpr| +representing an unordered, itemized HTML list: @racketblock[ @code:comment{render-as-itemized-list: (listof xexpr) -> xexpr} @@ -273,8 +275,8 @@ should produce @racketblock[ '(div ((class "posts")) - (div ((class "post")) "Post 1" "Body 1") - (div ((class "post")) "Post 2" "Body 2")) + (div ((class "post")) "Post 1" (p "Body 1")) + (div ((class "post")) "Post 2" (p "Body 2"))) ] @centerline{------------}