[xwiki-devs] detect the syntax in the context?
Hello fellow developers, at curriki we are slowly evolving to xwiki 2.1 (finally!) and it is not too easy. Some of our objects are rendering user-interfaces messages that are expressed in xwiki syntax. To do so, they have the context. But these objects are rendered sometimes in syntax 2.1 or syntax 1.0… Is there a way to tell the "current" syntax in the context object? thanks paul
On 01/22/2014 08:50 PM, Paul Libbrecht wrote:
Hello fellow developers,
at curriki we are slowly evolving to xwiki 2.1 (finally!) and it is not too easy. Some of our objects are rendering user-interfaces messages that are expressed in xwiki syntax. To do so, they have the context. But these objects are rendered sometimes in syntax 2.1 or syntax 1.0…
Is there a way to tell the "current" syntax in the context object?
thanks
paul
Hi Paul, 1. $doc.syntax [1] 2. Something useful: #foreach($d in $xwiki.searchDocuments("where doc.syntaxId='xwiki/1.0' or doc.syntaxId is null or doc.syntaxId = ''")) * [[$d]] #end 3. That is why translation messages should not contain wiki markup or HTML code. See the paragraph starting with "Don't include markup in the translation" at [2]. [1] http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/Docum... [2] http://dev.xwiki.org/xwiki/bin/Drafts/L10N+Conventions -- Sergiu Dumitriu http://purl.org/net/sergiu
On 23 Jan 2014 at 03:55:37, Sergiu Dumitriu ([email protected](mailto:[email protected])) wrote:
On 01/22/2014 08:50 PM, Paul Libbrecht wrote:
Hello fellow developers,
at curriki we are slowly evolving to xwiki 2.1 (finally!) and it is not too easy. Some of our objects are rendering user-interfaces messages that are expressed in xwiki syntax. To do so, they have the context. But these objects are rendered sometimes in syntax 2.1 or syntax 1.0…
Is there a way to tell the "current" syntax in the context object?
thanks
paul
Hi Paul,
1. $doc.syntax [1]
2. Something useful:
#foreach($d in $xwiki.searchDocuments("where doc.syntaxId='xwiki/1.0' or doc.syntaxId is null or doc.syntaxId = ''")) * [[$d]] #end
We also have a code snippet for this with more details: http://extensions.xwiki.org/xwiki/bin/view/Extension/Syntaxes+Distribution+C... Thanks -Vincent
3. That is why translation messages should not contain wiki markup or HTML code. See the paragraph starting with "Don't include markup in the translation" at [2].
[1] http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/Docum... [2] http://dev.xwiki.org/xwiki/bin/Drafts/L10N+Conventions
-- Sergiu Dumitriu
The problem with this suggestion is that it does not take in account the includes. Right now, all our groups' home page is on syntax/1.0 (normal, they're old) and they include a page that is syntax 2.1. Thus a syntax 2.1 renderer is used even though the "$doc" variable has syntax 1.0. Isn't there something more contextual? Something such as $context.currentSyntax ? thanks Paul Le 23 janv. 2014 à 03:55, Sergiu Dumitriu <[email protected]> a écrit :
On 01/22/2014 08:50 PM, Paul Libbrecht wrote:
Hello fellow developers,
at curriki we are slowly evolving to xwiki 2.1 (finally!) and it is not too easy. Some of our objects are rendering user-interfaces messages that are expressed in xwiki syntax. To do so, they have the context. But these objects are rendered sometimes in syntax 2.1 or syntax 1.0…
Is there a way to tell the "current" syntax in the context object?
thanks
paul
Hi Paul,
1. $doc.syntax [1]
2. Something useful:
#foreach($d in $xwiki.searchDocuments("where doc.syntaxId='xwiki/1.0' or doc.syntaxId is null or doc.syntaxId = ''")) * [[$d]] #end
3. That is why translation messages should not contain wiki markup or HTML code. See the paragraph starting with "Don't include markup in the translation" at [2].
[1] http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/Docum... [2] http://dev.xwiki.org/xwiki/bin/Drafts/L10N+Conventions
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (3)
-
Paul Libbrecht -
Sergiu Dumitriu -
vincent@massol.net