Does anyone know, if this is possible and has some hints how to do
this?! I have not decided, wether I want to use redcloth or bluecloth,
I'll take, whatever has the better extensibility....
I realize that it might be a pain to incorporate _another_ mark up
language, but your syntax is very much like BBCode, and there is a
rails plugin for BBCode that allows easy customization of what tags/
replacements should be made to your text. http://agilewebdevelopment.com/plugins/bbcodeizer
Quick and easy, if you don't mind calling another function when you
render.
If you want it saved directly into the db as the link, then you could
make a simple before_save callback that regexed the tag into html...
though I don't know how you would get the study/publisher information
to include in the tag from just the ID.
This looks _almost_ like the thing I wanted: Unfortunately, the
replacement is a little more complex than what bbcodeize offers: Instead
of replacing the tag with a strin, I need to call a function, which
queries pubmed with the given id and fetches study/publisher info.
Preferably, I wanted to do this at render-time: If I place it in a
before_save, I either:
(a) have another field for the processed markup
(b) or find a way to undo the replacement for editing.
as (b) looks really ugly, I guess I will try a simple regex for
extracting the [pubmed:...]-tag - and store the results of the
processing in another field...