got sitegen looking at the new docs file

master
Allen Webster 2017-07-10 18:47:12 -04:00
parent c345abaa46
commit 30529f4593
2 changed files with 37 additions and 24 deletions

View File

@ -667,28 +667,30 @@ write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_
Cmd_Image, Cmd_Image,
Cmd_Video, Cmd_Video,
Cmd_EndSection, Cmd_EndSection,
Cmd_DoMetaParse,
// never below this // never below this
Cmd_COUNT, Cmd_COUNT,
}; };
local_persist String enriched_commands[Cmd_COUNT]; local_persist String enriched_commands[Cmd_COUNT];
enriched_commands[Cmd_BackSlash] = make_lit_string("\\"); enriched_commands[Cmd_BackSlash] = make_lit_string("\\");
enriched_commands[Cmd_Version] = make_lit_string("VERSION"); enriched_commands[Cmd_Version] = make_lit_string("VERSION");
enriched_commands[Cmd_BeginStyle] = make_lit_string("BEGIN_STYLE"); enriched_commands[Cmd_BeginStyle] = make_lit_string("BEGIN_STYLE");
enriched_commands[Cmd_EndStyle] = make_lit_string("END_STYLE"); enriched_commands[Cmd_EndStyle] = make_lit_string("END_STYLE");
enriched_commands[Cmd_DocLink] = make_lit_string("DOC_LINK"); enriched_commands[Cmd_DocLink] = make_lit_string("DOC_LINK");
enriched_commands[Cmd_BeginList] = make_lit_string("BEGIN_LIST"); enriched_commands[Cmd_BeginList] = make_lit_string("BEGIN_LIST");
enriched_commands[Cmd_EndList] = make_lit_string("END_LIST"); enriched_commands[Cmd_EndList] = make_lit_string("END_LIST");
enriched_commands[Cmd_BeginItem] = make_lit_string("BEGIN_ITEM"); enriched_commands[Cmd_BeginItem] = make_lit_string("BEGIN_ITEM");
enriched_commands[Cmd_EndItem] = make_lit_string("END_ITEM"); enriched_commands[Cmd_EndItem] = make_lit_string("END_ITEM");
enriched_commands[Cmd_BoldFace] = make_lit_string("BOLD_FACE"); enriched_commands[Cmd_BoldFace] = make_lit_string("BOLD_FACE");
enriched_commands[Cmd_Section] = make_lit_string("SECTION"); enriched_commands[Cmd_Section] = make_lit_string("SECTION");
enriched_commands[Cmd_BeginLink] = make_lit_string("BEGIN_LINK"); enriched_commands[Cmd_BeginLink] = make_lit_string("BEGIN_LINK");
enriched_commands[Cmd_EndLink] = make_lit_string("END_LINK"); enriched_commands[Cmd_EndLink] = make_lit_string("END_LINK");
enriched_commands[Cmd_Image] = make_lit_string("IMAGE"); enriched_commands[Cmd_Image] = make_lit_string("IMAGE");
enriched_commands[Cmd_Video] = make_lit_string("VIDEO"); enriched_commands[Cmd_Video] = make_lit_string("VIDEO");
enriched_commands[Cmd_EndSection] = make_lit_string("END_SECTION"); enriched_commands[Cmd_EndSection] = make_lit_string("END_SECTION");
enriched_commands[Cmd_DoMetaParse] = make_lit_string("META_PARSE");
i = command_end; i = command_end;

View File

@ -225,13 +225,18 @@ generate_4coder_docs(Document_System *doc_system, char *code_directory, char *sr
} }
internal Abstract_Item* 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); Enriched_Text *home = fm_push_array(Enriched_Text, 1);
*home = load_enriched_text(src_directory, source_text); *home = load_enriched_text(src_directory, source_text);
Abstract_Item *doc = begin_document_description(doc_system, big_title, small_name, 0); Abstract_Item *doc = begin_document_description(doc_system, big_title, small_name, 0);
add_enriched_text(doc, home); if (doc != 0){
end_document_description(doc); 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); 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_4coder_docs(&doc_system, code_directory, src_directory);
generate_page(&doc_system, src_directory, "home.txt" , "4coder Home" , "home" ); char *cdir = code_directory;
generate_page(&doc_system, src_directory, "feature_list.txt", "4coder Feature List", "features" ); char *sdir = src_directory;
generate_page(&doc_system, src_directory, "binding_list.txt", "4coder Binding List", "bindings" ); Document_System *docs = &doc_system;
generate_page(&doc_system, src_directory, "roadmap.txt" , "4coder Roadmap" , "roadmap" );
generate_page(&doc_system, src_directory, "tutorials.txt" , "4coder Tutorials" , "tutorials" ); // 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; for (Basic_Node *node = doc_system.doc_list.head;
node != 0; node != 0;