about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/inc/index.htm1
-rw-r--r--src/inc/like.htm22
-rw-r--r--src/inc/like.md10
-rw-r--r--src/main.zig46
4 files changed, 66 insertions, 13 deletions
diff --git a/src/inc/index.htm b/src/inc/index.htm
index fdd90d9..3778d31 100644
--- a/src/inc/index.htm
+++ b/src/inc/index.htm
@@ -1,4 +1,5 @@
 <ul class="col2 captial">
+<li><a href="/site/.index.html">.index</a></li>
 <li><a href="/site/2025.html">2025</a></li>
 <li><a href="/site/404.html">404</a></li>
 <li><a href="/site/about.html">about</a></li>
diff --git a/src/inc/like.htm b/src/inc/like.htm
index 6bc88cb..74fb67d 100644
--- a/src/inc/like.htm
+++ b/src/inc/like.htm
@@ -2,13 +2,21 @@
 <p>here’s some stuff i like:</p>
 <ul>
 <li><a href="https://tailscale.com/blog/plan9-port" class="uri"
-target="_blank">https://tailscale.com/blog/plan9-port</a></li>
+target="_blank">https://tailscale.com/blog/plan9-port</a> <a
+href="https://web.archive.org/web/20250403135024/https://tailscale.com/blog/plan9-port"
+target="_blank"><sup>[?]</sup></a></li>
 <li><a href="https://anniemueller.com/posts/in-praise-of-creating-crap"
 class="uri"
-target="_blank">https://anniemueller.com/posts/in-praise-of-creating-crap</a></li>
+target="_blank">https://anniemueller.com/posts/in-praise-of-creating-crap</a>
+<a
+href="https://web.archive.org/web/20250524011520/https://anniemueller.com/posts/in-praise-of-creating-crap"
+target="_blank"><sup>[?]</sup></a></li>
 <li><a href="https://www.math.uwaterloo.ca/tsp/korea/index.html"
 class="uri"
-target="_blank">https://www.math.uwaterloo.ca/tsp/korea/index.html</a></li>
+target="_blank">https://www.math.uwaterloo.ca/tsp/korea/index.html</a>
+<a
+href="https://web.archive.org/web/20250524011652/https://www.math.uwaterloo.ca/tsp/korea/index.html"
+target="_blank"><sup>[?]</sup></a></li>
 </ul>
 <blockquote>
 <p>It’s not that user experience designers are trying to kill curiosity.
@@ -16,7 +24,9 @@ They’re trying to help. But help, at scale, becomes architecture. And
 architecture shapes cognition. The interfaces we use become metaphors
 for how we think the world works. If your phone always gives you the
 answer, you stop asking better questions.<br />
-<a href="https://www.joanwestenberg.com/how-convenience-kills-curiosity"
-style="float:right"
-target="_blank">https://www.joanwestenberg.com/how-convenience-kills-curiosity</a></p>
+<span class="float-r"><a
+href="https://www.joanwestenberg.com/how-convenience-kills-curiosity"
+class="uri"
+target="_blank">https://www.joanwestenberg.com/how-convenience-kills-curiosity</a>
+<a href="" target="_blank"><sup>[?]</sup></a></span></p>
 </blockquote>
diff --git a/src/inc/like.md b/src/inc/like.md
index f69feb7..1b88327 100644
--- a/src/inc/like.md
+++ b/src/inc/like.md
@@ -1,12 +1,14 @@
 here's some stuff i like:
 
-- https://tailscale.com/blog/plan9-port
-- https://anniemueller.com/posts/in-praise-of-creating-crap
-- https://www.math.uwaterloo.ca/tsp/korea/index.html
+- https://tailscale.com/blog/plan9-port [^[?]^](https://web.archive.org/web/20250403135024/https://tailscale.com/blog/plan9-port)
+- https://anniemueller.com/posts/in-praise-of-creating-crap [^[?]^](https://web.archive.org/web/20250524011520/https://anniemueller.com/posts/in-praise-of-creating-crap)
+- https://www.math.uwaterloo.ca/tsp/korea/index.html [^[?]^](https://web.archive.org/web/20250524011652/https://www.math.uwaterloo.ca/tsp/korea/index.html)
 
 > It’s not that user experience designers are trying to kill curiosity. They’re
 > trying to help. But help, at scale, becomes architecture. And architecture
 > shapes cognition. The interfaces we use become metaphors for how we think the
 > world works. If your phone always gives you the answer, you stop asking
 > better questions.  
-<https://www.joanwestenberg.com/how-convenience-kills-curiosity>{style="float:right"}
+> <span class="float-r"><https://www.joanwestenberg.com/how-convenience-kills-curiosity> [^[?]^]()</span>
+
+
diff --git a/src/main.zig b/src/main.zig
index 64b76d9..e6ed977 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -364,14 +364,54 @@ fn genSite(ctx: *Context) !void {
     }
 }
 
+const FileSwapper = struct {
+    allocator: std.mem.Allocator,
+    target_path: []const u8,
+    tmp_path: []const u8,
+    tmp: std.fs.File,
+
+    fn createAt(allocator: std.mem.Allocator, path: []const u8) !FileSwapper {
+        const target_dir = std.fs.path.dirname(path) orelse ".";
+        const target_name = std.fs.path.basename(path);
+
+        const tmp_name = try std.fmt.allocPrint(allocator, ".{s}", .{target_name});
+        defer allocator.free(tmp_name);
+
+        const tmp_path = try std.fs.path.join(allocator, &.{ target_dir, tmp_name });
+
+        const f = try std.fs.cwd().createFile(tmp_path, .{});
+
+        return .{
+            .allocator = allocator,
+            .target_path = path,
+            .tmp_path = tmp_path,
+            .tmp = f,
+        };
+    }
+
+    fn writer(self: FileSwapper) std.fs.File.Writer {
+        return self.tmp.writer();
+    }
+
+    fn close(self: FileSwapper) void {
+        defer self.allocator.free(self.tmp_path);
+        defer self.tmp.close();
+
+        self.tmp.sync() catch @panic("sync tmp file");
+
+        std.debug.print("??? {s} => {s}\n", .{ self.tmp_path, self.target_path });
+        std.fs.rename(std.fs.cwd(), self.tmp_path, std.fs.cwd(), self.target_path) catch @panic("rename tmp file");
+    }
+};
+
 fn genIndexHtml(ctx: *Context) !void {
     const srcpathIndex = try joinIn(ctx.allocator, &.{PAGE_PATH}, &.{"index.htm"});
     defer ctx.allocator.free(srcpathIndex);
 
-    const f = try std.fs.cwd().createFile(srcpathIndex, .{});
+    const f = try FileSwapper.createAt(ctx.allocator, srcpathIndex);
     defer f.close();
 
-    try f.writeAll(
+    try f.writer().writeAll(
         \\<ul class="col2 captial">
         \\
     );
@@ -404,7 +444,7 @@ fn genIndexHtml(ctx: *Context) !void {
         });
     }
 
-    try f.writeAll(
+    try f.writer().writeAll(
         \\</ul>
         \\
     );