summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp4bl0 <pablo@rauzy.name>2010-07-25 00:57:27 +0200
committerp4bl0 <pablo@rauzy.name>2010-07-25 00:57:27 +0200
commita4de1eb7869caba6d9020e3f9cc7a817dfc74241 (patch)
treeaadba16beb24e963ee9c0e01df3550ec67daad1b
parentd7a6747d12a570c6408e1d2f7685508f98a4cfa5 (diff)
using new include feature in default templates. Reorganised files accordingly
-rwxr-xr-xbuild.sh9
-rw-r--r--default-files/archives.html (renamed from archives.html)25
-rw-r--r--default-files/article.html (renamed from article.html)37
-rw-r--r--default-files/footer.html13
-rw-r--r--default-files/fugitive.css (renamed from fugitive.css)0
-rw-r--r--default-files/nav-header.html24
-rw-r--r--default-files/print.css (renamed from print.css)0
-rw-r--r--install.sh20
8 files changed, 58 insertions, 70 deletions
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
index 0cef075..5cb8981 100644
--- a/archives.html
+++ b/default-files/archives.html
@@ -21,16 +21,7 @@
</head>
<body>
<div id="container">
- <nav>
- <ul>
- <li><a href="index.html">home</a></li>
- <li>archives</li>
- </ul>
- </nav>
- <header>
- <h1><?fugitive-install name ?>'s blog</h1>
- <q>fugitive: a blog engine for hackers.</q>
- </header>
+ <?fugitive include:nav-header.html ?>
<article>
<header>
<h1>Archives</h1>
@@ -59,19 +50,7 @@
</dl>
</div>
</article>
- <footer>
- <p>
- <a href="http://www.gnu.org/copyleft/copyleft.html">copyleft</a>
- <?fugitive-install name ?> <?fugitive-install year ?>
- &mdash;
- powered by <a href="http://gitorious.org/fugitive">fugitive</a>
- </p>
- <p>
- last build was <?fugitive commit_hash ?>
- at <time><?fugitive commit_datetime ?></time>,<br />
- subject was <q><?fugitive commit_subject ?></q>
- </p>
- </footer>
+ <?fugitive include:footer.html ?>
</div>
</body>
</html>
diff --git a/article.html b/default-files/article.html
index e278e17..40066c5 100644
--- a/article.html
+++ b/default-files/article.html
@@ -21,28 +21,7 @@
</head>
<body>
<div id="container">
- <nav>
- <ul class="nav">
- <?fugitive ifset:article_previous_file ?>
- <li>
- <a href="<?fugitive article_previous_file ?>.html">« previous</a>
- </li>
- <?fugitive endifset:article_previous_file ?>
- <?fugitive ifset:article_next_file ?>
- <li>
- <a href="<?fugitive article_next_file ?>.html">next »</a>
- </li>
- <?fugitive endifset:article_next_file ?>
- </ul>
- <ul>
- <li><a href="index.html">home</a></li>
- <li><a href="archives.html">archives</a></li>
- </ul>
- </nav>
- <header>
- <h1><?fugitive-install name ?>'s blog</h1>
- <q>fugitive: a blog engine for hackers.</q>
- </header>
+ <?fugitive include:nav-header.html ?>
<article>
<header>
<h1><?fugitive article_title ?></h1>
@@ -64,19 +43,7 @@
<?fugitive article_content ?>
</div>
</article>
- <footer>
- <p>
- <a href="http://www.gnu.org/copyleft/copyleft.html">copyleft</a>
- <?fugitive-install name ?> <?fugitive-install year ?>
- &mdash;
- powered by <a href="http://gitorious.org/fugitive">fugitive</a>
- </p>
- <p>
- last build was <?fugitive commit_hash ?>
- at <time><?fugitive commit_datetime ?></time>,<br />
- subject was <q><?fugitive commit_subject ?></q>
- </p>
- </footer>
+ <?fugitive include:footer.html ?>
</div>
</body>
</html>
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 @@
+ <footer>
+ <p>
+ <a href="http://www.gnu.org/copyleft/copyleft.html">copyleft</a>
+ <?fugitive-install name ?> <?fugitive-install year ?>
+ &mdash;
+ powered by <a href="http://gitorious.org/fugitive">fugitive</a>
+ </p>
+ <p>
+ last build was <?fugitive commit_hash ?>
+ at <time><?fugitive commit_datetime ?></time>,<br />
+ subject was <q><?fugitive commit_subject ?></q>
+ </p>
+ </footer>
diff --git a/fugitive.css b/default-files/fugitive.css
index 1c4eaba..1c4eaba 100644
--- a/fugitive.css
+++ b/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 @@
+ <nav>
+ <?fugitive ifset:article_file ?>
+ <ul class="nav">
+ <?fugitive ifset:article_previous_file ?>
+ <li>
+ <a href="<?fugitive article_previous_file ?>.html">« previous</a>
+ </li>
+ <?fugitive endifset:article_previous_file ?>
+ <?fugitive ifset:article_next_file ?>
+ <li>
+ <a href="<?fugitive article_next_file ?>.html">next »</a>
+ </li>
+ <?fugitive endifset:article_next_file ?>
+ </ul>
+ <?fugitive endifset:article_file ?>
+ <ul>
+ <li><a href="index.html">home</a></li>
+ <li><a href="archives.html">archives</a></li>
+ </ul>
+ </nav>
+ <header>
+ <h1><?fugitive-install name ?>'s blog</h1>
+ <q>fugitive: a blog engine for hackers.</q>
+ </header>
diff --git a/print.css b/default-files/print.css
index c386764..c386764 100644
--- a/print.css
+++ b/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/<?fugitive-install\s\+$1\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 <<EOF
-#INCLUDE:article.html#
+#INCLUDE:default-files/article.html#
EOF
fugitive_write_template > _templates/archives.html <<EOF
-#INCLUDE:archives.html#
+#INCLUDE:default-files/archives.html#
+EOF
+ fugitive_write_template > _templates/nav-header.html <<EOF
+#INCLUDE:default-files/nav-header.html#
+EOF
+ fugitive_write_template > _templates/footer.html <<EOF
+#INCLUDE:default-files/footer.html#
EOF
echo "done."
echo -n "Writing dummy article (README)... "
@@ -59,10 +65,10 @@ EOF
echo "done."
echo -n "Writing default css files... "
(base64 -d | gunzip) > fugitive.css <<EOF
-#INCLUDE:fugitive.css#
+#INCLUDE:default-files/fugitive.css#
EOF
(base64 -d | gunzip) > print.css <<EOF
-#INCLUDE:print.css#
+#INCLUDE:default-files/print.css#
EOF
echo "done."
fugitive_install_hooks