On Fri, Jan 23, 2015 at 9:09 PM, vincent(a)massol.net <vincent(a)massol.net> wrote:
On 15 Jan 2015 at 11:17:11, ICLED
(c.ledermann@interact-consulting.com(mailto:c.ledermann@interact-consulting.com)) wrote:
Hi Vincent, thanks to point me to this entry in
the extensions.
BTW I made a search with "list macros" and drew a blank, "all macros"
and
"list all" would have given me my answer!
I added this snippet after you asked, to help you, that’s why you drew a blank before ;)
I played around with your snipet, I found most of
the attibutes I want, but
I don't know how to get the source document full name (wiki:space.doc) or a
reference to the document's object.
A macro is some java code so the notion of source document doesn’t exist in the macro
descriptor.
When you create a wiki macro we generate java code (using Dynamic Proxies).
No, that's wiki components.
The wiki macros implements
org.xwiki.rendering.macro.wikibridge.WikiMacro interface which provide
among other things a getDocumentReference() method.
However, you can simply look for documents containing MacroClass xobjects. This is what
this page does in your wiki:
http://<server>/xwiki/bin/view/XWiki/WikiMacros
I also want to know thw scope of the macro;
global, local to the wiki or the
user.
You can also get that from the XWiki.WikiMacroClass class.
At the java level, the visibility corresponds to the ComponentManager in which the macro
component is registered but this cannot be retrieved from the Macro Descriptor.
Hope it helps,
-Vincent
Any way to get the source document full name
(wiki:space.doc) or (better) a
reference to the document's object?
The rationale behind this, is that I must migrate a XWIKI from 5.2.1 to
current, and the WIKI is in a very poor condition, so there is a lot of
cleaning&repair work to do.
{{groovy}}
import org.xwiki.rendering.macro.Macro
println "| Name | Id | Description | DefaultCategory | Priority | InlineMode
|"
services.component.componentManager.getInstanceList(Macro.class).each() {
def descriptor = it.descriptor
println "| ${descriptor.name} | ${descriptor.getId()} |
${descriptor.description} | ${descriptor.getDefaultCategory()} |
${it.getPriority()} | ${it.supportsInlineMode()} |"
}
{{/groovy}}
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne