0

I have a page where I use RedCloth to use markdown for the text and images. I want to be able to place a form somewhere in the text by putting the string [Form] and my application does a substitution to replace [Form] with the ruby code to execute a Rails form.

How do I do this? I currently executve the RedCloth-ed text with a "<%=h %>" so I don't know how to substitute a string with the Rails form code?

Thanks!

For example, in my view, I currently display a mp3 player using a gem and its helper:

 5 #landing_page
  6   #message
  7     = mp3_player @landing_page.mp3.url unless @landing_page.mp3_file_name.blank?
  8     = @redcloth_landing_page

But I actually want more flexibility in terms of being able to place this mp3 player somewhere within the redcloth document by using a substitution string {mp3}.

I'd like where the {mp3} is placed to be where the mp3 player shows up.

Satchel
  • 16,414
  • 23
  • 106
  • 192

1 Answers1

0

First of all I think i understood your question correctly :D,

If you want to add a form (with html tags) as string and wish to function it as a normal form you should look in to template language like 'liquid' (https://github.com/tobi/liquid/). and it works with 'RedCloth' too

cheers

sameera

sameera207
  • 16,547
  • 19
  • 87
  • 152
  • how would I insert the form using rails code instead of hand-coding the html? – Satchel Apr 19 '11 at 03:49
  • Hi @Angela, check this out https://github.com/ludicast/clots.git. you can save the code in the db and use it :D – sameera207 Apr 19 '11 at 16:47
  • Hi @angela, check this url "https://github.com/ludicast/clots" use https, sorry the full url is not displaying here so have https in the front when type the above url – sameera207 May 25 '11 at 04:35
  • Hi, I tried this and its still not going there and it has https – Satchel Jun 20 '11 at 23:46