llog

lighweight (b)log
git clone git://git.kocotian.pl/llog.git
Log | Files | Refs | README | LICENSE

commit 31e6d67cdd4d5de7fe95ce10135c065b53b46487
parent 23aee52c5569ca406568dd3442984c5bd3a3392a
Author: kocotian <kocotian@kocotian.pl>
Date:   Thu, 31 Dec 2020 13:15:44 +0100

date addition

Diffstat:
AMakefile | 8++++++++
Mindex.html | 2+-
Mllog | 9++++++---
Mtemplate.html | 2+-
4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,8 @@ +PREFIX=/usr/local + +install: llog + install -Dm 755 llog ${PREFIX}/bin + +template: llog + mkdir -p ~/.config/llog/ + cp *.html ~/.config/llog/ diff --git a/index.html b/index.html @@ -6,7 +6,7 @@ </head> <body> <h1>An index of llog</h1> - --- @item <a href="<!-- LINK -->"><div><b><!-- TITLE --></b>, created by <!-- AUTHOR --></div></a> + --- @item <a href="<!-- LINK -->"><div><b><!-- TITLE --></b>, created by <!-- AUTHOR --><!-- DATE --></div></a> <!-- CONTENT --> <br /><hr /><br /> Generated via llog diff --git a/llog b/llog @@ -35,13 +35,15 @@ INDEXES="" for F in $FILES do - DATA="$(cat "$F")" + DATA="$(cat "$1/$F")" VARS="$(echo "$DATA" | grep "^\\s*---\\s*@" | sed "s/^\\s*---\\s*@//")" TITLE="$(echo "$VARS" | grep "^title" | sed "s/^title\s//")" AUTHOR="$(echo "$VARS" | grep "^author" | sed "s/^author\s//")" - echo "Generating \"$TITLE\" by $AUTHOR" + DATE="$(echo "$VARS" | grep "^date" | sed "s/^date\s//")" + echo "Generating \"$TITLE\" by $AUTHOR ($DATE)" TEMPL="$(echo "$OUTPUT" | sed "s/<!--\\s*TITLE\\s*-->/$TITLE/g; - s/<!--\\s*AUTHOR\\s*-->/$AUTHOR/g")" + s/<!--\\s*AUTHOR\\s*-->/$AUTHOR/g; + s/<!--\\s*DATE\\s*-->/$DATE/g")" LINE="$(echo "$TEMPL" | grep --line-number "^\\s*<!--\\s*CONTENT\\s*-->" | cut -d: -f1)" BEF="$(echo "$TEMPL" | sed -n "1,${LINE}p")" AFT="$(echo "$TEMPL" | sed -n "${LINE},\$p")" @@ -51,6 +53,7 @@ $OUT $AFT" > "$2/$F" INDEX="$(echo "$IND_ITEM" | sed "s/<!--\\s*TITLE\\s*-->/$TITLE/g; s/<!--\\s*AUTHOR\\s*-->/$AUTHOR/g; + s/<!--\\s*DATE\\s*-->/$DATE/g; s/<!--\\s*LINK\\s*-->/$F/g")" INDEXES="$INDEX $INDEXES" diff --git a/template.html b/template.html @@ -7,7 +7,7 @@ <body> <h1>llog - <a href="index.html">index</a></h1> <h2><!--TITLE--></h2> - <h4>by <!--AUTHOR--></h4> + <h4>by <!--AUTHOR-->, <!--DATE--></h4> <!-- CONTENT --> <br /><hr /><br /> Generated via llog