From 56833369ce0724cc6aead6f43d32c72decb332f5 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Mon, 3 Feb 2025 23:43:19 -0500 Subject: [PATCH] Add ipkg path to idrispost --- blog | 7 +++++++ lib/DB/IdrisPost.rakumod | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/blog b/blog index e260329..9b4dd8c 100755 --- a/blog +++ b/blog @@ -25,6 +25,9 @@ my IO::Path:D $default-db-dir = #| The default output directory my IO::Path:D $default-site-dir = $default-blog-dir.add('site/'); +#| The default idris ipkg +my IO::Path:D $default-ipkg = $default-blog-dir.add('projects/Idris/Idris.ipkg'); + #| Initalize the database multi MAIN( "db", @@ -92,6 +95,8 @@ multi MAIN( "idris", #| The path to the idris file IO::Path(Str) $source, + #| The path to the ipkg file + IO::Path(Str) :$ipkg = $default-ipkg, #| The path of the database file IO::Path(Str) :$db-dir = $default-db-dir, #| The date/time the post should be recorded as posted at @@ -99,6 +104,7 @@ multi MAIN( #| Should the post be hidden from the archive? Bool :$hidden = False, ) { + say $default-ipkg; my $db = read-db $db-dir; my $id = $db.insert-post: @@ -106,6 +112,7 @@ multi MAIN( source => $source.absolute.IO, posted-at => $posted-at, hidden => $hidden, + ipkg => $ipkg.absolute.IO, ); $db.write: $db-dir; say 'Post inserted with id ', $id; diff --git a/lib/DB/IdrisPost.rakumod b/lib/DB/IdrisPost.rakumod index 5dd6f9a..e36da57 100644 --- a/lib/DB/IdrisPost.rakumod +++ b/lib/DB/IdrisPost.rakumod @@ -13,6 +13,14 @@ unit class IdrisPost does Post is json(:pretty); #| cheaty way has Bool:D $.idris = True; +#| Location of the ipkg for the package containing the post +has IO::Path:D $.ipkg + is required + is json( + :to-json(*.Str), + :from-json(*.IO) + ); + method title(--> Str:D) { markdown-title($!source) } @@ -20,5 +28,10 @@ method title(--> Str:D) { # Use katla to highlight our file, mangle the resulting output, and then pass it # through to pandoc for html generation method render-html(--> Str:D) { + # Do a pack build to make sure we have the needed files + # TODO: Figure out how to only do this once + + # Run through katla + # Send output die "Not implemented"; }