added cond. to add hljs to blogs only

This commit is contained in:
Simon Kellet
2026-08-23 13:41:01 +01:00
parent c0b195ffd0
commit 200d3d376a
+11
View File
@@ -16,12 +16,23 @@ HIGHLIGHT_JS_PREFIX :: "<script type=\"text/javascript\" src=\"https://unpkg.com
write_prefixs_to_html_file :: proc(file: ^os.File) { write_prefixs_to_html_file :: proc(file: ^os.File) {
file_info, err := os.fstat(file, context.temp_allocator)
if err != nil {
fmt.eprintfln("ERROR in write_prefixs_to_html_file: Could not open file %s: %s", file, os.error_string(err))
}
defer free_all(context.temp_allocator) //clean up file_info
os.write_string(file, UTF8_PREFIX) os.write_string(file, UTF8_PREFIX)
os.write_string(file, CSS_PREFIX) os.write_string(file, CSS_PREFIX)
os.write_string(file, FAVICON_PREFIX) os.write_string(file, FAVICON_PREFIX)
os.write_string(file, MASTODON_PREFIX) os.write_string(file, MASTODON_PREFIX)
// sck: ONLY apply hljs to blogs/articles. These files will always
// start with a "2" (2026-xx-xx...)
if strings.starts_with(file_info.name, "2") {
os.write_string(file, HIGHLIGHT_JS_PREFIX) os.write_string(file, HIGHLIGHT_JS_PREFIX)
} }
}
walk_tree_and_get_md_names :: proc(path: string, allocator := context.allocator) -> [dynamic]string { walk_tree_and_get_md_names :: proc(path: string, allocator := context.allocator) -> [dynamic]string {
files := make([dynamic]string, allocator) files := make([dynamic]string, allocator)