about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-03-17 16:56:29 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-03-17 16:56:29 +0100
commit0561f173b01969eac1f4c2aebe2a4de3952e3e65 (patch)
treeb6b9527606b808a243c9ac3afd25cd2e728f8c9f
parent1c7330f59725ba87a2f5bc4cdddb817dddc0bdf6 (diff)
downloadkronika-0561f173b01969eac1f4c2aebe2a4de3952e3e65.tar.gz
kronika-0561f173b01969eac1f4c2aebe2a4de3952e3e65.zip
Add category pages nojs
-rwxr-xr-xgen19
-rw-r--r--wpisy/c/oboz2020.html.raw73
2 files changed, 92 insertions, 0 deletions
diff --git a/gen b/gen
index b62aae0..9a86fc5 100755
--- a/gen
+++ b/gen
@@ -7,6 +7,8 @@ DESCRIPTION=""
 rm -r dest || true
 mkdir dest
 
+categories_dir=$(mktemp -d)
+
 # This is useful when deploying on netlify. Thanks to storing compiled binaries
 # in this folder they will be cached and restored.
 export PATH="$PWD/.jekyll-cache:$PWD/tools:$PATH"
@@ -88,6 +90,14 @@ for f in `find wpisy/kronika/20* -name '*.md' | sort -r`; do
   [ -z $photo ] && photo="/assets/default_tree.jpg"
   description=`grep -E "^[A-Z]" $f | grep -v "|" | head -n 1 | cut -d" " -f1-30`
   categories=`sed -n '/---/,/---/p' $f | grep " - " | sed 's/[^a-zA-Z0-9]//g'`
+
+  for c in "$categories"; do
+    [ -z $c ] && continue
+
+    [ -f "$categories_dir/$c" ] || echo '<link href="/kronika.css" rel="stylesheet"><div class="post-list">' > "$categories_dir/$c"
+    post_link "$path" "$title" "$photo" "$description" >> "$categories_dir/$c"
+  done
+
   post_link "$path" "$title" "$photo" "$description" >> wpisy/kronika.html
   [ $i -lt 20 ] && \
     post_rss "$path" "$title" "$photo" "$description" "$f" >> dest/kronika/rss.xml
@@ -98,8 +108,17 @@ done
 echo "</div>" >> wpisy/kronika.html
 echo "</div><a href=\"/kronika\">Czytaj więcej...</a>" >> wpisy/index.html
 echo "</channel></rss>" >> dest/kronika/rss.xml
+for cate in $categories_dir/*; do
+  c=$(basename $cate)
+  echo "</div>" >> "$cate"
+  [ -f "wpisy/c/$c.html.raw" ] && cp "wpisy/c/$c.html.raw" "wpisy/c/$c.html"
+  # [ -f "wpisy/c/$c.md.raw" ] && cp "wpisy/c/$c.md.raw" "wpisy/c/$c.md"
+  sed -e "/%posts%/r$cate" -i "wpisy/c/$c.html"
+done
 
 ./ssg5 wpisy dest "$TITLE" "$URL"
 rm wpisy/index.html
+rm wpisy/c/*.html
 rm dest/index.html.raw
+rm dest/c/*.raw
 cp -r static/* dest
diff --git a/wpisy/c/oboz2020.html.raw b/wpisy/c/oboz2020.html.raw
new file mode 100644
index 0000000..733b5f2
--- /dev/null
+++ b/wpisy/c/oboz2020.html.raw
@@ -0,0 +1,73 @@
+<style>
+@media all and (max-width: 560px) {
+  ul.troops {
+    flex-direction: column;
+  }
+}
+.troops {
+  padding: 0;
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  list-style: none;
+}
+ul.troops > li {
+  margin: 0.5em 1em;
+}
+#map {
+  width: 100%;
+  height: 12em;
+}
+.story::before,
+.story::after {
+  content: '';
+  background-image: url('/assets/tomahawk.svg');
+  background-size: contain;
+  width: 70px;
+  height: 70px;
+  display: block;
+  top: 30px;
+  margin: auto;
+  margin-bottom: 20px;
+}
+
+.story::after {
+  display: none;
+  -moz-transform: scaleX(-1);
+  -o-transform: scaleX(-1);
+  -webkit-transform: scaleX(-1);
+  transform: scaleX(-1);
+  filter: FlipX;
+  -ms-filter: 'FlipX';
+}
+
+@media (min-width: 510px) {
+  .story::before,
+  .story::after {
+    display: inline-block;
+    position: relative;
+    margin: 0 10px;
+  }
+}
+</style>
+<div>
+  <div class="logo">
+    <img style="z-index: 1" src="/assets/2020.svg" alt="" />
+    <h1 style="z-index: 9">Obóz 2020</h1>
+  </div>
+  <ul class="troops">
+    <li>19 PDH Puszcza</li>
+    <li>7 PDH Binduga</li>
+    <li>7 PDH Watra</li>
+    <li>1 PDH</li>
+  </ul>
+</div>
+<iframe id="map" src="https://maps.google.com/maps?q=Jezioro%20Spore&amp;t=&amp;z=13&amp;ie=UTF8&amp;iwloc=&amp;output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
+<div style="width: 100%">
+  <h2 class="story" style="margin: 10vh 10vmin">
+    To się działo na obozie
+  </h2>
+  <div style="margin: 0 auto; max-width: 80ex">
+  <!--%posts%-->
+  </div>
+</div>