Re: comments trump newline?
"Zemian Deng" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Okay, I did more experiments, and I got even more confused. :( Example1 template: ONE <#-- c1 --> <#nt> <#-- c2 --> THREE Example1 output: ONE THREE Example2 template: ONE <#-- c1 --> X<#-- c2 --> <#-- c3 --> THREE Example2 output: ONE XTHREE So <#nt> has no effect? and what happens in Example2? Thanks, -Z On Wed, Jun 25, 2008 at 8:41 AM, Zemian Deng <[email protected]> wrote: > +1 with Daniel. > > Hello Jonathan, > Yes I can use <#ftl strip_whitespace=false>, but that affect the > entire template, and I only have problem for that single new line > space. > > I have to say this expected behavior is a bit confusing. If you say > "Whitespace between non-outputting elements (comments among them) is > stripped. ", then to me, it's white-space that are enclosed will be > striped, but a well defined separated two non-outputting elements. > > For example if I have these > <#if cond> > > </#if> > > or even this > <#-- c1 > > --> > > Then the whitespace is stripped is WHAT I expected, but this > <#-- c1 --> > > <#-- c2 --> > > Shouldn't strip my whitespace in between. > > This is just my feedback as user. > > -Z > > On Wed, Jun 25, 2008 at 5:16 AM, Daniel Dekany <[email protected]> wrote: >> Wednesday, June 25, 2008, 10:14:24 AM, Jonathan Revusky wrote: >> >>> This is the expected behavior, unless your template begins with something like >>> <#ftl strip_whitespace=false> >>> >>> Whitespace between non-outputting elements (comments among them) is >>> stripped. >> >> I hope you don't keep this behavior with comments in 2.4. A comment >> should not influence the output in any way, except that the whitespace >> in its own line should be removed if the comment is the only thing in >> that line (beside whitespace). >> >>> Also, the whitespace on a line that contains only non-outputting >>> elements is ignored. >> >> Except that for user-defined FTL tags you don't know which is >> outputting, so it's not entirely true. >> >>> JR >>> >>> On Wed, Jun 25, 2008 at 6:39 AM, Zemian Deng <[email protected]> wrote: >>>> Hi list, >>>> >>>> I have this template: >>>> >>>> ONE >>>> <#-- comment here --> >>>> TWO >>>> <#-- --> >>>> THREE >>>> ===== >>>> ONE >>>> <#-- comment here --> >>>> >>>> <#-- --> >>>> THREE >>>> >>>> And I get this output: >>>> ONE >>>> TWO >>>> THREE >>>> ===== >>>> ONE >>>> THREE >>>> >>>> Should I be getting a empty line above the second THREE? I tried with >>>> multiple empty lines between comments, and they all get stripped out. >>>> Is this expected? >>>> >>>> Thanks, >>>> -Z >>>> >>>> ------------------------------------------------------------------------- >>>> Check out the new SourceForge.net Marketplace. >>>> It's the best place to buy or sell services for >>>> just about anything Open Source. >>>> http://sourceforge.net/services/buy/index.php >>>> _______________________________________________ >>>> FreeMarker-user mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/freemarker-user >>>> >>> >>> ------------------------------------------------------------------------- >>> Check out the new SourceForge.net Marketplace. >>> It's the best place to buy or sell services for >>> just about anything Open Source. >>> http://sourceforge.net/services/buy/index.php >>> _______________________________________________ >>> FreeMarker-user mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/freemarker-user >> >> -- >> Best regards, >> Daniel Dekany >> >> >> ------------------------------------------------------------------------- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> FreeMarker-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/freemarker-user >> > ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php