Hi Juan,
On 21 Oct 2015 at 17:20:08, Juan Martín Sotuyo Dodero
(jmsotuyo@monits.com(mailto:jmsotuyo@monits.com)) wrote:
Thanks for your help!
The Macro.Tree and XWiki.DocumentTree are both in XWiki 2.1 syntax.
However, when rendered, with the suggested changes it said it was using
Markdown 1.1 to render it.
I figured the issue was down to me setting:
#-# [Since 1.8RC2]
#-# Specifies the default syntax to use when creating new documents.
#-# Default value is xwiki/2.1.
core.defaultDocumentSyntax = markdown/1.1
in xwiki.properties, but that setting should only affect new documents, not
rendering of installed macros documents in other syntaxes. Seems like a bug
to me (or at least a misleading comment on the property).
It is a bug! Would be great if you could create a jira issue at
http://jira.xwiki.org for
this
<for xwiki devs>
I’ve started analyzing the issue and the problem is:
* In WikiMacroExecutionEventListener.onWikiMacroExecutionStartsEvent(), we
call SUExecutorContext sucontext = this.suExecutor.before(wikiMacro.getAuthorReference())
which creates a *new* document (and thus with the default syntax, i.e. markdown/1.1!!) and
sets the sdoc to be SUSpace.SUPage.
* Then in the Tree Macro (in Macros.Tree) we do: #set ($xcontext.macro.result =
$services.rendering.parse($output, $xwiki.currentContentSyntaxId).children). This calls
getCurrentContentSyntaxId() which extracts the syntax from the sdoc.
Thus I think we need to either change SUExecutor or modify getCurrentContentSyntaxId(). We
need to decide if the only thing we do with an sdoc is getting its author or if we also
use that to retrieve other data (such as the syntax)…
I’ll defer to Thomas since he’s the one who wrote SUExecutor
</for xwiki devs>
Thanks
-Vincent
[snip]