You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Borut Bolčina <bo...@gmail.com> on 2009/04/16 17:03:47 UTC

How to prevent formatting of HTML comments?

Hi,

maybe this will sound very obscure, but if I write a html comment in a
tml file, for example:

<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
	<!--FOOBAR-->	
</t:layout>

the rendered HTML is:

<!-- FOOBAR -->

Notice the space before F and space after R.

Some external software is checking for presence of <!--FOOBAR--> and
is failing because additional spaces are rendered in the HTML.

Any hints before I start creating a component that renders what I want?

Cheers,
Borut

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to prevent formatting of HTML comments?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Another option is to put the FOOBAR into your .properties file:

<t:outputraw value="message:foobar"/>

... or write a single-line component:

public class Cout
{
  @Parameter(...)
  private String value;

  boolean beginRender(MarkupWriter writer)
  {
    writer.writeRaw("<!--");
    writer.writeRaw(value);
    writer.writeRaw("-->");

   return false;
  }
}

On Thu, Apr 16, 2009 at 12:37 PM, Borut Bolčina <bo...@gmail.com> wrote:
> Hi,
>
> funny thing. This
>
> <t:OutputRaw value="literal:<!--FOOBAR-->"/>
>
> gives me
>
> org.xml.sax.SAXParseException
> The value of attribute "value" associated with an element type
> "t:OutputRaw" must not contain the '<' character.
>
> while
>
> <t:OutputRaw value="literal:&lt;!--FOOBAR-->"/>
>
> renders ok as
> <!--FOOBAR-->
>
>
> So, character > is permited, while < is not??? Of course
>
> <t:OutputRaw value="literal:&lt;!--FOOBAR--&gt;"/>
>
> works as well.
>
> I am using 5.0.18.
>
> Thanks for the tip Howard.
>
> -Borut
>
>
> 2009/4/16 Howard Lewis Ship <hl...@gmail.com>:
>> Use the OutputRaw component?
>>
>> On Thu, Apr 16, 2009 at 8:03 AM, Borut Bolčina <bo...@gmail.com> wrote:
>>> Hi,
>>>
>>> maybe this will sound very obscure, but if I write a html comment in a
>>> tml file, for example:
>>>
>>> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>>        <!--FOOBAR-->
>>> </t:layout>
>>>
>>> the rendered HTML is:
>>>
>>> <!-- FOOBAR -->
>>>
>>> Notice the space before F and space after R.
>>>
>>> Some external software is checking for presence of <!--FOOBAR--> and
>>> is failing because additional spaces are rendered in the HTML.
>>>
>>> Any hints before I start creating a component that renders what I want?
>>>
>>> Cheers,
>>> Borut
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>> Director of Open Source Technology at Formos
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to prevent formatting of HTML comments?

Posted by Borut Bolčina <bo...@gmail.com>.
Hi,

funny thing. This

<t:OutputRaw value="literal:<!--FOOBAR-->"/>

gives me

org.xml.sax.SAXParseException
The value of attribute "value" associated with an element type
"t:OutputRaw" must not contain the '<' character.

while

<t:OutputRaw value="literal:&lt;!--FOOBAR-->"/>

renders ok as
<!--FOOBAR-->


So, character > is permited, while < is not??? Of course

<t:OutputRaw value="literal:&lt;!--FOOBAR--&gt;"/>

works as well.

I am using 5.0.18.

Thanks for the tip Howard.

-Borut


2009/4/16 Howard Lewis Ship <hl...@gmail.com>:
> Use the OutputRaw component?
>
> On Thu, Apr 16, 2009 at 8:03 AM, Borut Bolčina <bo...@gmail.com> wrote:
>> Hi,
>>
>> maybe this will sound very obscure, but if I write a html comment in a
>> tml file, for example:
>>
>> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>        <!--FOOBAR-->
>> </t:layout>
>>
>> the rendered HTML is:
>>
>> <!-- FOOBAR -->
>>
>> Notice the space before F and space after R.
>>
>> Some external software is checking for presence of <!--FOOBAR--> and
>> is failing because additional spaces are rendered in the HTML.
>>
>> Any hints before I start creating a component that renders what I want?
>>
>> Cheers,
>> Borut
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
> Director of Open Source Technology at Formos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: How to prevent formatting of HTML comments?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Use the OutputRaw component?

On Thu, Apr 16, 2009 at 8:03 AM, Borut Bolčina <bo...@gmail.com> wrote:
> Hi,
>
> maybe this will sound very obscure, but if I write a html comment in a
> tml file, for example:
>
> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>        <!--FOOBAR-->
> </t:layout>
>
> the rendered HTML is:
>
> <!-- FOOBAR -->
>
> Notice the space before F and space after R.
>
> Some external software is checking for presence of <!--FOOBAR--> and
> is failing because additional spaces are rendered in the HTML.
>
> Any hints before I start creating a component that renders what I want?
>
> Cheers,
> Borut
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org