You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Shervin Asgari <sh...@linpro.no> on 2006/06/21 15:51:33 UTC

Bug with & in title field in roller

Hello. In the title field when I write Hello & Hello, it is read as 
Hello & Hello in the rss.
But the correct output should be Hello &amp; Hello. However, in the 
description field for instance this is done correctly. Can someone 
please point out to me where I can do the necessary changes to fix this bug?

-- 
Shervin Asgari - System Consultant
M: +47 918 64 148, @: shervin@linpro.no
Linpro AS - Leading on Linux	Tel: +47 21 54 41 00/02
Vitaminveien 1A        Fax: +47 21 54 41 01
PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/


Re: Bug with & in title field in roller

Posted by Dave Johnson <sn...@gmail.com>.
On 6/22/06, Shervin Asgari <sh...@linpro.no> wrote:
> I did what Dave said here, and changed my rss.vm file to
> <title>$utilities.textToHTML($utilities.removeHTML($website.name))</title>
> instead of this <title>$utilities.textToHTML($website.name)</title>
>
> But there is another huge problem right now. The rss feed takes all the
> text, even entities which it shouldn't and converting them.
>
> For instance if you look at this text. The title is outputted correctly,
> but in the description, what it should be is &amp;&nbsp; but the '&' is
> removed. The same goes for &lt;div class which should have been read
> <div class and the href=&quot; which should be read <href=".....">
>
> <title>Nachspiel &amp; Beat for beat syndromet!</title>
>                 <description>                             &amp;nbsp;
> &amp;nbsp;  SOME TEXT SOME TEXT...&lt;div
> class=&quot;readMore&quot;&gt;&lt;a
> href=&quot;http://www.sa.no/blog/page/40?entry=260&quot;&gt;Les
> mer&lt;/a&gt;&lt;/div&gt;
>          </description>
>
> I don't know if your trunk version does this, but I am guessing not. We
> are however still using Roller 2.1 and with the code Dave provided, it
> still doesn't quite do the trick. I hope someone can help

That looks pretty bad, but I haven't noticed this problem myself. I
wonder what is going wrong on your system.

Take a look at weblog.vm and the #showEntryDescription() macro. It
uses $utilities.textToXML() to escape the description. You might want
to try using
$utilities.escapeHTML() there to see what happens, it might  do a
better job of escaping.

- Dave

Re: Bug with & in title field in roller

Posted by Shervin Asgari <sh...@linpro.no>.
I did what Dave said here, and changed my rss.vm file to 
<title>$utilities.textToHTML($utilities.removeHTML($website.name))</title> 
instead of this <title>$utilities.textToHTML($website.name)</title>

But there is another huge problem right now. The rss feed takes all the 
text, even entities which it shouldn't and converting them.

For instance if you look at this text. The title is outputted correctly, 
but in the description, what it should be is &amp;&nbsp; but the '&' is 
removed. The same goes for &lt;div class which should have been read 
<div class and the href=&quot; which should be read <href=".....">

<title>Nachspiel &amp; Beat for beat syndromet!</title>
                <description>                             &amp;nbsp;  
&amp;nbsp;  SOME TEXT SOME TEXT...&lt;div 
class=&quot;readMore&quot;&gt;&lt;a 
href=&quot;http://www.sa.no/blog/page/40?entry=260&quot;&gt;Les 
mer&lt;/a&gt;&lt;/div&gt;
         </description>

I don't know if your trunk version does this, but I am guessing not. We 
are however still using Roller 2.1 and with the code Dave provided, it 
still doesn't quite do the trick. I hope someone can help

Shervin

Dave Johnson wrote:
> You should be able to fix this in the rss.vm template. The latest
> version of that template in the Roller trunk does this:
>
>  <title>$utilities.textToHTML($utilities.removeHTML($website.name))</title> 
>
>
> Which should remove all HTML from the title and them escape any
> ampersand and pointy-braces. So your rss.vm must be doing something
> differernt than that.
>
> - Dave
>
>
>
> On 6/21/06, Shervin Asgari <sh...@linpro.no> wrote:
>> Hello. In the title field when I write Hello & Hello, it is read as
>> Hello & Hello in the rss.
>> But the correct output should be Hello &amp; Hello. However, in the
>> description field for instance this is done correctly. Can someone
>> please point out to me where I can do the necessary changes to fix 
>> this bug?
>>
>> -- 
>> Shervin Asgari - System Consultant
>> M: +47 918 64 148, @: shervin@linpro.no
>> Linpro AS - Leading on Linux    Tel: +47 21 54 41 00/02
>> Vitaminveien 1A        Fax: +47 21 54 41 01
>> PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/
>>
>>

Re: Bug with & in title field in roller

Posted by Shervin Asgari <sh...@linpro.no>.
I have three rss.vm files.

/src/org/roller/presentation/velocity/export_rss.vm
/web/WEB-INF/classes/flavors/rss.vm
/web/WEB-INF/classes/planetrss.vm

Which one should I change?

The rss.vm file has this:    
<title>$utilities.textToHTML($entry.title,true)</title>

Should I maybe change this to 
<title>$utilities.textToHTML($utilities.removeHTML($entry.title))</title> ??

Shervin

Dave Johnson wrote:
> You should be able to fix this in the rss.vm template. The latest
> version of that template in the Roller trunk does this:
>
>  <title>$utilities.textToHTML($utilities.removeHTML($website.name))</title> 
>
>
> Which should remove all HTML from the title and them escape any
> ampersand and pointy-braces. So your rss.vm must be doing something
> differernt than that.
>
> - Dave
>

Re: Bug with & in title field in roller

Posted by Dave Johnson <sn...@gmail.com>.
You should be able to fix this in the rss.vm template. The latest
version of that template in the Roller trunk does this:

  <title>$utilities.textToHTML($utilities.removeHTML($website.name))</title>

Which should remove all HTML from the title and them escape any
ampersand and pointy-braces. So your rss.vm must be doing something
differernt than that.

- Dave



On 6/21/06, Shervin Asgari <sh...@linpro.no> wrote:
> Hello. In the title field when I write Hello & Hello, it is read as
> Hello & Hello in the rss.
> But the correct output should be Hello &amp; Hello. However, in the
> description field for instance this is done correctly. Can someone
> please point out to me where I can do the necessary changes to fix this bug?
>
> --
> Shervin Asgari - System Consultant
> M: +47 918 64 148, @: shervin@linpro.no
> Linpro AS - Leading on Linux    Tel: +47 21 54 41 00/02
> Vitaminveien 1A        Fax: +47 21 54 41 01
> PB 4 Grefsen, 0409 Oslo    WWW: http://www.linpro.no/
>
>