[more updates to jmacro section Jeremy Shaw **20110519215536 Ignore-this: 620b3630e43d4cbbc56afd29f2c32e4a ] hunk ./JMacro.markdown.lhs 13 -hsx-jmacro and happstack-jmacro packages. +hsx-jmacro and happstack-jmacro packages. You will also need to be sure that your version of happstack-hsp is >= 6.1.0. hunk ./JMacro.markdown.lhs 48 -pre-processor. The following line will automatically run the +pre-processor. (A crash course section on HSX itself will be coming soon). The following line will automatically run the hunk ./JMacro.markdown.lhs 75 +> hunk ./JMacro.markdown.lhs 86 - +> hunk ./JMacro.markdown.lhs 89 +> hunk ./JMacro.markdown.lhs 108 +> hunk ./JMacro.markdown.lhs 126 +> hunk ./JMacro.markdown.lhs 141 -> toResponse <$> defaultTemplate "Hello JMacro" () ->

!") |]>Click me!

+> toResponse <$> defaultTemplate "Hello Attr" () +>

!") |]>Click me!

+> hunk ./JMacro.markdown.lhs 147 -onclick handler. It is taken care of for us automatically! +onclick handler. It is taken care of for us automatically! The code automatically get's escaped as: + +
+
onclick="alert(&quot;that &lt;/tickles&gt;!&quot;);"
+
+ +According to the spec +it is invalid for <script> tag. + +The JMacro embedding also takes care of handling + +> helloEndTag :: JMacroPart Response +> helloEndTag = +> toResponse <$> defaultTemplate "Hello End Tag" () +> <%> +>

Tricky End Tag

+> <% [$jmacro| alert("this won't mess things up!") |] %> +> +> + + + +And it will generate: + +
+
<script type="text/javascript">alert("this <\/script> won't mess things up!");</script>
+
hunk ./JMacro.markdown.lhs 200 +> hunk ./JMacro.markdown.lhs 223 +> hunk ./JMacro.markdown.lhs 270 +> hunk ./JMacro.markdown.lhs 303 +> hunk ./JMacro.markdown.lhs 338 +> hunk ./JMacro.markdown.lhs 374 +> hunk ./JMacro.markdown.lhs 394 +> hunk ./JMacro.markdown.lhs 419 +> hunk ./JMacro.markdown.lhs 447 +> hunk ./JMacro.markdown.lhs 461 +>
  • Hello, End Tag
  • hunk ./JMacro.markdown.lhs 468 +> hunk ./JMacro.markdown.lhs 478 +> , dir "endTag" $ helloEndTag hunk ./JMacro.markdown.lhs 486 +> hunk ./JMacro.markdown.lhs 490 +

    [Source code for these demos is here.]

    + hunk ./JMacro.markdown.lhs 506 +

    More Information

    + +For more information on using JMacro I recommend reading this wiki page and the tutorial at the top of Language.Javascript.JMacro. +