On Fri, Mar 5, 2010 at 10:40, Sergiu Dumitriu <sergiu(a)xwiki.com> wrote:
On 03/05/2010 10:06 AM, Thomas Mortagne wrote:
On Fri, Mar 5, 2010 at 04:58, Sergiu
Dumitriu<sergiu(a)xwiki.com> wrote:
On 03/02/2010 08:20 PM, Thomas Mortagne wrote:
On Tue, Mar 2, 2010 at 18:25, Sergiu
Dumitriu<sergiu(a)xwiki.com> wrote:
> On 03/02/2010 05:01 PM, Joel Forsberg wrote:
>>
>> Greetings
>>
>> On my wiki using swedish characters for xwiki page titles give ugly but
>> working entries in all panels, e.g. "Backlinks" "Recent
modifications" and "My
>> recent modifications"
>>
>> An example is having:
>> "Startsidor för våra intresseområden"
>> ...instead of the correct:
>> "Startsidor för våra intresseområden"
>>
>> Another example is putting thiss wiki code on top of a page:
>> = header that<look ugly> here =
>>
>> The script responsible for for the texts in the panels is as follow:
>>
>> <span class="panelitem">
>> <a href="$rdoc.getURL('view')">
>> $xwiki.getXMLEncoded($rdoc.displayTitle)
>> </a></span>
>>
>> I've noticed that changing the third line into only $rdoc.displayTitle will
>> produce a nice looking entry, and $rdoc is set via
>>
>> #set($rdoc = $xwiki.getDocument($docname).getTranslatedDocument())
>>
>> Now, can anyone see a purpose of using getXMLEncoded() for this? As far as I
>> have seen, it only breaks things.
>
> This is not caused by getXMLEncoded, it merely makes the problem
> visible. This method must be used in order to prevent other problems:
> Invalid XML, broken layout, XSS...
>
> The problem is that the code inside getDisplayTitle wrongly uses a XML
> escaping option.
No, this is valid because the job of $rdoc.displayTitle is to produce
xhtml content and theses are valid XML escapes.
Where does it say that it should produce xhtml content?
public String getDisplayTitle(XWikiContext context)
{
return getRenderedTitle(Syntax.XHTML_1_0, context);
}
I know that this is what it does, but why? The semantics of this method
changed over time. The method used (with 1.0 syntax) to return whatever
was in the title, interpreted but not rendered. So, if it did contain
html markup in it, then that was it. But the wiki markup wasn't rendered
into HTML. And it still behaves this way for the value placed in the
title field.
You forget part of what i said: "(in xwiki/2.0 syntax)". There is not
such thing as "interpreted but not rendered" with xwiki/2.0 syntax.
So, I don't agree with the behavior change and the inconsistency it creates.
>
> Assuming that it should produce xhtml, the behavior is inconsistent. If
> the title is placed in the document.title field, then it returns
> characters; if it is placed in the first heading, it returns escapes. If
> we use wiki syntax in the document.title, we get back wiki syntax; if we
> use wiki syntax in the first heading, we get back HTML. That is totally
> inconsistent and confusing.
>
> This is an API design problem that should be discussed further on the
> dev list.
>
>
>
> Going back to this specific problem, I think that it should be solved by
> using the plaintext output syntax, since inside a panel we're not
> interested in formatting or other markup inside the title, just the
> textual content.
>
>> So you don't need to
>> use getXMLEncoded because any xml content is already properly escaped
>> (in xwiki/2.0 syntax).
>
> I need to use getXMLEncoded because the title doesn't always come from
> the content.
>
>> When you want a plain text version of the title you should use
>> $rdoc.getRenderedTitle("plain/1.0").
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne