summaryrefslogtreecommitdiff
path: root/post-commit.sh
diff options
context:
space:
mode:
authorp4bl0 <pablo@rauzy.name>2010-07-24 13:22:39 +0200
committerp4bl0 <pablo@rauzy.name>2010-07-24 13:22:39 +0200
commit5ff0da0a719dd5e151004e41a5c18fbc7efb814a (patch)
tree19960024ea62e79b8bab336d4dda933b61caf924 /post-commit.sh
parent367a72ccb68a3131302f6951a7da15577f13228f (diff)
added preprocessing possibilities for article (to enable use of Markdown, textile or whatever)
Diffstat (limited to 'post-commit.sh')
-rw-r--r--post-commit.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/post-commit.sh b/post-commit.sh
index d798121..30d9315 100644
--- a/post-commit.sh
+++ b/post-commit.sh
@@ -4,6 +4,7 @@ public_dir=`git config --get fugitive.public-dir`
if [ ! -d "$public_dir" ]; then mkdir -p "$public_dir"; fi
templates_dir=`git config --get fugitive.templates-dir`
articles_dir=`git config --get fugitive.articles-dir`
+preproc=`git config --get fugitive.preproc`
added_files=`git log -1 --name-status --pretty="format:" | grep -E '^A' | \
cut -f2`
@@ -193,6 +194,11 @@ new=$RANDOM.$$
for f in $added_files $new $modified_files; do
if [ "$f" != "${f#$articles_dir}" ]; then
modification=$((modification + 1))
+ if [ "$preproc" != "" ]; then
+ preproc_bak=`tempfile -p "fugitive" -d "$articles_dir"`
+ mv "$f" "$preproc_bak"
+ $preproc "$preproc_bak" > "$f"
+ fi
art="${f#$articles_dir/}"
echo -n "[fugitive] Generating $public_dir/$art.html from $f... "
cat "$templates_dir/article.html" | \
@@ -207,6 +213,7 @@ for f in $added_files $new $modified_files; do
echo "$art.html" >> .git/info/exclude
echo "done."
fi
+ if [ "$preproc" != "" ]; then mv "$preproc_bak" "$f"; fi
fi
if [ "$f" = "$new" ]; then new=""; fi
done