[TxMt] how to concatenate templates ?

Roberto Saccon rsaccon at gmail.com
Sun Nov 11 12:18:54 UTC 2007


thanks, concatenating now works great, but the variables TM_YEAR and
TM_DATE don't get passed anymore to the template !!

On Nov 11, 2007 5:54 AM, Allan Odgaard <throw-away-2 at macromates.com> wrote:
> On 11 Nov 2007, at 03:49, Roberto Saccon wrote:
>
> > [...]
> > I tried to to turn it into somethng like this:
> >
> > if [[ ! -f "$TM_NEW_FILE" ]]; then
> >   TM_YEAR=`date +%Y` \
> >   TM_DATE=`date +%Y-%m-%d` \
> >   TM_USERNAME=`niutil -readprop / /users/\$USER realname` \
> >   perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
> >      < template_in.txt << License.txt > "$TM_NEW_FILE"
> > fi
>
>
> Try this instead:
>
>     if [[ ! -f "$TM_NEW_FILE" ]]; then
>       TM_YEAR=`date +%Y` \
>       TM_DATE=`date +%Y-%m-%d` \
>       cat template_in.txt License.txt \
>       |perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' > "$TM_NEW_FILE"
>     fi
>
> Here we use 'cat' to actually con_cat_enate two files, must be a
> first ;)
>
> Note I also removed the setup of TM_USERNAME -- we now have
> TM_FULLNAME as a "built-in" since relying on niutil or similar was too
> fragile, but I forgot to update the template for the New Template.
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>



-- 
Roberto Saccon
http://rsaccon.com



More information about the textmate mailing list