On Sat, Jan 23, 2010 at 03:23, alyssaloren <[email protected]> wrote: > > uhm.. for example.. a page contains the words "hello world".. > > i'll retrieve the contents of the page through getContents().. and then, i'll > send it over to another class say, HighlightText.. in that class, there's a > method produceCodeForHighlighting() which will output > > "{style:type=span|background-color=rgb(255,85,84)} Hello World {style}" > > this output String will then need to be sent back to the page, so that when a > user views it, the words "Hello World" is highlighted..
Code macro provide a highlighting framework used by the code macro itself but you can also you it for anything else. You can look at http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/macro/code/CodeMacro.java to see how code macro is using it. Basically it's based on HighlightParser component interface. The default implementation of HighlightParser is based on Pygments+Jython (http://pygments.org/) > > > > > ________________________________ > From: tmortagne [via XWiki] <[email protected]> > To: alyssaloren <[email protected]> > Sent: Fri, January 22, 2010 1:02:16 AM > Subject: Re: [xwiki-devs] text formatting > > On Fri, Jan 22, 2010 at 09:06, alyssaloren <[hidden email]> wrote: > >> >> Hi! Can someone please help me? I'm looking for the package or part of the >> XWiki code where I can apply the XWiki Syntax v2.0. I would like to format >> the text that would appear on the screen and I can't seem to find the code >> that does that. Please help. >> >> example: >> >> i'll get the contents of a page through getPage() and getContents() then in >> another class, i'll enclosed the contents with the xwiki syntax for >> highlighting the text then save it back so when a user views the page, he >> will see the highlighted text. > I'm not sure to understand your use case, you want to highlight some > code or interpret some syntax ? > > To interpret 2.0 syntax content see > http://code.xwiki.org/xwiki/bin/view/Modules/RenderingModule for > detail of how to parse and render wiki syntaxes. > > >> >> >> Thank you in advance! >> -- >> View this message in context: >> http://n2.nabble.com/text-formatting-tp4438830p4438830.html >> Sent from the XWiki- Dev mailing list archive at Nabble.com. >> _______________________________________________ >> devs mailing list >> [hidden email] >> http://lists.xwiki.org/mailman/listinfo/devs >> > > > -- > Thomas Mortagne > _______________________________________________ > devs mailing list > [hidden email] > http://lists.xwiki.org/mailman/listinfo/devs > > > ________________________________ > > View message @ http://n2.nabble.com/text-formatting-tp4438830p4438981.html > To unsubscribe from text formatting, click here. > > > > > -- > View this message in context: > http://n2.nabble.com/text-formatting-tp4438830p4443822.html > Sent from the XWiki- Dev mailing list archive at Nabble.com. > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

