59 lines
1.1 KiB
Bash
Executable file
59 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
expand() {
|
|
TITLE="$1"
|
|
cat <<-"EOF"
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" type="text/css" href="/style.css">
|
|
<title>
|
|
EOF
|
|
|
|
echo " $TITLE"
|
|
|
|
cat <<-"EOF"
|
|
</title>
|
|
<link rel="alternate" type="application/rss+xml"
|
|
title="RSS Feed for knazarov.com" href="/rss.xml" />
|
|
</head>
|
|
<body>
|
|
<div id="header">
|
|
<a href="/">Konstantin Nazarov</a>
|
|
</div>
|
|
<div id="menu">
|
|
<a href="/">home</a>
|
|
<a href="/posts">posts</a>
|
|
<a href="/projects">projects</a>
|
|
<a href="/cv">cv</a>
|
|
<a href="/contact">contact</a>
|
|
<a href="/rss.xml"><img src="/rss.png" style="height: 15px; width: auto; vertical-align:middle;"></img></a>
|
|
</div>
|
|
<div id="content">
|
|
EOF
|
|
cat
|
|
cat <<-"EOF"
|
|
</div>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
}
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Missing page title"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$2" ] && [ -t 0 ]; then
|
|
echo "Missing page body"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -t 0 ]; then
|
|
expand "$1"
|
|
exit 0
|
|
fi
|
|
|
|
expand "$1" < "$2"
|