1
0
Fork 0
mirror of https://git.ludikovsky.name/git/fugitive.git synced 2024-09-28 22:25:27 +02:00

now using xml preprocessor intruction <?fugitive VAR ?> for templating instead of xml comment <!--VAR-->, thanks a3_nm for the idea

This commit is contained in:
p4bl0 2010-07-22 19:46:59 +02:00
parent 9cde723e88
commit dc6e418184
2 changed files with 14 additions and 13 deletions

View file

@ -2,13 +2,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html dir="ltr" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> <html dir="ltr" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>p4bl0's blog: <!--article_title--></title> <title>p4bl0's blog: <?fugitive article_title ?></title>
<meta http-equiv="Content-type" content="application/xhtml+xml; charset=utf-8" /> <meta http-equiv="Content-type" content="application/xhtml+xml; charset=utf-8" />
<meta name="author" content="Pablo Rauzy" /> <meta name="author" content="Pablo Rauzy" />
<meta name="description" content="p4bl0 (Pablo Rauzy)'s blog" /> <meta name="description" content="p4bl0 (Pablo Rauzy)'s blog" />
<meta name="keywords" content="p4bl0, pablo, rauzy, blog, geek, student, ens, normale sup, computer science, programming, language" /> <meta name="keywords" content="p4bl0, pablo, rauzy, blog, geek, student, ens, normale sup, computer science, programming, language" />
<link rel="icon" type="image/png" href="/images/icons/pablo.png" /> <link rel="icon" type="image/png" href="/images/icons/pablo.png" />
<link rel="stylesheet" href="/styles/fugitive.css" type="text/css" media="screen" charset="utf-8" /> <link rel="stylesheet" href="fugitive.css" type="text/css" media="screen" charset="utf-8" />
</head> </head>
<body> <body>
@ -26,16 +26,17 @@
<div id="content"> <div id="content">
<article> <article>
<header> <header>
<h2><!--article_title--></h2> <h2><?fugitive article_title ?></h2>
</header> </header>
<footer> <footer>
by <!--commit_author-->, on by <?fugitive commit_author ?>, on
<time datetime="<!--commit_datetime-->"><!--commit_date--> at <time datetime="<?fugitive commit_datetime ?>">
<!--commit_time--></time>. <?fugitive commit_date ?> at
<?fugitive commit_time ?></time>.
</footer> </footer>
</header> </header>
<div> <div>
<!--article_content--> <?fugitive article_content ?>
</div> </div>
</article> </article>
</div> </div>
@ -50,9 +51,9 @@
hosted at <a href="http://berthold.shebang.ws/">berthold</a>'s hosted at <a href="http://berthold.shebang.ws/">berthold</a>'s
</p> </p>
<p> <p>
last commit was <!--commit_hash-->, last commit was <?fugitive commit_hash ?>,
at <time><!--commit_datetime--></time>, at <time><?fugitive commit_datetime ?></time>,
<q><!--commit_subject--></q>. <q><?fugitive commit_subject ?></q>.
</p> </p>
</footer> </footer>
</div> </div>

View file

@ -19,7 +19,7 @@ commit_Hash=`git log -1 --format="%H"`
commit_hash=`git log -1 --format="%h"` commit_hash=`git log -1 --format="%h"`
commit_author=`git log -1 --format="%an"` commit_author=`git log -1 --format="%an"`
commit_author_email=`git log -1 --format="%ae" | sed "s/@/[at]/;s/\./(dot)/"` commit_author_email=`git log -1 --format="%ae" | sed "s/@/[at]/;s/\./(dot)/"`
commit_datetime=`git log -1 --format="%ai" | cut -d' ' -f1,2` commit_datetime=`git log -1 --format="%ai"`
commit_date=`git log -1 --format="%ad" --date="short"` commit_date=`git log -1 --format="%ad" --date="short"`
commit_time=`git log -1 --format="%ai" | cut -d' ' -f2` commit_time=`git log -1 --format="%ai" | cut -d' ' -f2`
commit_timestamp=`git log -1 --format="%at"` commit_timestamp=`git log -1 --format="%at"`
@ -43,10 +43,10 @@ article_get_content() {
} }
replace_var_by_string() { replace_var_by_string() {
sed "s/<\!--$1-->/$2/" sed "s/<?fugitive\s\+$1\s*?>/$2/"
} }
replace_var_by_file() { replace_var_by_file() {
sed "/<\!--$1-->/ { sed "/<?fugitive\s\+$1\s*?>/ {
r $2 r $2
d }" d }"
} }