From 30529f4593c846da6009e5e8f617624df55235ec Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 10 Jul 2017 18:47:12 -0400 Subject: [PATCH] got sitegen looking at the new docs file --- site/4ed_abstract_document.cpp | 34 ++++++++++++++++++---------------- site/4ed_sitegen.cpp | 27 +++++++++++++++++++-------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/site/4ed_abstract_document.cpp b/site/4ed_abstract_document.cpp index 753d8107..c3616a47 100644 --- a/site/4ed_abstract_document.cpp +++ b/site/4ed_abstract_document.cpp @@ -667,28 +667,30 @@ write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_ Cmd_Image, Cmd_Video, Cmd_EndSection, + Cmd_DoMetaParse, // never below this Cmd_COUNT, }; local_persist String enriched_commands[Cmd_COUNT]; - enriched_commands[Cmd_BackSlash] = make_lit_string("\\"); - enriched_commands[Cmd_Version] = make_lit_string("VERSION"); - enriched_commands[Cmd_BeginStyle] = make_lit_string("BEGIN_STYLE"); - enriched_commands[Cmd_EndStyle] = make_lit_string("END_STYLE"); - enriched_commands[Cmd_DocLink] = make_lit_string("DOC_LINK"); - enriched_commands[Cmd_BeginList] = make_lit_string("BEGIN_LIST"); - enriched_commands[Cmd_EndList] = make_lit_string("END_LIST"); - enriched_commands[Cmd_BeginItem] = make_lit_string("BEGIN_ITEM"); - enriched_commands[Cmd_EndItem] = make_lit_string("END_ITEM"); - enriched_commands[Cmd_BoldFace] = make_lit_string("BOLD_FACE"); - enriched_commands[Cmd_Section] = make_lit_string("SECTION"); - enriched_commands[Cmd_BeginLink] = make_lit_string("BEGIN_LINK"); - enriched_commands[Cmd_EndLink] = make_lit_string("END_LINK"); - enriched_commands[Cmd_Image] = make_lit_string("IMAGE"); - enriched_commands[Cmd_Video] = make_lit_string("VIDEO"); - enriched_commands[Cmd_EndSection] = make_lit_string("END_SECTION"); + enriched_commands[Cmd_BackSlash] = make_lit_string("\\"); + enriched_commands[Cmd_Version] = make_lit_string("VERSION"); + enriched_commands[Cmd_BeginStyle] = make_lit_string("BEGIN_STYLE"); + enriched_commands[Cmd_EndStyle] = make_lit_string("END_STYLE"); + enriched_commands[Cmd_DocLink] = make_lit_string("DOC_LINK"); + enriched_commands[Cmd_BeginList] = make_lit_string("BEGIN_LIST"); + enriched_commands[Cmd_EndList] = make_lit_string("END_LIST"); + enriched_commands[Cmd_BeginItem] = make_lit_string("BEGIN_ITEM"); + enriched_commands[Cmd_EndItem] = make_lit_string("END_ITEM"); + enriched_commands[Cmd_BoldFace] = make_lit_string("BOLD_FACE"); + enriched_commands[Cmd_Section] = make_lit_string("SECTION"); + enriched_commands[Cmd_BeginLink] = make_lit_string("BEGIN_LINK"); + enriched_commands[Cmd_EndLink] = make_lit_string("END_LINK"); + enriched_commands[Cmd_Image] = make_lit_string("IMAGE"); + enriched_commands[Cmd_Video] = make_lit_string("VIDEO"); + enriched_commands[Cmd_EndSection] = make_lit_string("END_SECTION"); + enriched_commands[Cmd_DoMetaParse] = make_lit_string("META_PARSE"); i = command_end; diff --git a/site/4ed_sitegen.cpp b/site/4ed_sitegen.cpp index be6c5314..662fcfee 100644 --- a/site/4ed_sitegen.cpp +++ b/site/4ed_sitegen.cpp @@ -225,13 +225,18 @@ generate_4coder_docs(Document_System *doc_system, char *code_directory, char *sr } internal Abstract_Item* -generate_page(Document_System *doc_system, char *src_directory, char *source_text, char *big_title, char *small_name){ +generate_page(Document_System *doc_system, char *code_directory, char *src_directory, char *source_text, char *big_title, char *small_name){ Enriched_Text *home = fm_push_array(Enriched_Text, 1); *home = load_enriched_text(src_directory, source_text); Abstract_Item *doc = begin_document_description(doc_system, big_title, small_name, 0); - add_enriched_text(doc, home); - end_document_description(doc); + if (doc != 0){ + add_enriched_text(doc, home); + end_document_description(doc); + } + else{ + fprintf(stdout, "warning: could not create document %s from file %s\n", small_name, source_text); + } return(doc); } @@ -308,11 +313,17 @@ generate_site(char *code_directory, char *asset_directory, char *src_directory, generate_4coder_docs(&doc_system, code_directory, src_directory); - generate_page(&doc_system, src_directory, "home.txt" , "4coder Home" , "home" ); - generate_page(&doc_system, src_directory, "feature_list.txt", "4coder Feature List", "features" ); - generate_page(&doc_system, src_directory, "binding_list.txt", "4coder Binding List", "bindings" ); - generate_page(&doc_system, src_directory, "roadmap.txt" , "4coder Roadmap" , "roadmap" ); - generate_page(&doc_system, src_directory, "tutorials.txt" , "4coder Tutorials" , "tutorials" ); + char *cdir = code_directory; + char *sdir = src_directory; + Document_System *docs = &doc_system; + + // TODO(allen): From the text file get the "Big Title" and "smallname". + generate_page(docs, cdir, sdir, "home.txt" , "4coder Home" , "home" ); + generate_page(docs, cdir, sdir, "docs.txt" , "4coder API Docs" , "custom_docs_2" ); + generate_page(docs, cdir, sdir, "feature_list.txt", "4coder Feature List", "features" ); + generate_page(docs, cdir, sdir, "binding_list.txt", "4coder Binding List", "bindings" ); + generate_page(docs, cdir, sdir, "roadmap.txt" , "4coder Roadmap" , "roadmap" ); + generate_page(docs, cdir, sdir, "tutorials.txt" , "4coder Tutorials" , "tutorials" ); for (Basic_Node *node = doc_system.doc_list.head; node != 0;