Hi Mehdi:
Hello everyone,
I am trying to modify the way the table of content (toc) macro behaves on
xwiki, and I have a few questions concerning that.
1- Is there anywhere else the macro is defined besides in macros.mv? the
changes I've made there did not show up on my xwiki instance after I
restarted it.
is it possible we are talking about different macros?
a) the "velocity level" macro #toc(...)
b) the wiki syntax macro (in wiki pages): {{toc ..}}
The latter one is implemented as a java component here:
https://github.com/xwiki/xwiki-rendering/blob/master/xwiki-rendering-macros…
You can override / reimplement components, either as java code:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
or as a quick prototype in a wiki page (I am sure there is documentation, cannot find that
page :( )
you can look at the .../xwiki/bin/view/XWiki/WikiMacros for a list of "macros as
wiki pages" installed in your wiki,
and look at the corresponding pages in the obejct editor to see how they are put
together.
Side Note: If you update your /WEB-INF/xwiki.properties:
velocity.properties = file.resource.loader.cache=false
velocity.properties = velocimacro.library.autoreload=true
you should not need to restart the server to see changes in the *.vm
more side notes: in the flamingo skin there is a "macro.vm" file that
"shadows" the one in templates/macros.vm
./webapps/xwiki/skins/flamingo/macros.vm
try appending "?skin=colibri" when viewing pages to use another skin that does
not overwrite "macros.vm". (assuming that "colibri" is still installed
in your wiki instance, check the "webapps/xwiki/skins" dir for a
"colibri" subdir ...)
2- what is the point of macros.txt? I was not able to
find documentation
for what xwiki is doing with that.
3- how would you recommend going about writing a new toc macro? I've been
doing that using velocity on a dedicated xwiki page, but I'm not able to
call some of the methods that toc macro is using, namely this call:
#set ($tocData = ${tdoc.getTOC($init, $max, $numbered)})
What is exactly the problem? Is there any error message? Maybe some of the variables are
just not initialized?
(that is where velocity trips me usually ...)
hope this helps
clemens