diff --git a/build.sh b/build.sh index 1f3e40d..4bbd162 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,10 @@ #!/bin/bash include_file() { + f=`echo -n $2 | sed 's/\//\\\\\//g'` tmp=`tempfile -p "figitive"` cat "$2" | gzip | base64 > "$tmp" - cat "$1" | sed "/#INCLUDE:$2#/ { + cat "$1" | sed "/#INCLUDE:$f#/ { r $tmp d }" rm "$tmp" @@ -11,11 +12,9 @@ include_file() { cp install.sh tmp1 i=1 -for f in archives.html article.html \ - fugitive.css print.css README \ - post-commit.sh post-receive.sh; do +for f in README post-commit.sh post-receive.sh default-files/*; do j=$((1 - i)) - include_file tmp$i $f > tmp$j + include_file tmp$i "$f" > tmp$j i=$j done cp tmp$j fugitive diff --git a/archives.html b/default-files/archives.html similarity index 74% rename from archives.html rename to default-files/archives.html index 0cef075..5cb8981 100644 --- a/archives.html +++ b/default-files/archives.html @@ -21,16 +21,7 @@
- -
-

's blog

- fugitive: a blog engine for hackers. -
+

Archives

@@ -59,19 +50,7 @@
- + diff --git a/article.html b/default-files/article.html similarity index 61% rename from article.html rename to default-files/article.html index e278e17..40066c5 100644 --- a/article.html +++ b/default-files/article.html @@ -21,28 +21,7 @@
- -
-

's blog

- fugitive: a blog engine for hackers. -
+

@@ -64,19 +43,7 @@
- + diff --git a/default-files/footer.html b/default-files/footer.html new file mode 100644 index 0000000..6040184 --- /dev/null +++ b/default-files/footer.html @@ -0,0 +1,13 @@ + diff --git a/fugitive.css b/default-files/fugitive.css similarity index 100% rename from fugitive.css rename to default-files/fugitive.css diff --git a/default-files/nav-header.html b/default-files/nav-header.html new file mode 100644 index 0000000..300592d --- /dev/null +++ b/default-files/nav-header.html @@ -0,0 +1,24 @@ + +
+

's blog

+ fugitive: a blog engine for hackers. +
diff --git a/print.css b/default-files/print.css similarity index 100% rename from print.css rename to default-files/print.css diff --git a/install.sh b/install.sh index 7cd45a2..640a4d8 100644 --- a/install.sh +++ b/install.sh @@ -1,13 +1,13 @@ #!/bin/sh -replace_var_by_string() { +replace_string() { sed "s//$2/" } fugitive_write_template() { name=`git config --get user.name` - base64 -d | gunzip | replace_var_by_string name "$name" | \ - replace_var_by_string year "`date +%Y`" + base64 -d | gunzip | replace_string "name" "$name" | \ + replace_string "year" "`date +%Y`" } fugitive_install_hooks() { @@ -46,10 +46,16 @@ fugitive_install() { echo "done." echo -n "Writing default template files... " fugitive_write_template > _templates/article.html < _templates/archives.html < _templates/nav-header.html < _templates/footer.html < fugitive.css < print.css <