How to use Textile

26 views
Skip to first unread message

vikas

unread,
Apr 3, 2012, 10:48:26 AM4/3/12
to alche...@googlegroups.com
I would like to use RedCloth or any other Formater for Textile.
Since I'm transforming a Radiant CMS, which allowed my client to use Textile I wouldn't like to change it for some sites.

Sometimes it's just easier to list some links as html and use Textile format.

What I tried is create an element and enclose the output with RedCloth, but that wouldn't work, since the alchemy helper are doing already some magic stuff.

<%= RedCloth.new(render_essence_view_by_name(element, 'content')).to_html %>

So it would be good if the content of the TextEsscence could processed as raw, which could be transformed in the partial with RedCloth. Or let's create a TextileEsscence, what then also would work very well in Preview.
Message has been deleted

Marc

unread,
Apr 3, 2012, 11:10:12 AM4/3/12
to alche...@googlegroups.com
Hi Vikas, 

you can easily roll out your own essences: 

http://guides.alchemy-cms.com/creating_essences.html 

In this case just use the structure of alchemy_essence_texts (at least the 'body'-field).

The conversion can be done in essence_textile_view: 

<%= RedCloth.new(content.essence.body) %> 

Regards 
Marc 

Thomas von Deyen

unread,
Apr 3, 2012, 11:27:31 AM4/3/12
to alche...@googlegroups.com
The EssenceRichtext (which I guess you used to store the content) stores HTML markup from inside the TinyMCE editor.

You could make you own essence, like Marc suggested.

Or you use the EssenceHtml. That just stores binary/blob data in the database.

You easily can override the view partial for that essence type:

app/views/alchemy/essences/_essence_html_view.html.erb

Then you would process the output:

<%= RedCloth.new(content.ingredient).to_html %>

The editor partial is:

app/views/alchemy/essences/_essence_html_editor.html.erb

Then you could add an textile editor to all editor views.

But making an own essence would be best way.
Because then you could use EssenceHtml and EssenceTextile aside in the same project.

That should work.

Regards

Thomas

Reply all
Reply to author
Forward
0 new messages