Logo

index : blog

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/blog.git/html/src/gen/blog.h blob: 00c81b7e0b4202e719b433f08da42903f6a27eb5 [raw] [clear marker]

        
0
1
2
3Copy_File :: struct {
4 src: string;
5 dest: string;
6}
7
8Markdown_File :: struct {
9 fn: string;
10 content: string;
11}
12
13
14make_date :: (cal: Calendar_Time) -> string {
15 day := string_pad_left(
16 tprint("%", cal.day_of_month_starting_at_0 + 1),
17 2, "0"
18 );
19 month := string_pad_left(
20 tprint("%", cal.month_starting_at_0 + 1),
21 2, "0"
22 );
23 return tprint("%1.%2.%3", day, month, cal.year);
24}
25
26template_read_or_exit :: (fp: string, extension := "html") -> string {
27 path := tprint("%/%.%", DIR_TEMPLATES, fp, extension);
28 return file_open_or_exit(path);
29}
30
31file_write_or_exit :: (fp: string, data: string) {
32 ok := write_entire_file(fp, data);
33 if !ok {
34 log_error("Could not write file: %", fp);
35 exit(1);
36 }
37}
38
39file_open_or_exit :: (fp: string) -> string {
40 file, ok := read_entire_file(fp);
41
42 if !ok {
43 log_error("Could not read file: %", file);
44 exit(1);
45 }
46
47 return file;
48}
49
50
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit