logo       

RE: Changing the output record separator: msg#00013

Subject: RE: Changing the output record separator
This sounds like a job for a filter!

[% IF os == 'windows' %]
[% message | unix2dos %]
[% ELSE %]
[% message %]
[% END %]

I don't think the filter unix2dos comes standard, but you can easily
define it in Perl before the process method gets called. Alternatively,
you can define it in the template code in terms of the replace filter.

Andrew Strader
 

-----Original Message-----
From: templates-admin-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
[mailto:templates-admin-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx] On 
Behalf Of IvorW
Sent: Friday, August 04, 2006 11:45 AM
To: templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
Subject: [Templates] Changing the output record separator

I have a need to output lines of text from TT with full <CR><LF>. This
is because I am using Template Toolkit to generate SWIFT messages, for
which the format requies the carriage return (I'm doing this on Solaris
by the way).

Currently, I have an application that works - using a template with
embedded carriage returns. Unfortunately, these embedded <CR>s have been
foobared by the version control system, which has, as a result, become
very confused about which operating system platform the template file is
for. So, I have resolved to solve this in code, and have a "clean"
template with no embedded control characters.

Rather than hardcoding the output postprocessing, I want to do <CR><LF>
line endings conditionally, based on some logic inside the template.

Is this something others have done already?

What's the simplest way to do it? 

I was thinking of setting $\ from some embedded [% PERL %]. Would that
work?

Ivor.


_______________________________________________
templates mailing list
templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
http://lists.template-toolkit.org/mailman/listinfo/templates


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe