mirror of
https://git.ludikovsky.name/git/fugitive.git
synced 2024-09-28 22:25:27 +02:00
added preprocessing possibilities for article (to enable use of Markdown, textile or whatever)
This commit is contained in:
parent
367a72ccb6
commit
5ff0da0a71
39
README
39
README
|
@ -14,7 +14,7 @@ fugitive README file
|
||||||
<br />
|
<br />
|
||||||
<code>git clone git://gitorious.org/fugitive/fugitive.git fugitive</code>
|
<code>git clone git://gitorious.org/fugitive/fugitive.git fugitive</code>
|
||||||
<br />
|
<br />
|
||||||
Then simply go in the newly created directory: <code>cd fugitive</code>, and
|
Then go in the newly created directory: <code>cd fugitive</code>, and
|
||||||
run the build script: <code>./build.sh</code>.
|
run the build script: <code>./build.sh</code>.
|
||||||
<br />
|
<br />
|
||||||
This will generate an executable file "fugitive".
|
This will generate an executable file "fugitive".
|
||||||
|
@ -35,7 +35,7 @@ fugitive README file
|
||||||
</p>
|
</p>
|
||||||
<h3>Update</h3>
|
<h3>Update</h3>
|
||||||
<p>
|
<p>
|
||||||
Simply run <code>fugitive --install-hooks <dir></code>.<br />
|
Run <code>fugitive --install-hooks <dir></code>.<br />
|
||||||
This will only (re)install fugitive hooks scripts.<br />
|
This will only (re)install fugitive hooks scripts.<br />
|
||||||
If <dir> isn't specified then the current working directory is used.
|
If <dir> isn't specified then the current working directory is used.
|
||||||
</p>
|
</p>
|
||||||
|
@ -43,37 +43,44 @@ fugitive README file
|
||||||
<h2>Configuration</h2>
|
<h2>Configuration</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
There are three item in the "fugitive" section of the git config:
|
There are three paths in the "fugitive" section of the git config:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
"public-dir" is the path to the directory that will contain the generated
|
<em>public-dir</em> is the path to the directory that will contain the
|
||||||
html files. Defautlt value is ".", the root of the git repository. You
|
generated html files. Defautlt value is ".", the root of the git
|
||||||
could set it to "blog" for instance if you already have a static website
|
repository. You could set it to "blog" for instance if you
|
||||||
under your git repos.
|
already have a static website under your git repos.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
"articles-dir" is the path where fugitive will look for published articles.
|
<em>articles-dir</em> is the path where fugitive will look for published
|
||||||
Default value is "_articles". This path is relative to the root of the git
|
articles. Default value is "_articles". This path is relative to
|
||||||
repository, must be in it and must not start with ".".
|
the root of the git repository, must be in it and must not start with
|
||||||
|
".".
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
"templates-dir" is the path where fugitive will look for templates files.
|
<em>templates-dire</em> is the path where fugitive will look for templates
|
||||||
Default value is "_templates". This path is relative to the root of the git
|
files. Default value is "_templates". This path is relative to
|
||||||
repository, must be in it and must not start with ".".
|
the root of the git repository, must be in it and must not start with
|
||||||
|
".".
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<strong>NOTE:</strong> You must NOT put a trailing '/' at the end of any of
|
<strong>NOTE:</strong> You must NOT put a trailing '/' at the end of any of
|
||||||
those paths.
|
those paths.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
If you want your article to be preprocessed by an external tool (markdown,
|
||||||
|
textile...) you need to set <em>preproc</em> to a command line that will take
|
||||||
|
the file path as argument and write to stdout.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h2>Usage</h2>
|
<h2>Usage</h2>
|
||||||
|
|
||||||
<h3>General use</h3>
|
<h3>General use</h3>
|
||||||
<p>
|
<p>
|
||||||
Article you want to publish should be file without the .html extension in the
|
Article you want to publish should be file without the .html extension in the
|
||||||
"articles-dir" directory (see CONFIGURATION).
|
<em>articles-dir</em> directory (see CONFIGURATION).
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The first line of the file will be used as title and the rest of the file as
|
The first line of the file will be used as title and the rest of the file as
|
||||||
|
@ -81,8 +88,8 @@ fugitive README file
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<strong>/!\ WARNINGS:</strong><br />
|
<strong>/!\ WARNINGS:</strong><br />
|
||||||
DO NOT CREATE AN ARTICLE FILE NAMED "archives".<br />
|
DO NOT CREATE AN ARTICLE FILE NAMED "archives".<br />
|
||||||
DO NOT CREATE AN ARTICLE FILE NAMED "index".
|
DO NOT CREATE AN ARTICLE FILE NAMED "index".
|
||||||
</p>
|
</p>
|
||||||
<h3>Template system</h3>
|
<h3>Template system</h3>
|
||||||
<p><em>*TODO*</em></p>
|
<p><em>*TODO*</em></p>
|
||||||
|
|
|
@ -34,10 +34,11 @@ fugitive_install() {
|
||||||
echo -n "Creating default directory tree... "
|
echo -n "Creating default directory tree... "
|
||||||
mkdir -p _drafts _articles _templates
|
mkdir -p _drafts _articles _templates
|
||||||
echo "done."
|
echo "done."
|
||||||
echo -n "Adding default directory paths to git config... "
|
echo -n "Adding default directory paths and settings to git config... "
|
||||||
git config --add --path fugitive.templates-dir "_templates"
|
git config --add --path fugitive.templates-dir "_templates"
|
||||||
git config --add --path fugitive.articles-dir "_articles"
|
git config --add --path fugitive.articles-dir "_articles"
|
||||||
git config --add --path fugitive.public-dir "."
|
git config --add --path fugitive.public-dir "."
|
||||||
|
git config --add --path fugitive.preproc ""
|
||||||
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
|
||||||
|
|
|
@ -4,6 +4,7 @@ public_dir=`git config --get fugitive.public-dir`
|
||||||
if [ ! -d "$public_dir" ]; then mkdir -p "$public_dir"; fi
|
if [ ! -d "$public_dir" ]; then mkdir -p "$public_dir"; fi
|
||||||
templates_dir=`git config --get fugitive.templates-dir`
|
templates_dir=`git config --get fugitive.templates-dir`
|
||||||
articles_dir=`git config --get fugitive.articles-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' | \
|
added_files=`git log -1 --name-status --pretty="format:" | grep -E '^A' | \
|
||||||
cut -f2`
|
cut -f2`
|
||||||
|
@ -193,6 +194,11 @@ new=$RANDOM.$$
|
||||||
for f in $added_files $new $modified_files; do
|
for f in $added_files $new $modified_files; do
|
||||||
if [ "$f" != "${f#$articles_dir}" ]; then
|
if [ "$f" != "${f#$articles_dir}" ]; then
|
||||||
modification=$((modification + 1))
|
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/}"
|
art="${f#$articles_dir/}"
|
||||||
echo -n "[fugitive] Generating $public_dir/$art.html from $f... "
|
echo -n "[fugitive] Generating $public_dir/$art.html from $f... "
|
||||||
cat "$templates_dir/article.html" | \
|
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 "$art.html" >> .git/info/exclude
|
||||||
echo "done."
|
echo "done."
|
||||||
fi
|
fi
|
||||||
|
if [ "$preproc" != "" ]; then mv "$preproc_bak" "$f"; fi
|
||||||
fi
|
fi
|
||||||
if [ "$f" = "$new" ]; then new=""; fi
|
if [ "$f" = "$new" ]; then new=""; fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue