Pitmairen/hamlish-jinja

is is possible to render raw html in a .haml file using hamlish-jinja?

Closed this issue · 2 comments

I'd like to occasionally be able to put some escaped content in, for example if I am copying an embed snippet of HTML from youtube. Is this possible?

It should be possible to just paste the html into the template like this:

%div#my-video
   <object style="height: 390px; width: 640px">
        <param name="movie" value="http://www.youtube.com/v/8BC6flTOGSk?version=3&feature=player_detailpage">
        <param name="allowFullScreen" value="true">
        <param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/8BC6flTOGSk?version=3&feature=player_detailpage" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360">
   </object>

If you want the output to be escaped, you could do:

%div#my-video
   {{ '<object style="height: 390px; width: 640px">
        <param name="movie" value="http://www.youtube.com/v/8BC6flTOGSk?version=3&feature=player_detailpage">
        <param name="allowFullScreen" value="true">
        <param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/8BC6flTOGSk?version=3&feature=player_detailpage" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360">
   </object>'|e }}

Thank you -- I hadn't realized it was possible to simply put raw html directly into a hamlish template. Handy!