From 5ff0da0a719dd5e151004e41a5c18fbc7efb814a Mon Sep 17 00:00:00 2001 From: p4bl0 Date: Sat, 24 Jul 2010 13:22:39 +0200 Subject: added preprocessing possibilities for article (to enable use of Markdown, textile or whatever) --- post-commit.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'post-commit.sh') 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 -- cgit v1.2.3