[xwiki-users] HTML tags and blog macro can destroy HTML formatting of the page
Hi, there is a problem with the blog macro (Blog.Macros) when content length is greater than 400 and there is an html open tag right before the 400th position. E.g. content from position 390 to 428 is: "This <div class="foo">is a test </div>" 01234567890123456789012345678901234567 9 0 1 2 3 4 4 4 In this case the code below will insert "[...]This <div " as blog entry which destroys HTML formatting. This is an excerpt of the blog macro code: #set($content = $bentrydoc.display("extract", "view", $bentryobj)) #if($content=="") #set($content = $bentrydoc.display("content", "view", $bentryobj)) #if($content.length()>400) #set($i = $content.lastIndexOf(" ",400)) Guido
Hi Guido, Looks like you're talking about this one: http://jira.xwiki.org/jira/browse/XE-50 The current "solution" is to use the extract field manually. Thanks -Vincent On Sep 23, 2007, at 1:26 AM, G.Schoepp wrote:
Hi,
there is a problem with the blog macro (Blog.Macros) when content length is greater than 400 and there is an html open tag right before the 400th position.
E.g. content from position 390 to 428 is: "This <div class="foo">is a test </div>" 01234567890123456789012345678901234567 9 0 1 2 3 4 4 4
In this case the code below will insert "[...]This <div " as blog entry which destroys HTML formatting.
This is an excerpt of the blog macro code: #set($content = $bentrydoc.display("extract", "view", $bentryobj)) #if($content=="") #set($content = $bentrydoc.display("content", "view", $bentryobj)) #if($content.length()>400) #set($i = $content.lastIndexOf(" ",400))
Guido
Vincent Massol schrieb:
Looks like you're talking about this one: http://jira.xwiki.org/jira/browse/XE-50
Yes. Is it possible to get the first 400 characters in XWiki syntax and convert this extract to HTML? This could lead to an unwanted result too but it will prevent invalid HTML formatting. Guido
On Sep 23, 2007, at 1:18 PM, G.Schoepp wrote:
Vincent Massol schrieb:
Looks like you're talking about this one: http://jira.xwiki.org/jira/browse/XE-50
Yes.
Is it possible to get the first 400 characters in XWiki syntax and convert this extract to HTML? This could lead to an unwanted result too but it will prevent invalid HTML formatting.
AFAIK this is what is done. You can try editing the Blog.Macros page and modify it. If you have a patch for it I'll be happy to apply it. Thanks -Vincent
Vincent Massol schrieb:
Is it possible to get the first 400 characters in XWiki syntax and convert this extract to HTML? This could lead to an unwanted result too but it will prevent invalid HTML formatting.
AFAIK this is what is done.
No, that's not right. The HTML code is catched by this statement: #set($content = $bentrydoc.display("content", "view", $bentryobj))
You can try editing the Blog.Macros page and modify it. If you have a patch for it I'll be happy to apply it.
I'd like to, but I don't know how. I assume that I can get the XWiki syntax by this statement: #set($content = $bentrydoc.display("content", "edit", $bentryobj)) But I don't know how to render this to HTML. Guido
On Sep 23, 2007, at 7:06 PM, G.Schoepp wrote:
Vincent Massol schrieb:
Is it possible to get the first 400 characters in XWiki syntax and convert this extract to HTML? This could lead to an unwanted result too but it will prevent invalid HTML formatting.
AFAIK this is what is done.
No, that's not right. The HTML code is catched by this statement: #set($content = $bentrydoc.display("content", "view", $bentryobj))
You can try editing the Blog.Macros page and modify it. If you have a patch for it I'll be happy to apply it.
I'd like to, but I don't know how.
I assume that I can get the XWiki syntax by this statement: #set($content = $bentrydoc.display("content", "edit", $bentryobj))
But I don't know how to render this to HTML.
AFAICS the syntax is retrieved by display() and the content is rendered below with $bentrydoc.getRenderedContent($content) -Vincent
participants (2)
-
G.Schoepp -
Vincent Massol