Hi Ricardo,
The correct way to do that would be by implementing a rendering
transformation. Transformations are called to modify the XDOM
(document content in a Java object based model) before rendering it.
See
http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule#HAddinganewTra…
The only problem is that there is one limitation currently: when you
edit the a page with the WYSIWYG and save, the modified XDOM will be
saved. We need
http://jira.xwiki.org/jira/browse/XWIKI-3260 to fully
support any possible modification to the XDOM (I'm currently working
on it but it's a big work).
Hope it helps.
On Thu, Sep 30, 2010 at 15:23, [Ricardo Rodriguez] eBioTIC.
<ricardo.rodriguez(a)ebiotic.net> wrote:
Hi all, hi Caleb!
Clearly I'm not the only one thinking about replacing words with links!
:-) I've found the Replace Words With Links Snippet
(
http://tinyurl.com/37f79qu) and would like to know if it is worth to
get it adapted to a different bunch of requirements, if it could be
generalized or if I'm thinking about a different thing that
requires/deserves a different solution.
Having its origin in what I now consider wrong data model design
(
http://ftp.ebiotic.net/onPdr/pescaderiasDataModel.png), I now get pages
including an object of User class (representing a given provider), and
pages containing an object of Species class (representing a product
offered by one of several providers).
Doc1.User.species contents a text string like 'species 01, species 04,
species 05'
Doc2.Species.galicianName contents, for instance, 'species 04'
What I need to do is to replace 'species 04' when rendering
Doc1.User.species with a link to Doc2. And the same with the other
strings if it exist a document with a Doc2.Species.galicianName matching
one of the strings in Doc1.User.species.
I've not a clear idea yet about what must be the right implementation to
"assign items to providers, but I've to deal with what I have for now.
Please, is it worth to adapt the Replace Words With Links Snippet to
this use case? Could it be done in some other simpler way? Could you
point me to any other example that could apply to this case? Thanks!
I'm new to Velocity, to Groovy and in most of the senses to XWiki as well!
By the way: the replacement of strings with links must be done on the
fly. Doing it any other way will complicate the way users create new
pages. It could be not the most efficient and cheap way, but I'm forced
to do it this way until we time and resources to modify the whole model.
Thank you so much for your help!
Ricardo
--
Ricardo Rodríguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne