Something went wrong. Try again.
experimental project for a static site generator in zig
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132const std = @import("std");const Io = std.Io;const lib = @import("zig_blog");
pub fn main(init: std.process.Init) !void { // This is appropriate for anything that lives as long as the process. const arena: std.mem.Allocator = init.arena.allocator();
// Accessing command line arguments: const args = try init.minimal.args.toSlice(arena); for (args) |arg| { std.log.info("arg: {s}", .{arg}); }
// In order to do I/O operations need an `Io` instance. const io = init.io;
// Stdout is for the actual output of your application, for example if you // are implementing gzip, then only the compressed bytes should be sent to // stdout, not any debugging messages. var stdout_buffer: [1024]u8 = undefined; var stdout_file_writer: Io.File.Writer = .init(.stdout(), io, &stdout_buffer); const stdout_writer = &stdout_file_writer.interface;
// Open our blog post var read_buff: [10248]u8 = undefined; const content = try std.Io.Dir.readFile(std.Io.Dir.cwd(), io, "blog_post.md", &read_buff);
_ = try lib.article.Article.fromStr(content); try stdout_writer.flush(); // Don't forget to flush!}