diff --git a/blog b/blog index 6784af9..d06ea67 100755 --- a/blog +++ b/blog @@ -3,12 +3,9 @@ use v6.e.PREVIEW; use DB; use DB::BlogMeta; -use DB::Series; use DB::MarkdownPost; use DB::IdrisPost; -use Pretty::Table; - my %*SUB-MAIN-OPTS = :named-anywhere, :bundling, @@ -73,7 +70,6 @@ multi MAIN( #| Create a new markdown post multi MAIN( - "post", "new", "markdown", #| The path to the markdown file @@ -100,7 +96,6 @@ multi MAIN( #| Create a new idris post multi MAIN( - "post", "new", "idris", #| The path to the idris file @@ -130,8 +125,7 @@ multi MAIN( #| Update the last editied time on a post multi MAIN( - "post", - "edit", + "touch", #| The post id to touch Int:D $id, #| The path of the database file @@ -156,229 +150,3 @@ multi MAIN( my $db = read-db $db-dir; $db.render: $site-dir; } - -#| Provide a table of posts, in newest to oldest order -multi MAIN( - "post", - "list", - #| The path of the database directory - IO::Path(Str) :$db-dir = $default-db-dir, - #| The number of posts to show on a single page - Int :$per-page = 10; - #| The page number to show - Int :$page = 1; -) { - my $db = read-db $db-dir; - my @pages = - $db.sorted-posts.rotor($per-page, :partial); - my @page = @pages[$page - 1].flat; - my $table = Pretty::Table.new: - title => "Posts (page $page/{@pages.elems})", - field-names => ["ID", "Title", "Type"]; - for @page -> $pair { - my $id = $pair.key; - my $post = $pair.value; - # TODO: Terminal aware truncation - my $title = do if $post.title.chars > 50 { - "{$post.title.substr(0, 50)}..." - } else { - $post.title - }; - my $type = do given $post { - when MarkdownPost { - "md" - } - when IdrisPost { - "idr" - } - default { - "" - } - } - $table.add-row: [$id, $title, $type]; - } - say $table; -} - -#| Display information about a post -multi MAIN( - "post", - "info", - #| The id of the post to display information for - Int $id, - #| The path of the database directory - IO::Path(Str) :$db-dir = $default-db-dir, - #| Display all of the information and not just the primaries - Bool :$full, -) { - my $db = read-db $db-dir; - my $post = $db.posts{$id.Int}; - given $post { - say 'Title: ', .title; - say 'Type: ', .WHAT.^name; - say 'Source: ', .source.relative; - if .hidden { - say "Hidden"; - } - if .all-slugs { - if $full { - say 'Slugs: '; - for .all-slugs -> $slug { - say ' * ', $slug; - } - } else { - say 'Primary Slug: ', .all-slugs[*-1]; - } - } else { - say 'Slugs: []'; - } - if .tags { - say 'Tags:'; - for .tags -> $tag { - say ' * ', $tag; - } - } - given .posted-at { - say 'Posted At: ', .Date.Str, ' ', .hh-mm-ss; - } - if .edited-at { - if $full { - say 'Edits: '; - for .edited-at.sort.reverse { - say ' * ', .Date.Str, ' ', .hh-mm-ss; - } - } else { - given .edited-at.sort[*-1] { - say 'Last Edited At: ', .Date.Str, ' ', .hh-mm-ss; - } - } - } - } -} - -#| Add or remove a tag to a post -multi MAIN( - "post", - "tag", - #| The id of the post to display information for - Int $id, - #| The tag to add/remove - Str $tag, - #| remove the tag instead of adding it - Bool :$remove, - #| The path of the database directory - IO::Path(Str) :$db-dir = $default-db-dir, -) { - my $db = read-db $db-dir; - my $post = $db.posts{$id.Int}; - if $remove { - die "Post did not have requested tag" - unless $tag ~~ any($post.tags); - my $index = $post.tags.first: $tag; - $post.tags.=grep(* ne $tag); - } else { - die "Post already had requested tag" - if $tag ~~ any($post.tags); - $post.tags.push: $tag; - } - $db.write: $db-dir; -} - -#| Create a new series -multi MAIN( - "series", - "new", - #| The path of the database file - IO::Path(Str) :$db-dir = $default-db-dir, -) { - my $db = read-db $db-dir; - say 'Series Title: '; - my $title = get; - say 'Series Description: '; - my $desc = get; - - my $series = Series.new: - title => $title, desc => $desc; - my $id = $db.insert-series: $series; - say 'Series inserted with id ', $id; - - $db.write: $db-dir; -} - - -#| Provide a table of series -multi MAIN( - "series", - "list", - #| The path of the database directory - IO::Path(Str) :$db-dir = $default-db-dir, - #| The number of items to show on a single page - Int :$per-page = 10; - #| The page number to show - Int :$page = 1; -) { - my $db = read-db $db-dir; - my @pages = - $db.series.sort(*.key).rotor($per-page, :partial); - my @page = @pages[$page - 1].flat; - my $table = Pretty::Table.new: - title => "Series (page $page/{@pages.elems})", - field-names => ["ID", "Title", "Desc"]; - for @page -> $pair { - my $id = $pair.key; - my $series = $pair.value; - # TODO: Terminal aware truncation - my $title = do if $series.title.chars > 40 { - "{$series.title.substr(0, 50)}..." - } else { - $series.title - }; - my $desc = do if $series.desc.chars > 40 { - "{$series.desc.substr(0, 50)}..." - } else { - $series.desc - }; - $table.add-row: [$id, $title, $desc]; - } - say $table; -} - -#| Display the contents of a series -multi MAIN( - "series", - "info", - #| The id of the series to display - Int $id, - #| The path of the database directory - IO::Path(Str) :$db-dir = $default-db-dir, -) { - my $db = read-db $db-dir; - my $series = $db.series{$id.Int}; - say 'Title: ', $series.title; - say 'Description:'; - for $series.desc.lines -> $line { - say ' ', $line; - } - say 'Posts:'; - for $series.post-ids -> $post-id { - my $post = $db.posts{$post-id}; - say ' * ', $post-id, ': ', $post.title; - } -} - -#| Add a post to a series -multi MAIN( - "series", - "add", - #| The id of the series to add to - Int $series-id, - #| The id of the post to add - Int $post-id, - #| The path of the database directory - IO::Path(Str) :$db-dir = $default-db-dir, -) { - my $db = read-db $db-dir; - my $series = $db.series{$series-id.Int}; - $series.post-ids.push: $post-id.Int; - $db.write: $db-dir; -} diff --git a/db/posts/5.json b/db/posts/5.json deleted file mode 100644 index a689e5e..0000000 --- a/db/posts/5.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "edited-at": [ - ], - "hidden": false, - "idris": true, - "ipkg": "/home/nathan/Projects/Blog/projects/Idris/Idris.ipkg", - "posted-at": "2025-02-09T06:23:37.499533-05:00", - "slugs": [ - ], - "source": "/home/nathan/Projects/Blog/projects/Idris/src/LessMacrosMoreTypes/Printf.md", - "tags": [ - "idris" - ] -} \ No newline at end of file diff --git a/db/series/0.json b/db/series/0.json deleted file mode 100644 index 8661aef..0000000 --- a/db/series/0.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "desc": "Macros are annoying, but an unfortunate fact of life in many programming languages. Especially in languages with nominally \"strong\" type systems, like Rust, macros are quite frequently needed to work around the type system to avoid needless repetition when consuming an API, generate formulaic boilerplate that only exists to please the type system, or work around the lack of variadic functions for things like printf. Lets explore the ways we can use dependently typed constructs to eliminate the need for such macros.", - "post-ids": [ - 5 - ], - "title": "Less Macros, More Types" -} \ No newline at end of file diff --git a/lib/Atom.rakumod b/lib/Atom.rakumod index caee5d8..0efd238 100644 --- a/lib/Atom.rakumod +++ b/lib/Atom.rakumod @@ -39,9 +39,6 @@ sub post-to-item(BlogMeta:D $meta, Int:D $id, Post:D $post --> XML::Element) { $xml.append: $author; $xml.append: XML::Element.new(:name, :attribs({:href($link), :rel})); - # TODO: Actually embed the content - $xml.append: - XML::Element.new(:name, :attribs({:src($link), :type})); $xml.append: XML::Element.new(:name, :nodes([$desc])) if $desc; if $post.tags { diff --git a/lib/Config.rakumod b/lib/Config.rakumod index 9a7ec07..68c8172 100644 --- a/lib/Config.rakumod +++ b/lib/Config.rakumod @@ -10,21 +10,20 @@ use DB::Post; unit class Config; -method generate-post(Int:D $id, Post:D $post, $db) { - my $meta = $db.meta; +# TODO: Support GFM admonitions +method generate-post(Post:D $post, BlogMeta:D $meta) { my $content = $post.render-html; my $head = generate-head($meta, $post.title, $post.description); my $body = body [ site-header $meta; article :class, [ - post-header $id, $post, $db; + post-header $post; div :class, [ $content; ] ] ]; - # TODO: Setup Comments # TODO: Setup footer # my $footer; @@ -33,7 +32,28 @@ method generate-post(Int:D $id, Post:D $post, $db) { $body ]; - show-html $html + "$html" +} + +method generate-blurb(Int:D $id, $db) { + my $post = $db.posts{$id}; + my $desc = $post.description; + my $link = post-link $id, $post; + div :class, [ + div :class, [ + a :href($link), span [ + h2 $post.title; + ]; + ]; + post-info $post; + if $desc ~~ Str:D { + div :class, [ + p $post.description; + ]; + } else { + [] + } + ] } method generate-index($db) { @@ -42,7 +62,7 @@ method generate-index($db) { .head(10) .grep(!*.value.hidden) .map(-> $pair { - generate-blurb $pair.key, $db + self.generate-blurb: $pair.key, $db }); my $head = generate-head($db.meta); @@ -59,7 +79,7 @@ method generate-index($db) { $body ]; - show-html $html + "$html" } method generate-archive($db) { @@ -67,7 +87,7 @@ method generate-archive($db) { $db.sorted-posts .grep(!*.value.hidden) .map(-> $pair { - generate-blurb $pair.key, $db + self.generate-blurb: $pair.key, $db }); my $head = generate-head($db.meta); @@ -84,7 +104,7 @@ method generate-archive($db) { $body ]; - show-html $html + "$html" } method generate-tag-blurb($db, $tag, $limit?) { @@ -96,7 +116,7 @@ method generate-tag-blurb($db, $tag, $limit?) { a :href($link), span [ h3 $post.title; ]; - post-info $id, $post, $db; + post-info $post; if $desc ~~ Str:D { div :class, [ p $post.description; @@ -142,7 +162,7 @@ method generate-tags-page($db, @tags) { $body ]; - show-html $html + "$html" } method generate-tag-page($db, $tag) { @@ -158,5 +178,5 @@ method generate-tag-page($db, $tag) { $body ]; - show-html $html + "$html" } diff --git a/lib/DB.rakumod b/lib/DB.rakumod index ec89780..dac655d 100644 --- a/lib/DB.rakumod +++ b/lib/DB.rakumod @@ -9,12 +9,10 @@ use XML; use XQ; use DB::Post; -use DB::Series; use DB::BlogMeta; use DB::MarkdownPost; use DB::IdrisPost; use DB::PlaceholderPost; -use Render::Series; use Atom; use Config; @@ -27,8 +25,6 @@ class PostDB { #| A mapping from post ids to posts # has %.posts is Posts; has %.posts{Int} of PostTypes = %(); - #| A mapping from series ids to series - has %.series{Int} of Series = %(); #| The post id to use for placeholder posts has Int $.placeholder-id = 0; @@ -41,15 +37,6 @@ class PostDB { } } - #| Get the next unused series ID - method next-series-id(--> Int) { - if %!series.elems > 0 { - %!series.keys.max + 1 - } else { - 0 - } - } - #| Insert a new post to the DB, returning its id method insert-post(PostTypes $post --> Int) { my $id = self.next-post-id; @@ -57,13 +44,6 @@ class PostDB { $id } - #| Insert a new series to the DB, returning its id - method insert-series(Series:D $series --> Int) { - my $id = self.next-series-id; - %!series{$id} = $series; - $id - } - #| Initialize a new database method init(BlogMeta:D $meta --> PostDB:D) { my %posts{Int} of PostTypes = %(); @@ -77,11 +57,9 @@ class PostDB { #| Write a database to a directory method write(IO::Path:D $dir) { my $posts-dir = $dir.add('posts/'); - my $series-dir = $dir.add('series/'); # Make sure directory structrue exists mkdir $dir unless $dir.e; mkdir $posts-dir unless $posts-dir.e; - mkdir $series-dir unless $series-dir.e; # Write out metadata # TODO: Track changes and only write changed files $dir.add('meta.json').spurt: $!meta.to-json(:sorted-keys); @@ -89,10 +67,6 @@ class PostDB { for %!posts.kv -> $key, $value { $posts-dir.add("$key.json").spurt: $value.to-json(:sorted-keys); } - # Write out the series - for %!series.kv -> $key, $value { - $series-dir.add("$key.json").spurt: $value.to-json(:sorted-keys); - } } #| Render the site to the provided output directory @@ -113,7 +87,7 @@ class PostDB { mkdir $by-slug unless $by-slug.e; # Render all the posts and make symlinks for %!posts.kv -> $id, $post { - my $html = $config.generate-post: $id, $post, self; + my $html = $config.generate-post: $post, $!meta; my $id-path = $by-id.add: "$id.html"; $id-path.spurt: $html; for $post.all-slugs -> $slug { @@ -140,16 +114,6 @@ class PostDB { $tags-dir.add("$tag.html").spurt: $config.generate-tag-page(self, $tag); } - # Generate the series pages - my $series-dir = $out-dir.add('series/'); - mkdir $series-dir unless $series-dir.e; - for %!series.kv -> $key, $value { - $series-dir.add("$key.html").spurt: - series-page($key, self); - } - # Generate the main series page - $out-dir.add('series.html').spurt: - series-list-page self; # Render the rss/atom feed my $atom-path = $out-dir.add('atom.xml'); my $atom = posts-to-atom self; @@ -160,7 +124,6 @@ class PostDB { $res-dir.add('colors.css').spurt: %?RESOURCES.slurp; $res-dir.add('main.css').spurt: %?RESOURCES.slurp; $res-dir.add('code.css').spurt: %?RESOURCES.slurp; - $res-dir.add('admonitions.css').spurt: %?RESOURCES.slurp; } #| Get a list of posts sorted by date @@ -172,7 +135,6 @@ class PostDB { #| Read the database out of a directory sub read-db(IO::Path:D $dir --> PostDB:D) is export { my $posts-dir = $dir.add('posts/'); - my $series-dir = $dir.add('series/'); die "DB directory does not exist" unless $dir.e; die "posts directory does not exist" unless $posts-dir.e; # Read metadata @@ -198,16 +160,6 @@ sub read-db(IO::Path:D $dir --> PostDB:D) is export { } } } - # Read series - my %series{Int} of Series:D = %(); - # For backwards compatability, the series directory is optional. It will be - # created on the next db operation, but we don't need it to read the site - if $series-dir.e { - for dir $series-dir -> $series { - my $id = $series.extension("").basename.Int; - %series{$id} = Series.from-json: $series.slurp; - } - } # Build db structure - PostDB.new: meta => $meta, posts => %posts, series => %series + PostDB.new: meta => $meta, posts => %posts } diff --git a/lib/DB/BlogMeta.rakumod b/lib/DB/BlogMeta.rakumod index a5a1fd2..e6ccf5d 100644 --- a/lib/DB/BlogMeta.rakumod +++ b/lib/DB/BlogMeta.rakumod @@ -23,8 +23,8 @@ has Str:D $.base-url is required; #| Return the base url, but substitute it out if the test environment variable #| is set method get-base-url(--> Str:D) { - if %*ENV { - "http://localhost:8000" + if %*ENV { + "http://localhost:8080" } else { $!base-url } diff --git a/lib/DB/Post.rakumod b/lib/DB/Post.rakumod index c1e98c7..246753e 100644 --- a/lib/DB/Post.rakumod +++ b/lib/DB/Post.rakumod @@ -37,7 +37,7 @@ DateTime:D @.edited-at #| An optional list of extra slugs to use for this post has Str:D @.slugs is json = []; #| An optional list of tags for this post -has Str:D @.tags is rw is json = []; +has Str:D @.tags is json = []; #| Should the post be hidden from the main list has Bool:D $.hidden is json is rw = False; diff --git a/lib/DB/Series.rakumod b/lib/DB/Series.rakumod deleted file mode 100644 index 59fd964..0000000 --- a/lib/DB/Series.rakumod +++ /dev/null @@ -1,35 +0,0 @@ -use v6.e.PREVIEW; - -use JSON::Class:auth; - -#| A plain markdown post -unit class Series is json(:pretty); - -#| The title of a series -has Str:D $.title is required; - -#| The description of a series -has Str:D $.desc is required; - -#| The ids of the posts in the series, in series order -has Int:D @.post-ids is rw = []; - -#| Returns true if this series contains the given post id -method contains-post(Int:D $post-id --> Bool:D) { - if $post-id ~~ any @!post-ids { - True - } else { - False - } -} - -#| Returns the date of the lastest post -method latest-post($db) { - my @posts = @!post-ids.map(-> $i {$db.posts{$i}}); - if @posts { - my $most-recent-post = @posts.max(*.posted-at); - $most-recent-post.posted-at - } else { - Nil - } -} diff --git a/lib/Render/Head.rakumod b/lib/Render/Head.rakumod index c93c3ff..e7eb435 100644 --- a/lib/Render/Head.rakumod +++ b/lib/Render/Head.rakumod @@ -38,8 +38,6 @@ sub generate-head(BlogMeta:D $meta, $title?, $description?) is export { :href; link :rel, :href; - link :rel, - :href; ] } @@ -61,9 +59,8 @@ sub site-header(BlogMeta:D $meta) is export { ]; div :class, [ header-link 'Index', '/index.html', 'home'; - header-link 'All Posts', '/archive.html', 'archive'; + header-link 'Archive', '/archive.html', 'archive'; header-link 'Tags', '/tags.html', 'purchase-tag-alt'; - header-link 'Series', '/series.html', 'book'; header-link 'About', '/about.html', 'info-circle'; header-link 'Feed', '/atom.xml', 'rss'; ]; diff --git a/lib/Render/Post.rakumod b/lib/Render/Post.rakumod index 8bb6f97..826582e 100644 --- a/lib/Render/Post.rakumod +++ b/lib/Render/Post.rakumod @@ -3,7 +3,6 @@ unit module Render::Post; use Render::Util; use DB::Post; -use DB::Series; use HTML::Functional; @@ -18,9 +17,9 @@ sub post-date(Post:D $post) is export { ); div :class, :title("Posted At $timestamp"), [ - icon 'calendar'; + icon 'time'; ' '; - $datetime.Date.Str + $timestamp ] } @@ -38,7 +37,7 @@ sub post-edit(Post:D $post) is export { div :class, :title("Last Edited At $timestamp"), [ icon 'edit'; ' '; - $datetime.Date.Str + $timestamp ] } @@ -63,7 +62,7 @@ sub post-tag(Str:D $tag) is export { span :class, [ a :href("/tags/$tag.html"), [ icon 'hash'; - span $tag; + $tag; ] ] } @@ -82,73 +81,20 @@ sub post-tags(Post:D $post) is export { } } -sub series-tag(Int:D $post-id, Int:D $series-id, Series:D $series) is export { - span :class, [ - a :href("/series/$series-id.html"), [ - icon 'book'; - ' '; - span :class, [ - $series.title; - ' '; - '('; - ($series.post-ids.first($post-id, :k) + 1).Str; - '/'; - $series.post-ids.elems.Str; - ')'; - ] - ] - ] -} - -sub post-series-tags(Int:D $post-id, Post:D $post, $db) is export { - # Find all the series this post is in - my @series = $db.series.grep(*.value.contains-post: $post-id); - if @series { - div :class, - @series.map(-> $pair { - series-tag $post-id, $pair.key, $pair.value - }); - } else { - [] - } -} - -sub post-info(Int:D $id, Post:D $post, $db) is export { +sub post-info(Post:D $post) is export { div :class, [ post-date $post; post-edit $post; post-read-time $post; post-tags $post; - post-series-tags $id, $post, $db; ]; } -sub post-header(Int:D $id, Post:D $post, $db) is export { +sub post-header(Post:D $post) is export { header :class, [ div :class, [ h1 $post.title; ]; - post-info $id, $post, $db; - ] -} - -sub generate-blurb(Int:D $id, $db) is export { - my $post = $db.posts{$id}; - my $desc = $post.description; - my $link = post-link $id, $post; - div :class, [ - div :class, [ - a :href($link), span [ - h2 $post.title; - ]; - ]; - post-info $id, $post, $db; - if $desc ~~ Str:D { - div :class, [ - p $post.description; - ]; - } else { - [] - } + post-info $post; ] } diff --git a/lib/Render/Series.rakumod b/lib/Render/Series.rakumod deleted file mode 100644 index add11be..0000000 --- a/lib/Render/Series.rakumod +++ /dev/null @@ -1,144 +0,0 @@ -use v6.e.PREVIEW; -unit module Render::Series; - -use Render::Util; -use Render::Head; -use Render::Post; -use DB::Post; -use DB::Series; - -use HTML::Functional; - -sub series-date(Series:D $series, $db) is export { - my $datetime = $series.latest-post: $db; - if $datetime { - my $timestamp = sprintf( - "%s %02d:%02d%s", - $datetime.yyyy-mm-dd, - ($datetime.hour % 12) || 12, - $datetime.minute, - $datetime.hour < 12 ?? 'am' !! 'pm' - ); - - div :class, :title("Latest post made at $timestamp"), [ - icon 'calendar'; - ' '; - $datetime.Date.Str - ] - } else { - [] - } -} - -sub series-read-time(Series:D $series, $db) is export { - my @readtimes = $series.post-ids.map(-> $i {$db.posts{$i}.readtimes}); - my ($slow, $average, $fast) = 0, 0, 0; - for @readtimes -> ($s, $a, $f) { - $slow += $s; - $average += $a; - $fast += $f; - } - div :class, :title, [ - icon 'timer'; - ' '; - mins-to-string $slow; - ' '; - '/'; - ' '; - mins-to-string $average; - ' '; - '/'; - ' '; - mins-to-string $fast; - ] -} - -sub series-count(Series:D $series, $db) is export { - my $count = $series.post-ids.elems; - div :class, :title("Series has $count articles"), [ - icon 'add-to-queue'; - ' '; - "$count articles"; - ] -} - -sub series-info(Series:D $series, $db) is export { - div :class, [ - series-date $series, $db; - series-read-time $series, $db; - series-count $series, $db; - ] -} - -sub series-header(Series:D $series, $db) is export { - header :class, [ - div :class, [ - h1 $series.title; - ]; - div :class, [ - p $series.desc; - ]; - series-info $series, $db; - ] -} - -sub series-page(Int:D $series-id, $db) is export { - my $meta = $db.meta; - my $series = $db.series{$series-id}; - my $head = generate-head($meta, $series.title, $series.desc); - my $body = - body [ - site-header $meta; - article :class, [ - series-header $series, $db; - div :class, - $series.post-ids.map(*.&generate-blurb($db)); - ] - ]; - - my $html = html :lang, [ - $head; - $body - ]; - - show-html $html; -} - -sub series-blurb(Int:D $id, Series:D $series, $db) { - my $link = "/series/$id.html"; - div :class, [ - div :class, [ - a :href($link), span [ - h2 $series.title; - ]; - p $series.desc; - ]; - series-info $series, $db; - ] -} - -sub series-list-page($db) is export { - my @series = $db.series.sort(*.value.latest-post: $db); - my @series-blurbs = (); - for @series -> $pair { - my $id = $pair.key; - my $series = $pair.value; - @series-blurbs.push: - series-blurb $id, $series, $db; - } - - my $head = generate-head($db.meta); - my $body = body [ - site-header $db.meta; - div :class, [ - h1 "All Series" - ], @series-blurbs; - ]; - - my $html = html :lang, [ - $head; - $body; - ]; - - show-html $html; -} diff --git a/lib/Render/Util.rakumod b/lib/Render/Util.rakumod index 79ece58..05630a7 100644 --- a/lib/Render/Util.rakumod +++ b/lib/Render/Util.rakumod @@ -5,15 +5,6 @@ use DB::Post; use HTML::Functional; -sub show-html($html) is export { - my $out = "$html"; - # Work around HTML::Functional automatically putting newlines between tags - $out ~~ s:g/'' \v+ ''/<\/i>/; - $out ~~ s:g/\v+ ''/<\/a>/; - $out ~~ s:g/',' \v+ ' [!NOTE] -> As this is a literate Idris document, and we haven't defined our `printf` -> function yet, we have to use a `failing` block to ask the compiler to check -> that this code parses, and syntax highlight it for us, but not attempt to -> actually compile it. - -```idris -failing - example_usage : String - example_usage = printf "%s %d %02d" "hello" 1 2 -``` - - - -## Parsing a Format String - -## Calculating a Type From a Format String - -## printf diff --git a/projects/Markdown/2025/01-Jan/AdventOfBugs.md b/projects/Markdown/2025/01-Jan/AdventOfBugs.md index 121f50e..3242738 100644 --- a/projects/Markdown/2025/01-Jan/AdventOfBugs.md +++ b/projects/Markdown/2025/01-Jan/AdventOfBugs.md @@ -65,10 +65,6 @@ calls to make interaction between lazy and strict code Just Work™: had initially thought I had discovered just _one_ compiler bug, but it turns out I also stumbled into an unrelated issue in the termination checker![^8] -I also found a convoluted hole in the case generator that I had to reach out to -the community for help minimizing (thank you -dunhamsteve!):[idris-lang/Idris2#3466](https://github.com/idris-lang/Idris2/issues/3466)[^9] - I broke the [pack](https://github.com/stefan-hoeck/idris2-pack) package manager by, apparently, being the first person to try and upload a library to `pack-db` with library code in literate files, in my @@ -100,5 +96,3 @@ ecosystem. subset of the language for which termination is a 'trivial' property, which includes most code I've written in the language so far, but not nearly all of it. - -[^9]: It's me, I'm the user on the discord diff --git a/resources/admonitions.css b/resources/admonitions.css deleted file mode 100644 index 801cf4d..0000000 --- a/resources/admonitions.css +++ /dev/null @@ -1,84 +0,0 @@ -/* Universal configuration */ -.note, -.tip, -.important, -.warning, -.caution { - display: flex; - flex-direction: row; - width: 66%; - box-sizing: border-box; - background-color: var(--bg-1); - color: var(--fg-1); - padding: 0.5rem; - border-radius: 1rem; - border: solid 0.5rem; - margin-top: var(--box-margin-vert); - margin-bottom: var(--box-margin-vert); -} -.note .title, -.tip .title, -.important .title, -.warning .title, -.caution .title { - align-self: center; -} -.note .title p, -.tip .title p, -.important .title p, -.warning .title p, -.caution .title p { - font-size: 0; - display: inline-block; - position: relative; -} -.note .title p::before, -.tip .title p::before, -.important .title p::before, -.warning .title p::before, -.caution .title p::before { - font-family: 'boxicons' !important; - font-size: 3rem; - display: inline-block; -} - -/* Notes */ -.note { - border-color: var(--blue); -} -.note .title p::before { - content: "\eb21"; - color: var(--blue); -} -/* Tips */ -.tip { - border-color: var(--green); -} -.tip .title p::before { - content: "\eb0d"; - color: var(--green); -} -/* Importants */ -.important { - border-color: var(--violet); -} -.important .title p::before { - content: "\eb0d"; - color: var(--violet); -} -/* Warnings */ -.warning { - border-color: var(--orange); -} -.warning .title p::before { - content: "\e9a3"; - color: var(--orange); -} -/* Cautions */ -.caution { - border-color: var(--red); -} -.caution .title p::before { - content: "\ee87"; - color: var(--red); -} diff --git a/resources/colors.css b/resources/colors.css index 42db252..5974f21 100644 --- a/resources/colors.css +++ b/resources/colors.css @@ -53,11 +53,10 @@ a:visited { .site-tagline { color: var(--dim-0); } -.post-body, .post-header, .post-blurbs, .tags, .tags .tag-blurb-post, -.series-header, .series-blurbs, .series-list { +.post-body, .post-header, .post-blurbs, .tags, .tags .tag-blurb-post { background-color: var(--bg-0); } -.post-blurb, .tags .tag-blurb, .series-list-blurb { +.post-blurb, .tags .tag-blurb { background-color: var(--bg-1); } :not(.tags) .tag-blurb { @@ -66,15 +65,12 @@ a:visited { :not(.tags) .tag-blurb-post { background-color: var(--bg-1); } -.post-title, .post-blurbs h1, .series-header h1, .series-list h1 { +.post-title, .post-blurbs h1 { color: var(--green); } .post-body h2, .post-body h3, .post-body h4 { color: var(--fg-1); } -.post-info > *, .series-info > * { - background-color: var(--bg-2); -} blockquote { background-color: var(--bg-1); } diff --git a/resources/main.css b/resources/main.css index 3617870..4b54d5e 100644 --- a/resources/main.css +++ b/resources/main.css @@ -27,13 +27,13 @@ } /* Main Body and Post Flexboxs */ -body, .post, .series { +body, .post { display: flex; flex-direction: column; align-items: center; gap: var(--box-gap); } -.post, .series, .series-list { +.post { width: 100%; } @@ -65,17 +65,17 @@ body, .post, .series { flex-wrap: wrap; margin-top: var(--box-margin-vert); } -.header-links > a > span, .post-series-tag > a > span, .post-tag > a > span { +.header-links > a > span { text-decoration: underline; } -.header-links > a, .post-series-tag > a, .post-tag > a { +.header-links > a { text-decoration: none; } /* Style the post header, body, and blurbs */ /* TODO: Style footnotes and get footnote hover working */ -.post-header, .post-body, .series-header { +.post-header, .post-body { display: flex; flex-direction: column; align-items: center; @@ -90,11 +90,11 @@ body, .post, .series { margin: auto var(--box-margin-horz); align-self: stretch; } -.post-title h1, .series-title h1 { +.post-title h1 { margin-top: 0px; margin-bottom: 0px; } -.post-info, .series-info { +.post-info { display: flex; flex-direction: row; align-items: center; @@ -108,7 +108,7 @@ body, .post, .series { .post-body h2, .post-body h3, .post-body h4 { text-align: center; } -.post-blurbs, .series-blurbs, .series-list { +.post-blurbs { display: flex; flex-direction: column; align-items: center; @@ -116,9 +116,8 @@ body, .post, .series { max-width: var(--content-width); padding: var(--box-padding-vert) var(--box-padding-horz); border-radius: var(--box-radius); - box-sizing: border-box; } -.post-blurb, .series-list-blurb { +.post-blurb { width: 100%; display: block; border-radius: var(--box-radius); @@ -129,10 +128,6 @@ body, .post, .series { flex-direction: column; box-sizing: border-box; } -.post-info > *, .series-info > * { - padding: 0.25em; - border-radius: 0.25em; -} /* TODO: Nice fancy blockquotes */ blockquote {