Handles inside Markdown, inside Haml

I know this is a very non-standard use case, but I am hooking on HAML, Markdown and Handlebars (in SproutCore 2.0), and I am 1 step away from the “beautiful” code. Blending HAML, Markdown, and Javascript is less ideal than it could be. If I wanted to add a post filter for all HAML output, replacing {{text}} with <script>{{text}}</script> , what would be the best way to do this?

I could just hack the post-build step after haml , but I would like to turn it into something that I can return to the SproutCore community.

I want to replace

 %body javascript: {{handlebars}} 

FROM

 %body {{handlebars}} 

Who would give me

 <body> <script>{{handlebars}}</script> </body> 

However, I also want this to work when it is embedded in markdowns. For example,

 %body markdown: # Hello, {{handlebars}} 

Currently, the only way to get this is

 %body markdown: # Hello, <script>{{handlebars}}</script> 

Which product

 <body> <h1>Hello, <script>{{handlebars}}</script></h1> </body> 
+8
markdown mustache haml
source share
1 answer

Re-examining the same problem much, much later, it seems that with HAML there is no good solution for this. However, Jade does almost everything I want.

http://jade-lang.com/

Enter

 html script(type='text/x-handlebars') :markdown *Hello, {{handlebars}}!* 

Exit

 <html> <script type="text/x-handlebars"><p><em>Hello, {{handlebars}}!</em></p> </script> </html> 
0
source share

All Articles