mirror of
https://git.ludikovsky.name/git/fugitive.git
synced 2024-09-28 14:25:26 +02:00
using new include feature in default templates. Reorganised files accordingly
This commit is contained in:
parent
d7a6747d12
commit
a4de1eb786
9
build.sh
9
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
|
||||
|
|
|
@ -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 ?>
|
||||
—
|
||||
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>
|
|
@ -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 ?>
|
||||
—
|
||||
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>
|
13
default-files/footer.html
Normal file
13
default-files/footer.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<footer>
|
||||
<p>
|
||||
<a href="http://www.gnu.org/copyleft/copyleft.html">copyleft</a>
|
||||
<?fugitive-install name ?> <?fugitive-install year ?>
|
||||
—
|
||||
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>
|
24
default-files/nav-header.html
Normal file
24
default-files/nav-header.html
Normal file
|
@ -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>
|
20
install.sh
20
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
|
||||
|
|
Loading…
Reference in a new issue