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
|
#!/bin/bash
|
||||||
|
|
||||||
include_file() {
|
include_file() {
|
||||||
|
f=`echo -n $2 | sed 's/\//\\\\\//g'`
|
||||||
tmp=`tempfile -p "figitive"`
|
tmp=`tempfile -p "figitive"`
|
||||||
cat "$2" | gzip | base64 > "$tmp"
|
cat "$2" | gzip | base64 > "$tmp"
|
||||||
cat "$1" | sed "/#INCLUDE:$2#/ {
|
cat "$1" | sed "/#INCLUDE:$f#/ {
|
||||||
r $tmp
|
r $tmp
|
||||||
d }"
|
d }"
|
||||||
rm "$tmp"
|
rm "$tmp"
|
||||||
|
@ -11,11 +12,9 @@ include_file() {
|
||||||
|
|
||||||
cp install.sh tmp1
|
cp install.sh tmp1
|
||||||
i=1
|
i=1
|
||||||
for f in archives.html article.html \
|
for f in README post-commit.sh post-receive.sh default-files/*; do
|
||||||
fugitive.css print.css README \
|
|
||||||
post-commit.sh post-receive.sh; do
|
|
||||||
j=$((1 - i))
|
j=$((1 - i))
|
||||||
include_file tmp$i $f > tmp$j
|
include_file tmp$i "$f" > tmp$j
|
||||||
i=$j
|
i=$j
|
||||||
done
|
done
|
||||||
cp tmp$j fugitive
|
cp tmp$j fugitive
|
||||||
|
|
|
@ -21,16 +21,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<nav>
|
<?fugitive include:nav-header.html ?>
|
||||||
<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>
|
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h1>Archives</h1>
|
<h1>Archives</h1>
|
||||||
|
@ -59,19 +50,7 @@
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<footer>
|
<?fugitive include:footer.html ?>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -21,28 +21,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<nav>
|
<?fugitive include:nav-header.html ?>
|
||||||
<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>
|
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h1><?fugitive article_title ?></h1>
|
<h1><?fugitive article_title ?></h1>
|
||||||
|
@ -64,19 +43,7 @@
|
||||||
<?fugitive article_content ?>
|
<?fugitive article_content ?>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<footer>
|
<?fugitive include:footer.html ?>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</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
|
#!/bin/sh
|
||||||
|
|
||||||
replace_var_by_string() {
|
replace_string() {
|
||||||
sed "s/<?fugitive-install\s\+$1\s*?>/$2/"
|
sed "s/<?fugitive-install\s\+$1\s*?>/$2/"
|
||||||
}
|
}
|
||||||
|
|
||||||
fugitive_write_template() {
|
fugitive_write_template() {
|
||||||
name=`git config --get user.name`
|
name=`git config --get user.name`
|
||||||
base64 -d | gunzip | replace_var_by_string name "$name" | \
|
base64 -d | gunzip | replace_string "name" "$name" | \
|
||||||
replace_var_by_string year "`date +%Y`"
|
replace_string "year" "`date +%Y`"
|
||||||
}
|
}
|
||||||
|
|
||||||
fugitive_install_hooks() {
|
fugitive_install_hooks() {
|
||||||
|
@ -46,10 +46,16 @@ fugitive_install() {
|
||||||
echo "done."
|
echo "done."
|
||||||
echo -n "Writing default template files... "
|
echo -n "Writing default template files... "
|
||||||
fugitive_write_template > _templates/article.html <<EOF
|
fugitive_write_template > _templates/article.html <<EOF
|
||||||
#INCLUDE:article.html#
|
#INCLUDE:default-files/article.html#
|
||||||
EOF
|
EOF
|
||||||
fugitive_write_template > _templates/archives.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
|
EOF
|
||||||
echo "done."
|
echo "done."
|
||||||
echo -n "Writing dummy article (README)... "
|
echo -n "Writing dummy article (README)... "
|
||||||
|
@ -59,10 +65,10 @@ EOF
|
||||||
echo "done."
|
echo "done."
|
||||||
echo -n "Writing default css files... "
|
echo -n "Writing default css files... "
|
||||||
(base64 -d | gunzip) > fugitive.css <<EOF
|
(base64 -d | gunzip) > fugitive.css <<EOF
|
||||||
#INCLUDE:fugitive.css#
|
#INCLUDE:default-files/fugitive.css#
|
||||||
EOF
|
EOF
|
||||||
(base64 -d | gunzip) > print.css <<EOF
|
(base64 -d | gunzip) > print.css <<EOF
|
||||||
#INCLUDE:print.css#
|
#INCLUDE:default-files/print.css#
|
||||||
EOF
|
EOF
|
||||||
echo "done."
|
echo "done."
|
||||||
fugitive_install_hooks
|
fugitive_install_hooks
|
||||||
|
|
Loading…
Reference in a new issue