summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2023-05-03 11:03:52 +0200
committerMarc Vertes <mvertes@free.fr>2023-05-03 11:03:52 +0200
commit225ec09076ce44673e4914770d67cadd670910d8 (patch)
tree5461895c29ff0379c711b2639f6e5192521984c5 /build.sh
initial release
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..efda627
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+header='<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+ body {
+ max-width: 45rem;
+ margin: auto;
+ padding: 0.5em;
+ text-align: justify;
+ }
+ h1 { text-align: center }
+ pre {
+ border: 1px solid;
+ padding: 1ch;
+ border-radius: 5px;
+ overflow: auto;
+ background-color: #eee;
+ }
+</style>
+'
+
+genhtml() (
+ cd "$1"
+
+ . ./meta.sh
+
+ exec 1>index.html
+
+ # Header
+ echo "<title>$title</title>"
+ echo "<!-- generated by build.sh. DO NOT EDIT. -->"
+ echo "$header"
+ [ "$1" != . ] && echo "<a href=\"..\">$blog_title</a><hr>"
+
+ # Body
+ pandoc *.md
+
+ # Footer
+ echo "<hr>From: $author, $date"
+)
+
+for d in *; do
+ [ -d "$d" ] && genhtml "$d"
+done
+genhtml .