Skip to content

Instantly share code, notes, and snippets.

@ramontayag
Created October 6, 2010 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramontayag/613780 to your computer and use it in GitHub Desktop.
Save ramontayag/613780 to your computer and use it in GitHub Desktop.
# HAML view
= f.text_area :javascript, :description => "Javascript typed here will come out in this page's javascript's section.", :rows => 20, :cols => 50, 'data-bespinoptions' => %q({ "syntax": "js" }).html_safe
# Output
<textarea cols="50" data-bespinoptions="{ &quot;syntax&quot;: &quot;js&quot; }" description="Javascript typed here will come out in this page's javascript's section." id="page_javascript" name="page[javascript]" rows="20"></textarea>
@ramontayag
Copy link
Author

I tried

%q({ "syntax": "js" }).html_safe

just to make sure too. Same effect.

@ramontayag
Copy link
Author

=raw f.text_area :javascript, :description => "Javascript typed here will come out in this page's javascript's section.", :rows => 20, :cols => 50, 'data-bespinoptions' => %Q({ "syntax": "js" })

outputs the same thing too. Let me try an html.erb file to see if it's haml that's causing the problem :o

@ramontayag
Copy link
Author

FYI: Rails 2.3.8, I've tried with and without rails-xss (thus the .html_safe and raw code up there), in both erb and haml templates.

@ramontayag
Copy link
Author

Oh, and yes, in case you know bespin, I know that { "syntax": "js" } is incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment