summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--flake.nix33
-rwxr-xr-xmd2saait/frontmatter2cfg2
-rwxr-xr-xmd2saait/getdate5
-rw-r--r--pages/001-example.cfg6
-rw-r--r--pages/001-example.html1
-rw-r--r--pages/002-example.cfg6
-rw-r--r--pages/002-example.html1
7 files changed, 18 insertions, 36 deletions
diff --git a/flake.nix b/flake.nix
index d88cbe6..f52f5c4 100644
--- a/flake.nix
+++ b/flake.nix
@@ -14,36 +14,31 @@
       sha256 = "1pafahvq8xhpba2hgpipkbnhjr3j9zchnxfq4pnxqvidwz5rqr51";
     };
 
-    md2saait = pkgs.stdenv.mkDerivation {
-      name = "md2saait";
-      src = ./md2saait;
-      installPhase = ''
-        mkdir -p $out/bin
-        cp ./* $out/bin
-        sed -i 's:yq:${pkgs.yq}/bin/yq:g' $out/bin/frontmatter2cfg
-      '';
-    };
-
   in {
     defaultPackage.${system} = self.packages.${system}.low-puszcza;
 
     packages.${system}.low-puszcza = pkgs.stdenv.mkDerivation {
       name = "low-puszcza";
       src = self;
-      nativeBuildInputs = with pkgs; [
-        md2saait
-        zip
-        pandoc
-        nur.repos.pn.saait
+      nativeBuildInputs = [
+        pkgs.zip
+        pkgs.pandoc
+        pkgs.nur.repos.pn.saait
       ];
 
       buildPhase = ''
+        sed -i 's:yq:${pkgs.yq}/bin/yq:g' ./md2saait/frontmatter2cfg
+        sed -i 's:rev:${pkgs.busybox}/bin/rev:g' ./md2saait/getdate
+
         cp ${kronika}/wpisy wpisy -r
-        for f in `find wpisy -name *.md`; do
+        for f in `find wpisy -name '*.md'`; do
           name=$(basename $f .md)
-          date=$(getdate $f)
-          frontmatter2cfg $f > pages/$date_$name.cfg
-          pandoc $f > pages/$date_$name.html
+          d=$(./md2saait/getdate $f)
+
+          ./md2saait/frontmatter2cfg $f > pages/$d-$name.cfg
+          pandoc $f > pages/$d-$name.html
+        done
+        ls pages
         make
       '';
 
diff --git a/md2saait/frontmatter2cfg b/md2saait/frontmatter2cfg
index c53a905..e4fb4e2 100755
--- a/md2saait/frontmatter2cfg
+++ b/md2saait/frontmatter2cfg
@@ -8,4 +8,4 @@
 
 INPUT=$1
 
-sed -n '/---/,/---/p' $INPUT | tail -n +2 | head -n -1 | yq '{title: .title, created: .date, updated: .date, keywords: .title, image: .image}' -y | sed "/\(created\|updated\)/s/T.*'/'/" | sed "s/:/ =/"
+sed -n '/---/,/---/p' $INPUT | tail -n +2 | head -n -1 | yq '{title: .title, created: .date, updated: .date, keywords: .title, image: .image}' -y | sed "/\(created\|updated\)/s/T.*'/'/" | sed "s/:/ =/" | sed "s/'//g"
diff --git a/md2saait/getdate b/md2saait/getdate
index 280d5cc..76ab2a6 100755
--- a/md2saait/getdate
+++ b/md2saait/getdate
@@ -1,4 +1,5 @@
 #!/bin/sh
 
-frontmatter2cfg $1 | grep created | \
-  cut -d' ' -f 3 | cut -c 2- | rev | cut -c 2- | rev
+cfg=`./md2saait/frontmatter2cfg $1 | grep created`
+date=`echo $cfg | cut -d' ' -f 3`
+echo $date
diff --git a/pages/001-example.cfg b/pages/001-example.cfg
deleted file mode 100644
index e5b0043..0000000
--- a/pages/001-example.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-filename = example.html
-title = Example page
-description = This is an example page
-keywords = example
-created = 2009-04-12
-updated = 2009-04-12
diff --git a/pages/001-example.html b/pages/001-example.html
deleted file mode 100644
index 1b9e072..0000000
--- a/pages/001-example.html
+++ /dev/null
@@ -1 +0,0 @@
-<p>example</p>
diff --git a/pages/002-example.cfg b/pages/002-example.cfg
deleted file mode 100644
index 5d2d392..0000000
--- a/pages/002-example.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-filename = example2.html
-title = Example page 2
-description = This is an example page 2
-keywords = example
-created = 2009-04-13
-updated = 2009-04-13
diff --git a/pages/002-example.html b/pages/002-example.html
deleted file mode 100644
index cd9f9e7..0000000
--- a/pages/002-example.html
+++ /dev/null
@@ -1 +0,0 @@
-<p>example 2</p>