about summary refs log tree commit diff
path: root/build.sh
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <patryk@niedzwiedzinski.cyou>2023-08-21 11:49:19 +0200
committerPatryk Niedźwiedziński <patryk@niedzwiedzinski.cyou>2023-08-21 11:49:19 +0200
commitf2ea3f7b4ddf9e47c9014c04160e5cd5ff27a4a9 (patch)
treecd007ee276be4efd21d39576699126eeae3249ec /build.sh
parent52c25a018f7fc42019ae61dcd510c77e3df5e8c8 (diff)
downloadharcdzielnia-f2ea3f7b4ddf9e47c9014c04160e5cd5ff27a4a9.tar.gz
harcdzielnia-f2ea3f7b4ddf9e47c9014c04160e5cd5ff27a4a9.zip
update: new look, new folder structure
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..bd64203
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+mkdir -p dest/foty
+
+cp static/* dest
+
+cat _index_header.html > dest/index.html
+
+function generate_page() {
+	filename=$(basename $1)
+	cat _header.html > dest/$filename.html
+	sed 's/^# \(.*\)/<h2>\1<\/h2>/' $1/opis.md >> dest/$filename.html
+	cat _footer.html >> dest/$filename.html
+
+}
+
+function generate_index() {
+	echo "<div class=\"container\">"
+	for item in `find $1 -name opis.md`; do
+		category=$(basename $(dirname $(dirname $item)))
+		dir=$(dirname $item)
+		generate_page $dir
+		filename=$(basename $dir)
+		name=$(head -n1 $item | cut -c 2-)
+		echo "<div class=\"item\"><a href=\"$filename.html\">"
+		cp $dir/fota.jpg dest/foty/$filename.jpg
+		echo "<img class=\"fota\" src=\"foty/$filename.jpg\">"
+		echo "<div class=\"name\">"
+		echo "<img class=\"icon\" src=\"$category.png\">"
+		echo "<p>$name</p>"
+		echo "</div></a></div>"
+	done
+	echo "</div>"
+}
+
+for kategoria in `ls itemy`; do
+	cat _header.html > dest/$kategoria.html
+	generate_index itemy/$kategoria >> dest/$kategoria.html
+	cat _footer.html >> dest/$kategoria.html
+done
+
+generate_index itemy >> dest/index.html
+cat _footer.html >> dest/index.html