preping v0.1.0
This commit is contained in:
parent
191c3a78e5
commit
88ec76dcee
27
bob2
27
bob2
@ -17,7 +17,8 @@ usage()
|
||||
echo "bob commands :"
|
||||
echo " help display this help"
|
||||
echo " init initiate a blog"
|
||||
echo " publish publish the blog"
|
||||
echo " publish <post> publish the post"
|
||||
echo " unpublish <post> unpublish the post"
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +52,7 @@ init()
|
||||
|
||||
update_index()
|
||||
{
|
||||
ls -t ./posts | awk '
|
||||
posts=$(ls -t ./posts | awk '
|
||||
BEGIN {
|
||||
print "<ul>"
|
||||
}
|
||||
@ -63,7 +64,11 @@ update_index()
|
||||
}
|
||||
END {
|
||||
print "</ul>"
|
||||
}'
|
||||
}')
|
||||
|
||||
template="./lib/template/index.html"
|
||||
awk -v content="$posts" '{gsub(/{{articles}}/, content); print}' "$template" > "./index.html"
|
||||
|
||||
}
|
||||
|
||||
publish()
|
||||
@ -72,12 +77,26 @@ publish()
|
||||
template="./lib/template/post.html"
|
||||
awk -v content="$post" '{gsub(/{{article}}/, content); print}' "$template" > "./posts/$1.html"
|
||||
mv ./drafts/$1.md ./drafts/published/$1.md
|
||||
|
||||
update_index
|
||||
}
|
||||
|
||||
unpublish()
|
||||
{
|
||||
rm ./posts/$1.html
|
||||
mv ./drafts/published/$1.md ./drafts/$1.md
|
||||
|
||||
update_index
|
||||
}
|
||||
|
||||
unpublish_all()
|
||||
{
|
||||
rm ./posts/*
|
||||
}
|
||||
|
||||
deploy()
|
||||
{
|
||||
scp
|
||||
}
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
@ -100,6 +119,8 @@ elif [[ "$1" == "unpublish" ]]; then
|
||||
else
|
||||
unpublish $2
|
||||
fi
|
||||
elif [[ "$1" == "deploy" ]]; then
|
||||
deploy
|
||||
elif [[ "$1" == "help" ]]; then
|
||||
usage
|
||||
fi
|
||||
|
@ -6,11 +6,11 @@
|
||||
<title>simpet</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<link href="https://fonts.googleapis.com/css?family=Cutive+Mono|IBM+Plex+Mono&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="../css/indexstyle.css">
|
||||
<link rel="stylesheet" type="text/css" href="../css/poststyle.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1 class='title'>simpet</h1>
|
||||
<h1 class='title'><a href="../index.html">simpet</a></h1>
|
||||
<article>
|
||||
{{article}}
|
||||
</article>
|
||||
|
Loading…
Reference in New Issue
Block a user