Hi Lewis,
On Nov 25, 2008, at 5:39 PM, Lewis Denizen wrote:
Hi xwiki-users,
I have a question (or more of a request) regarding the upcoming
Pygments
support in XWiki 1.7. We currently use XWiki at work to keep an
internal
documentation wiki for our application. We've created a few plugins
which
we've used in the following fashion perfectly (XWiki 1.0 syntax):
{code:sql}
DECLARE myDate DATETIME
SELECT myDate = '$xwiki.dateParser.parseDate( "-1b", "yyyyMMdd"
)'
-- this
gives us the previous business date in yyyyMMdd format
...
{code}
Vincent kindly gave me a heads up regarding XWiki 1.7's Pygments
support
(seems to be supported by running it under Jython - VERY exciting :-
D). So,
I was wondering... Would something like the above be supported (i.e.
verbatim code, but allow velocity macros to be run inside the code
block)?
Sure. You'd write:
{{velocity}}{{code language="sql"}}
DECLARE myDate DATETIME
SELECT myDate = '$xwiki.dateParser.parseDate( "-1b", "yyyyMMdd"
)' --
this
gives us the previous business date in yyyyMMdd format
...
{{/code}}{{/velocity}}
Actually even better the code macro automatically guesses the language
if you don't pass it! :)
-Vincent
If not, are
there any documentation out there (other than the source
code)
detailing steps to create an XWiki macro (found
http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in+theā¦
does help a bit if viewed in the code viewer), so that maybe we can
build in support for something like that? Again, thanks for the
great work!
We don't have a tutorial for writing macros yet but that'll come.
Anyone interested to help is welcome to work on this. That'd help a
lot. Currently the easiest way to learn how to write a macro is to
check out xwiki source tree and look at how the current macros are
implemented.
Thanks
-Vincent