Loss of newline when using directiveStartToken and commentStartToken

View: New views
3 Messages — Rating Filter:   Alert me  

Loss of newline when using directiveStartToken and commentStartToken

by Jonathan Giddy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I am a user of Bcfg2, using their support for Cheetah templating. In
this context, I am using Cheetah within Unix shell-style files, where #
is the comment marker. As such I attempt to "rename" the Cheetah
directive and comment markers.

I am finding that whitespace goes missing after "blank" comment lines.
Instead of being passed through as literals, the text "# \n" becomes "",
and "## \n" becomes "#". Any spaces before the newline are also
swallowed up.

I was originally using Cheetah 2.0.1 on CentOS 5.3, but this problem
occurs in 2.2.1 on Ubuntu 8.04 as well. As an example, my template is:
## '#' and '##' have special meaning to Cheetah, rename them to '@' and '@@'
#compiler-settings
directiveStartToken = @
directiveEndToken = @
commentStartToken = @@
#end compiler-settings
@@ Actual file starts on next line
## Here is a comment followed by a blank comment line
##
echo 1
## The echo command should not be commented out
##
## Do I have 2 or 3 # marks?
#
# Can you see a blank comment line above?

Running "cheetah compile template" gives a template whose output is:
## Here is a comment followed by a blank comment line
#echo 1
## The echo command should not be commented out
### Do I have 2 or 3 # marks?
# Can you see a blank comment line above?



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Loss of newline when using directiveStartToken and commentStartToken

by Jonathan Giddy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I am finding that whitespace goes missing after "blank" comment lines.
> Instead of being passed through as literals, the text "# \n" becomes "",
> and "## \n" becomes "#". Any spaces before the newline are also
> swallowed up.
>  
I have discovered the existence of the compiler setting EOLSlurpToken.
Adding
EOLSlurpToken = None
to the compiler settings fixed the problem. I just didn't realise that
the docs on the website were for pre-2.0.

Thanks,
Jon.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Loss of newline when using directiveStartToken and commentStartToken

by R. Tyler Ballance-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, 04 Aug 2009, Jonathan Giddy wrote:

>
> > I am finding that whitespace goes missing after "blank" comment lines.
> > Instead of being passed through as literals, the text "# \n" becomes "",
> > and "## \n" becomes "#". Any spaces before the newline are also
> > swallowed up.
> >  
> I have discovered the existence of the compiler setting EOLSlurpToken.
> Adding
> EOLSlurpToken = None
> to the compiler settings fixed the problem. I just didn't realise that
> the docs on the website were for pre-2.0.

Yeah, the documentation on the website is a little behind the times to
say the least. I've been slowly working on Sphinx-based documentation,
but Cheetah certainly has a wide number of options and configurations to
document ;)

Glad you found what you needed :)


>
> Thanks,
> Jon.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> Cheetahtemplate-discuss@...
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
-R. Tyler Ballance
Slide, Inc.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

attachment0 (204 bytes) Download Attachment