tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kavanagh <david.kavan...@marfeel.com>
Subject Re: trimSpaces removing whitespace from html
Date Mon, 29 May 2017 11:34:17 GMT
Here is the link to the enhancement request.

https://bz.apache.org/bugzilla/show_bug.cgi?id=45931

Thanks

On 29 May 2017 at 13:32, David Kavanagh <david.kavanagh@marfeel.com> wrote:

>
>
> On 29 May 2017 at 10:43, Mark Thomas <markt@apache.org> wrote:
>
>> On 26/05/17 21:33, Christopher Schultz wrote:
>> > Mark,
>> >
>> > On 5/26/17 6:59 AM, Mark Thomas wrote:
>> >> On 26/05/17 10:15, David Kavanagh wrote:
>> >>> Hey guys,
>> >>>
>> >>> Thanks for getting back to me. I didn't realise that the
>> >>> attachments would be stripped.> Here are the two files in full.
>> >
>> >> That isn't enough for us to reproduce it. Those files refer to a
>> >> handful of other tag files and classes we don't have.
>> >
>> >> However, I have been able to derive a simple test case from it:
>> >
>> >> =====start====== <p class="${'foo'} ${'bar'}">This is a test</p>
>> >> ======end=======
>> >
>> >> The output with trimSpaces enabled is:
>> >
>> >> =====start====== <p class="foobar">This is a test</p>
>> >> ======end=======
>> >
>> >> trimSpaces is behaving exactly as designed. It removes any blocks
>> >> of template text that consist solely of white space.
>> >
>> >> What you have is: TemplateText [<p class="] Expression
>> >> [${'foo'}] TemplateText [ ] Expression   [${'bar'}] TemplateText
>> >> [">This is a test</p>]
>> >
>> >> Because the second template text is empty, it gets removed.
>> >
>> >> The fix is:
>> >
>> >> =====start====== <p class="${'foo'}${' '}${'bar'}">This is a
>> >> test</p> ======end=======
>> >
>> >> This is a potential use case for a recently closed (as WONTFIX)
>> >> enhancement request:
>> >
>> >> https://bz.apache.org/bugzilla/show_bug.cgi?id=45931
>> >
>> >> Whether this use case is sufficient to justify re-opening that
>> >> enhancement request, reviewing the patch and updating it for 9.0.x
>> >> is TBD. How realistic is it for you to apply the fix (using ${'
>> >> '}) described above?
>> >
>> > Would it be reasonable to change trimSpaces so that spaces within
>> > element attributes would be normalized to a single space, and others
>> > would be removed? I'm not sure how aware the parser is of the
>> > surrounding document structure.
>>
>> The parser is completely unaware. As far as it is concerned, it is just
>> template text. Parsing the template text it is likely impossible since
>> correct parsing depends on evaluating the entire page.
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> Hey,
>
> I reopened the enhancement request BZ 45931, and linked to this thread as
> you asked.
> I will look into porting the patch now also. The help is much appreciated.
>
> Thanks
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message