Take the 2-minute tour ×

Site for writers and readers, both groups will be non-technical users (writers will be familiar with BBCode already, but I can choose other markup). Writers will write guides using markup tags to embodied info. Readers will be presented with parsed text. Tags will be expanded to some info.

Number of tags needed as well as info tied to particular tag will change. So they can not be hard-coded.

I'm looking for any interpreter that can use tags provided at run time, for my next Ruby on rails app. Anyone know such?

Edit: Yeah. I'm not looking for views markup, but for forms textarea markup to be used by website users (to format their guides, but I do need ONE markup for formatting, and embedding info).

share|improve this question
Is there a reason you can't use ERb? Have you looked at liquid? –  Mark Thomas Sep 16 '12 at 2:41
I will not write those guides. Any user will be able to write one. So ERb is not good pick. I was thinking about BBCode or maybe Markdown. But first I need to have interpreter that is extensible at runtime. –  przemo_li Sep 16 '12 at 11:41
Can you be more specific about what you mean by "extensible at runtime"? What functionality do you need that isn't provided by Markdown. It would help if you describe a typical scenario of what a "writer" needs to accomplish. –  Mark Thomas Sep 16 '12 at 14:04
Lets assume we talk about guid for mmo. Mod of website make tags like monkeywarior, and monkeywarior-strenght. Writer instead of writing about moneky warior champion is inserting tags. Less prone to mistakes. And if there is any change to this champion stats, mods will update tags, and readers will see updated stats. Now is clear enough? –  przemo_li Sep 16 '12 at 16:14
If I understand correctly, by "tags" you mean placeholders for content, like variables that need to be inserted into the text. But you don't want a complete scripting language, and perhaps not even a full templating language like liquid. –  Mark Thomas Sep 16 '12 at 16:43
show 1 more comment

1 Answer

up vote 1 down vote accepted

Based on my current understanding of your needs, I recommend mustache. This is described as a "logic-less" template processor. It doesn't have programming logic, simply run-time replacements.

Here's one way to use it (from the github readme)

Given this template (winner.mustache):

Hello {{name}}
You have just won {{value}} bucks!

We can fill in the values at will:

view = Winner.new
view[:name] = 'George'
view[:value] = 100

Which returns:

Hello George
You have just won 100 bucks!
share|improve this answer
Mustache sounds good. PS can I use it with Markdown? Aren't {{ }} escaped by Markdown? –  przemo_li Sep 16 '12 at 17:22
Sure, here is a message from the author of kramdown who recommends a template processor like moustache to add this functionality (as opposed to adding template functionality to kramdown itself). Kramdown is my favorite markdown processor, BTW. –  Mark Thomas Sep 16 '12 at 17:28
add comment

Your Answer


