From 78767c69159a2986550e3c5af955aa8c3608dfce Mon Sep 17 00:00:00 2001 From: Alexander Goussas Date: Sun, 19 Apr 2026 19:46:58 -0500 Subject: [PATCH] update site styling --- bin/blog-processor/src/html_formatter.zig | 10 ++++- bin/blog-processor/src/markdown_parser.zig | 36 +++++++-------- ...ow-i-read-500-page-books-in-a-weekend.html | 44 ------------------- posts/06-05-2026-language-checkpoint-april.md | 33 -------------- public/index.html | 27 ++++++++++-- public/styles.css | 32 +++++++++++++- templates/index.html | 4 ++ 7 files changed, 86 insertions(+), 100 deletions(-) delete mode 100644 posts/05-05-2026-how-i-read-500-page-books-in-a-weekend.html delete mode 100644 posts/06-05-2026-language-checkpoint-april.md diff --git a/bin/blog-processor/src/html_formatter.zig b/bin/blog-processor/src/html_formatter.zig index 95d6be3..c3b6c96 100644 --- a/bin/blog-processor/src/html_formatter.zig +++ b/bin/blog-processor/src/html_formatter.zig @@ -43,9 +43,17 @@ pub const HtmlFormatter = struct { } if (self.opts.template) |t| { + // TODO: Avoid so many allocations. const replaced = try strings.replace(alloc, t, "{body}", self.buffer.items); self.buffer.deinit(alloc); - self.buffer = std.ArrayList(u8).fromOwnedSlice(replaced); + defer alloc.free(replaced); + + const withTitle = try strings.replace(alloc, replaced, "{title}", doc.title); + defer alloc.free(withTitle); + + const withDate = try strings.replace(alloc, withTitle, "{date}", doc.date); + + self.buffer = std.ArrayList(u8).fromOwnedSlice(withDate); } return self.buffer.items; diff --git a/bin/blog-processor/src/markdown_parser.zig b/bin/blog-processor/src/markdown_parser.zig index 6e5a030..a03da58 100644 --- a/bin/blog-processor/src/markdown_parser.zig +++ b/bin/blog-processor/src/markdown_parser.zig @@ -14,8 +14,8 @@ const MarkdownNode = union(enum) { }; pub const MarkdownDoc = struct { + title: []const u8, date: []const u8, - summary: []const u8, content: std.ArrayList(MarkdownNode), pub fn deinit(self: *@This(), alloc: std.mem.Allocator) void { @@ -26,22 +26,22 @@ pub const MarkdownDoc = struct { var start: usize = 0; var current: usize = 0; + var title: []const u8 = undefined; var date: []const u8 = undefined; - var summary: []const u8 = undefined; var nodes: std.ArrayList(MarkdownNode) = .empty; while (current < doc.len) { start = current; const c = doc[current]; switch (c) { - '-' => try parse_frontmatter(¤t, doc, &date, &summary), + '-' => try parse_frontmatter(¤t, doc, &title, &date), else => try parse_body(alloc, doc, ¤t, &nodes), } } return .{ + .title = title, .date = date, - .summary = summary, .content = nodes, }; } @@ -128,16 +128,16 @@ pub const MarkdownDoc = struct { fn parse_frontmatter( current: *usize, doc: []const u8, - date: *[]const u8, - summary: *[]const u8, + title: *[]const u8, + date: *[]const u8, ) MarkdownParserError!void { assert(doc[current.*] == '-'); advanceWhile(doc, current, '-'); try expectToken(doc, '\n', current); + try parse_frontmatter_value(current, doc, title); try parse_frontmatter_value(current, doc, date); - try parse_frontmatter_value(current, doc, summary); try expectToken(doc, '-', current); advanceWhile(doc, current, '-'); @@ -194,8 +194,8 @@ pub const MarkdownDoc = struct { test "can parse date in frontmatter" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- ; @@ -206,11 +206,11 @@ test "can parse date in frontmatter" { try std.testing.expectEqualStrings("12/04/2026", result.date); } -test "can parse summary in frontmatter" { +test "can parse title in frontmatter" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- ; @@ -218,14 +218,14 @@ test "can parse summary in frontmatter" { const result = comptime MarkdownDoc.parse(doc, alloc) catch unreachable; - try std.testing.expectEqualStrings("This is the shit!", result.summary); + try std.testing.expectEqualStrings("This is the shit!", result.title); } test "can parse h1 in body without newline at end" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\ \\# The Post's Title @@ -243,8 +243,8 @@ test "can parse h1 in body without newline at end" { test "can parse h2 in body without newline at end" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\ \\## The Post's Subtitle @@ -262,8 +262,8 @@ test "can parse h2 in body without newline at end" { test "can parse single multi-line paragraph at the beginning of document" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\ \\Hello world, @@ -282,8 +282,8 @@ test "can parse single multi-line paragraph at the beginning of document" { test "can parse two single-line paragraphs at the beginning of document" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\ \\Hello world, @@ -304,8 +304,8 @@ test "can parse two single-line paragraphs at the beginning of document" { test "can parse single-line paragraph and multi-line parapgraphs at once at the beginning of document" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\ \\Hello world, @@ -327,8 +327,8 @@ test "can parse single-line paragraph and multi-line parapgraphs at once at the test "can parse a header and paragraph" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\# Post title \\ @@ -352,8 +352,8 @@ test "can parse a header and paragraph" { test "can parse two consecutive paragraphs" { const doc = \\---- + \\title: This is the shit! \\date: 12/04/2026 - \\summary: This is the shit! \\---- \\Hello world, \\ diff --git a/posts/05-05-2026-how-i-read-500-page-books-in-a-weekend.html b/posts/05-05-2026-how-i-read-500-page-books-in-a-weekend.html deleted file mode 100644 index 61660e9..0000000 --- a/posts/05-05-2026-how-i-read-500-page-books-in-a-weekend.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - Alexander Goussas | Programming - - - - - - - - -

How I Read 500 Page Books in a Weekend

-

- There are two types of books that I can read in a weekend, no matter how large they are: - programming [language] books and fantasy books that I'm hooked. The latter is self-explanatory, - I think, but the former might require some explanation. -

-

- The thing is, most programming languages hide the same semantics behind different syntax. - For example, right now I am reading a Zig book. I am already fairly experienced with C and C++, - so I don't need to waste time reading how pointers and memory allocation works. I just need to know - how to do these things with Zig's syntax. -

-

- Thus, I can skim/skip most of the content. Now, I do skim most of the times rather than skipping, because - there might something that I don't know, some way in which the semantics of the concept changes for - this programming language. So, I do read everything, I just do it super fast. -

-

- Another point is that most of the times, if a programming book is 500 pages long, chances are most of its - contents is not 100% relevant. The book I'm reading right now for example is full with the author's "humor." - Humor in programming books is welcomed, at least by me, in sparse quantities. If I wanted to laugh I'd listen to - audios of americans trying to speak French instead. -

-

- So yeah, the key to reading programming books fast is reading so many of them that you can skim/skip a lot. - And in terms of fiction or whatever you like reading, the key is liking the book and not having social life. -

- - - diff --git a/posts/06-05-2026-language-checkpoint-april.md b/posts/06-05-2026-language-checkpoint-april.md deleted file mode 100644 index f52fe66..0000000 --- a/posts/06-05-2026-language-checkpoint-april.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Language Checkpoint April -summary: shit ---- - -This is my April 2026 language checkpoint. - -## Spanish - -I can still speak it. I think. I think I did not speak any Spanish today at all. Yikes. - -## English - -Good. - -## French - -I can understand 99% of what I hear without any effort at all. The same goes for reading, depending on what I'm -reading of course. Last test I had was reading "La Bête Humaine" by Zola and I knew 99% of the words. Speaking -is still my greatest weakness, but last Sunday I spoke one hour with my new Russian friend Valery and I'm pretty -proud of how I expressed myself. - -## German - -I can now understand 99% of what is said in the Easy German Podcast. I think the use easy language there, for the -surprise of no one I guess. I say this because most YouTube content targeted for a German audience still sounds like -gibberish to me haha. I'm starting to get a grasp of the form of German, grammar is starting to become more natural. -I can write about my day without much trouble. - -## Portuguese - -My Portuguese is my greatest shame, honestly. I cannot get myself to practice it seriously outside of work. I'll -get there eventually, I swear. diff --git a/public/index.html b/public/index.html index f61c146..0fbc663 100644 --- a/public/index.html +++ b/public/index.html @@ -7,15 +7,36 @@ - + -

Alexander Goussas

-

Blog about programming and friends

+
+ +
+ +

Alexander Goussas

+

Blog about programming and friends

+

Posts

diff --git a/public/styles.css b/public/styles.css index ec02c07..d4cd95b 100644 --- a/public/styles.css +++ b/public/styles.css @@ -3,12 +3,42 @@ body { margin: auto; margin-top: 1rem; margin-bottom: 1rem; + background-color: black; + color: white; } -h1, h2 { +h1 { text-align: center; } +h1 { + color: yellow; +} + +h2 { + color: green; +} + a { text-decoration: underline; } + +nav { + ul { + list-style: none; + display: flex; + justify-content: space-between; + } +} + +.nav-item { + background-color: #ff0000; + padding: 1rem; + width: fit-content; + border: 2px solid black; + box-shadow: + inset rgba(0 0 0 / 20%) 5px 0px, + inset rgba(0 0 0 / 20%) -5px 0px, + inset rgba(0 0 0 / 20%) 0px -5px, + inset rgba(255 255 255 / 40%) 0px 5px; +} diff --git a/templates/index.html b/templates/index.html index 22e7489..419c963 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,6 +7,10 @@
+

{title}

+
+ Last updated: {date} +
{body}
-- 2.43.0