Revision: 2247
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2247&view=rev
Author: tmzullinger
Date: 2009-01-31 20:00:23 +0000 (Sat, 31 Jan 2009)
Log Message:
-----------
Allow files in subdirectories to be templated
Moving libgpod.html to libgpod/index.html exposed the fact that this
script required all templates to be in the current directory. Remove
that restriction.
Modified Paths:
--------------
website/trunk/replacetemplate
Modified: website/trunk/replacetemplate
===================================================================
--- website/trunk/replacetemplate 2009-01-31 10:40:42 UTC (rev 2246)
+++ website/trunk/replacetemplate 2009-01-31 20:00:23 UTC (rev 2247)
@@ -6,10 +6,10 @@
splitfile ()
{
- echo splitting $1...
+ echo splitting $1/$2...
# the sed command makes sure that the markers are placed on a line
# by their own
- cat $1 | sed '
+ cat $1/$2 | sed '
/.\+<!-- content marker end -->.*/ s/<!-- content marker end -->/\n<!--
content marker end -->/
/.*<!-- content marker end -->.\+/ s/<!-- content marker end -->/<!-- content
marker end -->\n/
@@ -17,17 +17,20 @@
/.\+<!-- content marker start -->.*/ s/<!-- content marker start -->/\n<!--
content marker start -->/
/.*<!-- content marker start -->.\+/ s/<!-- content marker start -->/<!--
content marker start -->\n/
-' | csplit -s -f$PRE$1 - /'<!-- content marker start -->'/ /'<!-- content
marker end -->'/
+' | csplit -s -f$1/$PRE$2 - /'<!-- content marker start -->'/ /'<!-- content
marker end -->'/
}
+d=$(dirname $TEMPLATE)
+f=$(basename $TEMPLATE)
+splitfile $d $f
-splitfile $TEMPLATE
-
for file in $HTMLFILES; do
- splitfile $file
+ d=$(dirname $file)
+ f=$(basename $file)
+ splitfile $d $f
mv $file $file.bak
- cat $PRE"$TEMPLATE"00 $PRE"$file"01 $PRE"$TEMPLATE"02 > $file
- rm $PRE"$file"0[012]
+ cat ${PRE}${TEMPLATE}00 $d/${PRE}${f}01 ${PRE}${TEMPLATE}02 > $file
+ rm $d/${PRE}${f}0[012]
done
-rm $PRE"$TEMPLATE"0[012]
+rm ${PRE}${TEMPLATE}0[012]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2