updated docs
This commit is contained in:
@@ -5,13 +5,6 @@ import "core:fmt"
|
||||
import "core:os"
|
||||
import "core:strings"
|
||||
|
||||
/*
|
||||
* WIP files are denoted with an '!' at the start of the file.
|
||||
* This stops the files being processed and uploaded to the site
|
||||
* before you finish writing!
|
||||
*/
|
||||
|
||||
|
||||
BLOG_START_MD := `
|
||||
(\
|
||||
\'\
|
||||
@@ -30,6 +23,10 @@ BLOG_TITLE_MD := `
|
||||
BLOG_BACK_MD := `
|
||||
[<= Back](./..)
|
||||
`
|
||||
|
||||
// Generates the blog index markdown file (blog/index.md) complete with all
|
||||
// current blogs/articles. This is then passed to the 'parse_file_md_to_html'
|
||||
// We do this to make updating the blog index much easier
|
||||
generate_blog_md_file :: proc(path: string, allocator := context.allocator) {
|
||||
blog_list := make([dynamic]string, allocator)
|
||||
sb := strings.builder_make(allocator)
|
||||
@@ -39,10 +36,14 @@ generate_blog_md_file :: proc(path: string, allocator := context.allocator) {
|
||||
strings.write_string(&sb, "blog/")
|
||||
blog_dir := strings.to_string(sb)
|
||||
|
||||
//os.write_string(file, BLOG_START)
|
||||
blogs := walk_tree_and_get_md_names(blog_dir, allocator)
|
||||
|
||||
// *********** BLOG PARSING **************
|
||||
/*
|
||||
* WIP files are denoted with an '!' at the start of the file.
|
||||
* This stops the files being processed and uploaded to the site
|
||||
* before you finish writing!
|
||||
*/
|
||||
for blog in blogs {
|
||||
b := strings.split(blog, blog_dir, allocator = context.temp_allocator)
|
||||
trim_b := strings.trim_right(b[1], ".md")
|
||||
@@ -68,10 +69,11 @@ generate_blog_md_file :: proc(path: string, allocator := context.allocator) {
|
||||
free_all(context.temp_allocator)
|
||||
}
|
||||
|
||||
// sck: Now we create the index.md file.
|
||||
os.change_directory(blog_dir)
|
||||
index_file, err := os.create("index.md")
|
||||
if err != nil {
|
||||
fmt.eprintfln("ERROR in generate_blog_md_file: Could not open file %s: %s", index_file, os.error_string(err))
|
||||
fmt.eprintfln("ERROR in generate_blog_md_file: Could not create file %s: %s", index_file, os.error_string(err))
|
||||
}
|
||||
|
||||
// sck: final step, write everything in the correct order for the index.html page
|
||||
|
||||
Reference in New Issue
Block a user