On Apr 26, 2013, at 4:56 PM, Sergiu Dumitriu <sergiu(a)xwiki.org> wrote:
On 04/26/2013 09:57 AM, Vincent Massol wrote:
Hi,
I'd like to add:
public interface ModelConfiguration
{
…
Syntax getDefaultSyntax();
}
And the configuration key would be:
model.defaultSyntax=xwiki/2.1
This also means deprecating CoreConfiguration.getDefaultDocumentSyntax() in oldcore
The goal is to have a clean way for getting the default syntax for documents for example
without having to use oldcore.
I need this to fix
http://jira.xwiki.org/browse/XWIKI-9074 for example.
WDYT?
I'm not sure the ModelConfiguration is the right place to add this. For
me, syntaxes are closer to rendering than to the data model, although I
agree that it's a property that affects the content of documents more
than it does the rendering engine.
My main concern is that so far there isn't any other method in the whole
model module that deals with syntaxes, so this would be the first thing
that ties the model to the XWiki rendering engine.
In the new model I have this class for example:
public class Content
{
private final String text;
private final Syntax syntax;
public Content(String text, Syntax syntax)
{
this.text = text;
this.syntax = syntax;
}
public String getText()
{
return this.text;
}
public Syntax getSyntax()
{
return this.syntax;
}
…
We only have 2 choices:
* Store the content in a syntax-independent way (ie xml for example)
* Store the content as the user entered it and associate it with the syntax used by the
user
So far we've always said that we wanted to store as the user entered it, in his
syntax. I don't see why we would change this.
But if we do, we can always deprecate. ATM the syntax is part of the model so it makes
sense to me to have this here.
Thanks
-Vincent