Hi guys,
I'm trying to build a template which will consist of an HTML file and a CSS file (eventually a number of CSS files in a separate directory) but I'm having a few problems. I tried duplicating the Objective-C singleton template and essentially copied and pasted the code with a few changes. This is what my template code looks like now:
export TM_YEAR=`date +%Y` export TM_DATE=`date +%Y-%m-%d` export TM_USERNAME=`niutil -readprop / /users/$USER realname` TM_HEADER="$TM_NEW_FILE_BASENAME.css"
if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then perl -pe 's/${([^}]*)}/$ENV{$1}/g' <html_in.html >"$TM_NEW_FILE" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <css_in.css >"$TM_HEADER" fi
This creates the HTML file but not the CSS file. Or at least it didn't until I reloaded the bundles and discovered "untitled.css" had appeared in the template file list alongside html_in.html and css_in.css. Very odd! I did some more reading and found a post in the mailing list archives (http://article.gmane.org/ gmane.editors.textmate.general/8424/match=templates+multiple+files) which Allan mentioned I need to edit an info.plist file. Unfortunately I've not been able to find this file anywhere. Could anyone suggest where it might be and what I need to edit?
Eventually I want to build a template which looks like
index.html \stylesheets master.css standard.css
Would this be possible and if so, any pointers on how I might go about it?
Cheers!
Alastair
On 6 Dec 2006, at 21:09, Alastair Moore wrote:
This creates the HTML file but not the CSS file. Or at least it didn't until I reloaded the bundles and discovered "untitled.css" had appeared in the template file list alongside html_in.html and css_in.css. Very odd! I did some more reading and found a post in the mailing list archives (http://article.gmane.org/ gmane.editors.textmate.general/8424/match=templates+multiple+files) which Allan mentioned I need to edit an info.plist file. Unfortunately I've not been able to find this file anywhere. Could anyone suggest where it might be and what I need to edit?
Ok I've found what I'm supposed to edit and where, and it works fine for two files but not for more than that.
My template code now looks like -
TM_MASTER="$TM_NEW_FILE_DIRECTORY/master.css" TM_STANDARD="$TM_NEW_FILE_DIRECTORY/standard.css"
if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then perl -pe 's/${([^}]*)}/$ENV{$1}/g' <html_in.html >"$TM_NEW_FILE" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <master_in.css >"$TM_MASTER" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <standard_in.css
"$TM_STANDARD"
fi
and the info.plist looks like
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>command</key> <string>TM_MASTER="$TM_NEW_FILE_DIRECTORY/master.css" TM_STANDARD="$TM_NEW_FILE_DIRECTORY/standard.css"
if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then perl -pe 's/${([^}]*)}/$ENV{$1}/g' <html_in.html >"$TM_NEW_FILE" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <master_in.css >"$TM_MASTER" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <standard_in.css >"$TM_STANDARD" fi </string> <key>extension</key> <string>html</string> <key>files</key> <string>printf "$TM_NEW_FILE\n$TM_NEW_FILE_DIRECTORY/master.css\n $TM_NEW_FILE_DIRECTORY/standard.css"</string> <key>name</key> <string>Two Column (left)</string> <key>uuid</key> <string>8C48A8D2-9526-4467-93CB-92C08AFC65F5</string> </dict> </plist>
It creates the HTML file and the master.css file but not the standard.css file. Not sure why! Any help would be well appreciated and if anyone can suggest a way I can force the css files into a subdirectory, that would be even better :)
Many thanks guys,
Alastair
On 6 Dec 2006, at 21:35, Alastair Moore wrote:
Ok I've found what I'm supposed to edit and where, and it works fine for two files but not for more than that.
My template code now looks like -
TM_MASTER="$TM_NEW_FILE_DIRECTORY/master.css" TM_STANDARD="$TM_NEW_FILE_DIRECTORY/standard.css"
if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then perl -pe 's/${([^}]*)}/$ENV{$1}/g' <html_in.html >"$TM_NEW_FILE" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <master_in.css >"$TM_MASTER" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <standard_in.css
"$TM_STANDARD"
fi
and the info.plist looks like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <dict> <key>command</key> <string>TM_MASTER="$TM_NEW_FILE_DIRECTORY/master.css" TM_STANDARD="$TM_NEW_FILE_DIRECTORY/standard.css"
if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then perl -pe 's/${([^}]*)}/$ENV{$1}/g' <html_in.html >"$TM_NEW_FILE" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <master_in.css >"$TM_MASTER" perl -pe 's/${([^}]*)}/$ENV{$1}/g' <standard_in.css >"$TM_STANDARD" fi
</string> <key>extension</key> <string>html</string> <key>files</key> <string>printf "$TM_NEW_FILE\n$TM_NEW_FILE_DIRECTORY/master.css\n $TM_NEW_FILE_DIRECTORY/standard.css"</string> <key>name</key> <string>Two Column (left)</string> <key>uuid</key> <string>8C48A8D2-9526-4467-93CB-92C08AFC65F5</string> </dict> </plist>
It creates the HTML file and the master.css file but not the standard.css file. Not sure why! Any help would be well appreciated and if anyone can suggest a way I can force the css files into a subdirectory, that would be even better :)
Just a little bump, I hope you don't mind! I'm trying to get my template to create more than two files. Creating two files- fine, more than that and it's not happening. And also creating a subdirectory and creating files in that subdirectory!
Cheers,
Alastair
On Dec 7, 2006, at 9:32 AM, Alastair Moore wrote:
Just a little bump, I hope you don't mind! I'm trying to get my template to create more than two files. Creating two files- fine, more than that and it's not happening. And also creating a subdirectory and creating files in that subdirectory!
This really starts sounding more like you would want to write a command to do this for you, not a template. Any particular reason you are sticking with a template? That is really meant to create only one file.
Cheers,
Alastair
Haris
On 7 Dec 2006, at 16:06, Charilaos Skiadas wrote:
On Dec 7, 2006, at 9:32 AM, Alastair Moore wrote:
Just a little bump, I hope you don't mind! I'm trying to get my template to create more than two files. Creating two files- fine, more than that and it's not happening. And also creating a subdirectory and creating files in that subdirectory!
This really starts sounding more like you would want to write a command to do this for you, not a template. Any particular reason you are sticking with a template? That is really meant to create only one file.
Only because I don't know any better and someone suggested looking at the Objective-C singleton template. I wouldn't know where to start otherwise!
Cheers,
Alastair
On 7. Dec 2006, at 15:32, Alastair Moore wrote:
[...] Just a little bump, I hope you don't mind! I'm trying to get my template to create more than two files. Creating two files- fine, more than that and it's not happening. And also creating a subdirectory and creating files in that subdirectory!
From the bundle editor, drag the template to the desktop and then to Mail and post it here.