From d117c7fcf5e000dc85436f1c8b5102400cbc9ae3 Mon Sep 17 00:00:00 2001
From: Allen Webster
Date: Mon, 17 Jul 2017 16:43:01 -0400
Subject: [PATCH] finished site update, switching over to API cleanup
---
4coder_API/app_functions.h | 28 +-
4coder_helper/4coder_helper.h | 2 +
4ed_api_implementation.cpp | 74 +--
site/4ed_abstract_document.cpp | 819 +++++++++++---------------
site/4ed_sitegen.cpp | 18 +-
site/source_material/binding_list.txt | 297 +++++-----
site/source_material/docs.txt | 44 +-
site/source_material/feature_list.txt | 100 ++--
site/source_material/home.txt | 18 +-
site/source_material/introduction.txt | 2 +-
site/source_material/roadmap.txt | 56 +-
site/source_material/site_header.txt | 12 +
site/source_material/tutorials.txt | 4 +-
13 files changed, 641 insertions(+), 833 deletions(-)
create mode 100644 site/source_material/site_header.txt
diff --git a/4coder_API/app_functions.h b/4coder_API/app_functions.h
index 7ab8f1c2..89b2f12a 100644
--- a/4coder_API/app_functions.h
+++ b/4coder_API/app_functions.h
@@ -27,9 +27,7 @@ struct Application_Links;
#define BUFFER_READ_TOKENS_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out)
#define BUFFER_GET_TOKEN_INDEX_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result)
#define BUFFER_SEND_END_SIGNAL_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer)
-#define BEGIN_BUFFER_CREATION_SIG(n) bool32 n(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags)
-#define BUFFER_CREATION_NAME_SIG(n) bool32 n(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags)
-#define END_BUFFER_CREATION_SIG(n) Buffer_Summary n(Application_Links *app, Buffer_Creation_Data *data)
+#define CREATE_BUFFER_SIG(n) Buffer_Summary n(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags)
#define SAVE_BUFFER_SIG(n) bool32 n(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags)
#define KILL_BUFFER_SIG(n) bool32 n(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags)
#define GET_VIEW_FIRST_SIG(n) View_Summary n(Application_Links *app, Access_Flag access)
@@ -105,9 +103,7 @@ typedef BUFFER_TOKEN_COUNT_SIG(Buffer_Token_Count_Function);
typedef BUFFER_READ_TOKENS_SIG(Buffer_Read_Tokens_Function);
typedef BUFFER_GET_TOKEN_INDEX_SIG(Buffer_Get_Token_Index_Function);
typedef BUFFER_SEND_END_SIGNAL_SIG(Buffer_Send_End_Signal_Function);
-typedef BEGIN_BUFFER_CREATION_SIG(Begin_Buffer_Creation_Function);
-typedef BUFFER_CREATION_NAME_SIG(Buffer_Creation_Name_Function);
-typedef END_BUFFER_CREATION_SIG(End_Buffer_Creation_Function);
+typedef CREATE_BUFFER_SIG(Create_Buffer_Function);
typedef SAVE_BUFFER_SIG(Save_Buffer_Function);
typedef KILL_BUFFER_SIG(Kill_Buffer_Function);
typedef GET_VIEW_FIRST_SIG(Get_View_First_Function);
@@ -185,9 +181,7 @@ Buffer_Token_Count_Function *buffer_token_count;
Buffer_Read_Tokens_Function *buffer_read_tokens;
Buffer_Get_Token_Index_Function *buffer_get_token_index;
Buffer_Send_End_Signal_Function *buffer_send_end_signal;
-Begin_Buffer_Creation_Function *begin_buffer_creation;
-Buffer_Creation_Name_Function *buffer_creation_name;
-End_Buffer_Creation_Function *end_buffer_creation;
+Create_Buffer_Function *create_buffer;
Save_Buffer_Function *save_buffer;
Kill_Buffer_Function *kill_buffer;
Get_View_First_Function *get_view_first;
@@ -264,9 +258,7 @@ Buffer_Token_Count_Function *buffer_token_count_;
Buffer_Read_Tokens_Function *buffer_read_tokens_;
Buffer_Get_Token_Index_Function *buffer_get_token_index_;
Buffer_Send_End_Signal_Function *buffer_send_end_signal_;
-Begin_Buffer_Creation_Function *begin_buffer_creation_;
-Buffer_Creation_Name_Function *buffer_creation_name_;
-End_Buffer_Creation_Function *end_buffer_creation_;
+Create_Buffer_Function *create_buffer_;
Save_Buffer_Function *save_buffer_;
Kill_Buffer_Function *kill_buffer_;
Get_View_First_Function *get_view_first_;
@@ -351,9 +343,7 @@ app_links->buffer_token_count_ = Buffer_Token_Count;\
app_links->buffer_read_tokens_ = Buffer_Read_Tokens;\
app_links->buffer_get_token_index_ = Buffer_Get_Token_Index;\
app_links->buffer_send_end_signal_ = Buffer_Send_End_Signal;\
-app_links->begin_buffer_creation_ = Begin_Buffer_Creation;\
-app_links->buffer_creation_name_ = Buffer_Creation_Name;\
-app_links->end_buffer_creation_ = End_Buffer_Creation;\
+app_links->create_buffer_ = Create_Buffer;\
app_links->save_buffer_ = Save_Buffer;\
app_links->kill_buffer_ = Kill_Buffer;\
app_links->get_view_first_ = Get_View_First;\
@@ -430,9 +420,7 @@ static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary
static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens(app, buffer, start_token, end_token, tokens_out));}
static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index(app, buffer, pos, get_result));}
static inline bool32 buffer_send_end_signal(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_send_end_signal(app, buffer));}
-static inline bool32 begin_buffer_creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){return(app->begin_buffer_creation(app, data, flags));}
-static inline bool32 buffer_creation_name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){return(app->buffer_creation_name(app, data, filename, filename_len, flags));}
-static inline Buffer_Summary end_buffer_creation(Application_Links *app, Buffer_Creation_Data *data){return(app->end_buffer_creation(app, data));}
+static inline Buffer_Summary create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){return(app->create_buffer(app, filename, filename_len, flags));}
static inline bool32 save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags){return(app->save_buffer(app, buffer, filename, filename_len, flags));}
static inline bool32 kill_buffer(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags){return(app->kill_buffer(app, buffer, view_id, flags));}
static inline View_Summary get_view_first(Application_Links *app, Access_Flag access){return(app->get_view_first(app, access));}
@@ -509,9 +497,7 @@ static inline int32_t buffer_token_count(Application_Links *app, Buffer_Summary
static inline bool32 buffer_read_tokens(Application_Links *app, Buffer_Summary *buffer, int32_t start_token, int32_t end_token, Cpp_Token *tokens_out){return(app->buffer_read_tokens_(app, buffer, start_token, end_token, tokens_out));}
static inline bool32 buffer_get_token_index(Application_Links *app, Buffer_Summary *buffer, int32_t pos, Cpp_Get_Token_Result *get_result){return(app->buffer_get_token_index_(app, buffer, pos, get_result));}
static inline bool32 buffer_send_end_signal(Application_Links *app, Buffer_Summary *buffer){return(app->buffer_send_end_signal_(app, buffer));}
-static inline bool32 begin_buffer_creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags){return(app->begin_buffer_creation_(app, data, flags));}
-static inline bool32 buffer_creation_name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags){return(app->buffer_creation_name_(app, data, filename, filename_len, flags));}
-static inline Buffer_Summary end_buffer_creation(Application_Links *app, Buffer_Creation_Data *data){return(app->end_buffer_creation_(app, data));}
+static inline Buffer_Summary create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){return(app->create_buffer_(app, filename, filename_len, flags));}
static inline bool32 save_buffer(Application_Links *app, Buffer_Summary *buffer, char *filename, int32_t filename_len, uint32_t flags){return(app->save_buffer_(app, buffer, filename, filename_len, flags));}
static inline bool32 kill_buffer(Application_Links *app, Buffer_Identifier buffer, View_ID view_id, Buffer_Kill_Flag flags){return(app->kill_buffer_(app, buffer, view_id, flags));}
static inline View_Summary get_view_first(Application_Links *app, Access_Flag access){return(app->get_view_first_(app, access));}
diff --git a/4coder_helper/4coder_helper.h b/4coder_helper/4coder_helper.h
index 9f8cf812..0f492a94 100644
--- a/4coder_helper/4coder_helper.h
+++ b/4coder_helper/4coder_helper.h
@@ -178,6 +178,7 @@ buffer_identifier(Buffer_ID id){
return(identifier);
}
+#if 0
static Buffer_Summary
create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){
Buffer_Summary buffer = {0};
@@ -189,6 +190,7 @@ create_buffer(Application_Links *app, char *filename, int32_t filename_len, Buff
return(buffer);
}
+#endif
static Range
make_range(int32_t p1, int32_t p2){
diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp
index cca22b59..d20aaaf7 100644
--- a/4ed_api_implementation.cpp
+++ b/4ed_api_implementation.cpp
@@ -754,7 +754,7 @@ DOC_PARAM(edits, This parameter provides about the source string and destination
DOC_PARAM(edit_count, This parameter specifies the number of Buffer_Edit structs in edits.)
DOC_PARAM(type, This prameter specifies what type of batch edit to execute.)
DOC_RETURN(This call returns non-zero if the batch edit succeeds. This call can fail if the provided buffer summary does not refer to an actual buffer in 4coder.)
-DOC(TODO)
+DOC(Apply an array of edits all at once. This combines all the edits into one undo operation.)
DOC_SEE(Buffer_Edit)
DOC_SEE(Buffer_Batch_Edit_Type)
*/{
@@ -1225,61 +1225,8 @@ DOC(Whenever a buffer is killed an end signal is sent which triggers the end fil
return(result);
}
-// TODO(allen): Buffer_Creation_Flag
-API_EXPORT bool32
-Begin_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data, Buffer_Create_Flag flags)
-/*
-DOC_PARAM(data, a local user handle for the buffer creation process)
-DOC_PARAM(flags, flags defining the buffer creation behavior)
-
-DOC(Begins a buffer creation by initializing a Buffer_Creation_Data struct. The buffer is not actually created until end_buffer_creation is called.)
-
-DOC_SEE(buffer_creation_name)
-DOC_SEE(end_buffer_creation)
-
-DOC_SEE(Buffer_Creation_Data)
-DOC_SEE(Buffer_Create_Flag)
-*/{
- bool32 result = 0;
- if (data){
- data->flags = flags;
- result = 1;
- }
- return(result);
-}
-
-API_EXPORT bool32
-Buffer_Creation_Name(Application_Links *app, Buffer_Creation_Data *data, char *filename, int32_t filename_len, uint32_t flags)
-/*
-DOC_PARAM(data, a local user handle for buffer creation that has already been initialized by begin_buffer_creation)
-DOC_PARAM(filename, the name to associate to the buffer; This string need not be null terminated.)
-DOC_PARAM(filename_len, the length of the filename string)
-DOC_PARAM(flags, not currently used this should be 0)
-
-DOC(This call sets the name associated to the buffer. If the name is a filename, that filename will be used for loading and saving with the disk, and the buffer name will be extracted from the filename. If the name is not a filename it will be an unassociated buffer and the buffer name will be exactly set to filename.)
-
-DOC_SEE(begin_buffer_creation)
-DOC_SEE(end_buffer_creation)
-*/{
- bool32 result = 0;
- if (data){
- String fname = make_fixed_width_string(data->fname_space);
- copy_ss(&fname, make_string(filename, filename_len));
- data->fname_len = filename_len;
- result = 1;
- }
- return(result);
-}
-
API_EXPORT Buffer_Summary
-End_Buffer_Creation(Application_Links *app, Buffer_Creation_Data *data)
-/*
-DOC_PARAM(data, a local user handle for buffer creation that has already been initialized by begin_buffer_creation and used in subsequent buffer creation flags)
-
-DOC_RETURN(Returns a summary of the newly created buffer or of the existing buffer that already has the specified name. If there is not enough creation data to make the buffer the returned summary will be null.)
-
-DOC_SEE(begin_buffer_creation)
-*/{
+Create_Buffer(Application_Links *app, char *filename, int32_t filename_len, Buffer_Create_Flag flags){
PRFL_FUNC_GROUP();
Command_Data *cmd = (Command_Data*)app->cmd_context;
@@ -1291,8 +1238,8 @@ DOC_SEE(begin_buffer_creation)
Buffer_Summary result = {0};
- if (data != 0 && data->fname_len > 0){
- String fname = make_string(data->fname_space, data->fname_len);
+ if (filename_len > 0){
+ String fname = make_string(filename, filename_len);
Editing_File *file = 0;
b32 do_new_file = false;
@@ -1312,8 +1259,6 @@ DOC_SEE(begin_buffer_creation)
file = working_set_name_contains(working_set, fname);
}
- u32 flags = data->flags;
-
if (file == 0){
if (!do_new_file){
if (flags & BufferCreate_AlwaysNew){
@@ -1914,12 +1859,7 @@ DOC_PARAM(view, The view parameter specifies the view in which to set the cursor
DOC_PARAM(seek, The seek parameter specifies the target position for the seek.)
DOC_PARAM(set_preferred_x, If this parameter is true the preferred x is updated to match the new cursor x.)
DOC_RETURN(This call returns non-zero on success.)
-DOC
-(
-This call sets the the view's cursor position. set_preferred_x should usually be true
-unless the change in cursor position is is a vertical motion that tries to keep the
-cursor in the same column or x position.
-)
+DOC(This call sets the the view's cursor position. set_preferred_x should usually be true unless the change in cursor position is is a vertical motion that tries to keep the cursor in the same column or x position.)
DOC_SEE(Buffer_Seek)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
@@ -1945,7 +1885,9 @@ DOC_SEE(Buffer_Seek)
API_EXPORT bool32
View_Set_Scroll(Application_Links *app, View_Summary *view, GUI_Scroll_Vars scroll)
/*
-DOC(TODO)
+DOC_PARAM(view, The view on which to change the scroll state.)
+DOC_PARAM(scroll, The new scroll position for the view.)
+DOC(Set the scrolling state of the view.)
DOC_SEE(GUI_Scroll_Vars)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
diff --git a/site/4ed_abstract_document.cpp b/site/4ed_abstract_document.cpp
index a701836d..8f2401d5 100644
--- a/site/4ed_abstract_document.cpp
+++ b/site/4ed_abstract_document.cpp
@@ -9,6 +9,25 @@
// TOP
+internal char*
+get_null_terminated_version(String str){
+ char *ptr = 0;
+ if (str.size > 0){
+ if (terminate_with_null(&str)){
+ ptr = str.str;
+ }
+ else{
+ String b = str_alloc(str.size + 1);
+ copy(&b, str);
+ terminate_with_null(&b);
+ ptr = b.str;
+ }
+ }
+ return(ptr);
+}
+
+////////////////////////////////
+
struct Enriched_Text{
String fname;
String source;
@@ -92,19 +111,15 @@ enum{
Doc_TableOfContents,
Doc_PlainOldText,
Doc_Version,
- Doc_BeginStyle,
- Doc_EndStyle,
+ Doc_Style,
Doc_DocumentLink,
- Doc_BeginLink,
- Doc_EndLink,
+ Doc_Link,
Doc_Image,
Doc_Video,
Doc_BeginParagraph,
Doc_EndParagraph,
- Doc_BeginList,
- Doc_EndList,
- Doc_BeginItem,
- Doc_EndItem,
+ Doc_List,
+ Doc_Item,
//
Doc_COUNT,
};
@@ -113,18 +128,18 @@ struct Document_Item{
Document_Item *next;
Document_Item *parent;
i32 type;
+
+ struct{
+ Document_Item *first_child;
+ Document_Item *last_child;
+ String name;
+ String id;
+ b32 show_title;
+ } section;
+
union{
struct{
- Document_Item *first_child;
- Document_Item *last_child;
- String name;
- String id;
- b32 show_title;
- } section;
-
- struct{
- Meta_Unit *unit;
- //Alternate_Names_Array *alt_names;
+ String unit;
u32 mangle_rule;
} unit_elements;
@@ -137,16 +152,22 @@ struct Document_Item{
String name;
struct Abstract_Item *document;
} include;
-
- struct{
- Enriched_Text *text;
- } enriched_text;
};
};
global Document_Item null_document_item = {0};
////////////////////////////////
+internal void
+set_item_string(String *out, String text){
+ *out = str_alloc(text.size + 1);
+ fm_align();
+ copy(out, text);
+ terminate_with_null(out);
+}
+
+////////////////////////////////
+
struct Basic_Node{
Basic_Node *next;
};
@@ -216,6 +237,33 @@ struct Abstract_Item{
};
global Abstract_Item null_abstract_item = {0};
+internal Abstract_Item*
+get_item_by_name(Basic_List list, String name){
+ Abstract_Item *result = 0;
+
+ for (Basic_Node *node = list.head;
+ node != 0;
+ node = node->next){
+ Abstract_Item *item = NodeGetData(node, Abstract_Item);
+ if (match(item->name, name)){
+ result = item;
+ break;
+ }
+ }
+
+ return(result);
+}
+
+internal Abstract_Item*
+create_abstract_item(Basic_List *list, char *name){
+ Abstract_Item *result = 0;
+ Abstract_Item *lookup = get_item_by_name(*list, make_string_slowly(name));
+ if (lookup == 0){
+ result = (Abstract_Item*)push_item_on_list(list, sizeof(*result));
+ }
+ return(result);
+}
+
struct Abstract_Item_Array{
Abstract_Item **items;
u32 count;
@@ -238,16 +286,7 @@ get_abstract_item_array(Basic_List *list){
return(result);
}
-struct Document_Builder{
- Abstract_Item *doc;
-
- Document_Item *section_stack[16];
- i32 section_top;
-};
-
-struct Image_Instantiation{
- i32 w, h;
-};
+////////////////////////////////
struct Document_System{
char *code_dir;
@@ -277,80 +316,23 @@ create_unresolved_include(Document_System *doc_system, Document_Item *include_it
*new_item = include_item;
}
-internal Abstract_Item*
-get_item_by_name(Basic_List list, String name){
- Abstract_Item *result = 0;
-
- for (Basic_Node *node = list.head;
- node != 0;
- node = node->next){
- Abstract_Item *item = NodeGetData(node, Abstract_Item);
- if (match(item->name, name)){
- result = item;
- break;
- }
- }
-
- return(result);
-}
+////////////////////////////////
-internal Image_Instantiation*
-get_image_instantiation(Basic_List list, i32 w, i32 h){
- Image_Instantiation *result = 0;
-
- for (Basic_Node *node = list.head;
- node != 0;
- node = node->next){
- Image_Instantiation *instantiation = NodeGetData(node, Image_Instantiation);
- if (instantiation->w == w && instantiation->h == h){
- result = instantiation;
- break;
- }
- }
-
- return(result);
-}
+enum{
+ MetaResult_DidParse,
+ MetaResult_AlreadyExists,
+ MetaResult_FailedToParse,
+};
-internal void
-add_image_instantiation(Basic_List *list, i32 w, i32 h){
- Image_Instantiation *instantiation = (Image_Instantiation*)push_item_on_list(list, sizeof(*instantiation));
- instantiation->w = w;
- instantiation->h = h;
-}
-
-internal Abstract_Item*
-create_abstract_item(Basic_List *list, char *name){
- Abstract_Item *result = 0;
- Abstract_Item *lookup = get_item_by_name(*list, make_string_slowly(name));
- if (lookup == 0){
- result = (Abstract_Item*)push_item_on_list(list, sizeof(*result));
- }
- return(result);
-}
-
-internal char*
-get_null_terminated_version(String str){
- char *ptr = 0;
- if (terminate_with_null(&str)){
- ptr = str.str;
- }
- else{
- String b = str_alloc(str.size + 1);
- copy(&b, str);
- terminate_with_null(&b);
- ptr = b.str;
- }
- return(ptr);
-}
-
-internal b32
+internal u32
create_meta_unit(Document_System *doc_system, String name_str, String file_str){
+ u32 result = MetaResult_DidParse;
+
char *name = get_null_terminated_version(name_str);
char *file = get_null_terminated_version(file_str);
Abstract_Item *item = create_abstract_item(&doc_system->meta_list, name);
- b32 result = false;
if (item != 0){
Meta_Unit *unit = fm_push_array(Meta_Unit, 1);
*unit = compile_meta_unit(doc_system->code_dir, file, ExpandArray(meta_keywords));
@@ -361,6 +343,12 @@ create_meta_unit(Document_System *doc_system, String name_str, String file_str){
item->name = name;
item->unit = unit;
}
+ else{
+ result = MetaResult_FailedToParse;
+ }
+ }
+ else{
+ result = MetaResult_AlreadyExists;
}
return(result);
@@ -406,24 +394,43 @@ add_image_description(Document_System *system, char *source_file, char *extensio
return(item);
}
-internal void
-set_item_string(String *out, String text){
- *out = str_alloc(text.size + 1);
- fm_align();
- copy(out, text);
- terminate_with_null(out);
+////////////////////////////////
+
+struct Image_Instantiation{
+ i32 w, h;
+};
+
+internal Image_Instantiation*
+get_image_instantiation(Basic_List list, i32 w, i32 h){
+ Image_Instantiation *result = 0;
+
+ for (Basic_Node *node = list.head;
+ node != 0;
+ node = node->next){
+ Image_Instantiation *instantiation = NodeGetData(node, Image_Instantiation);
+ if (instantiation->w == w && instantiation->h == h){
+ result = instantiation;
+ break;
+ }
+ }
+
+ return(result);
}
internal void
-set_section_name(Document_Item *item, char *name, b32 show_title){
- set_item_string(&item->section.name, make_string_slowly(name));
- item->section.show_title = show_title;
+add_image_instantiation(Basic_List *list, i32 w, i32 h){
+ Image_Instantiation *instantiation = (Image_Instantiation*)push_item_on_list(list, sizeof(*instantiation));
+ instantiation->w = w;
+ instantiation->h = h;
}
-internal void
-set_section_id(Document_Item *item, char *id){
- set_item_string(&item->section.id, make_lit_string(id));
-}
+////////////////////////////////
+
+struct Document_Builder{
+ Abstract_Item *doc;
+ Document_Item *item_stack[512];
+ i32 item_top;
+};
internal Document_Builder
begin_document_description(Document_System *system, char *title, char *name, b32 show_title){
@@ -435,25 +442,22 @@ begin_document_description(Document_System *system, char *title, char *name, b32
*doc = null_abstract_item;
doc->item_type = ItemType_Document;
+ doc->name = name;
doc->root_item = fm_push_array(Document_Item, 1);
*doc->root_item = null_document_item;
- set_section_name(doc->root_item, title, show_title);
- doc->name = name;
- doc->root_item->type = Doc_Root;
- builder.section_stack[builder.section_top] = doc->root_item;
+ Document_Item *item = doc->root_item;
+ set_item_string(&item->section.name, make_string_slowly(name));
+ item->section.show_title = show_title;
+ item->type = Doc_Root;
+
+ builder.item_stack[builder.item_top] = doc->root_item;
}
return(builder);
}
-internal void
-end_document_description(Document_Builder *builder){
- Assert(builder->section_top == 0);
-}
-
internal void
append_child(Document_Item *parent, Document_Item *item){
- Assert(parent->type == Doc_Root || parent->type == Doc_Section);
if (parent->section.last_child == 0){
parent->section.first_child = item;
}
@@ -464,19 +468,36 @@ append_child(Document_Item *parent, Document_Item *item){
item->parent = parent;
}
+#define PUSH true
+
+internal void
+doc_push(Document_Builder *builder, Document_Item *item){
+ Assert(builder->item_top + 1 < ArrayCount(builder->item_stack));
+ builder->item_stack[++builder->item_top] = item;
+}
+
internal Document_Item*
-doc_new_item(Document_Builder *builder, u32 type){
- Assert(builder->section_top + 1 < ArrayCount(builder->section_stack));
- Document_Item *parent = builder->section_stack[builder->section_top];
+doc_get_item_top(Document_Builder *builder){
+ Assert(builder->item_top < ArrayCount(builder->item_stack));
+ Document_Item *parent = builder->item_stack[builder->item_top];
+ return(parent);
+}
+
+internal Document_Item*
+doc_new_item(Document_Builder *builder, u32 type, b32 push = false){
+ Document_Item *parent = doc_get_item_top(builder);
Document_Item *item = fm_push_array(Document_Item, 1);
*item = null_document_item;
item->type = type;
append_child(parent, item);
+ if (push){
+ doc_push(builder, item);
+ }
return(item);
}
internal Document_Item*
-doc_new_item_strings(Document_Builder *builder, u32 type, String s1, String s2){
+doc_new_item_strings(Document_Builder *builder, u32 type, String s1, String s2, b32 push = false){
Document_Item *item = doc_new_item(builder, type);
if (s1.size > 0){
set_item_string(&item->string.string, s1);
@@ -484,29 +505,83 @@ doc_new_item_strings(Document_Builder *builder, u32 type, String s1, String s2){
if (s2.size > 0){
set_item_string(&item->string.string2, s2);
}
+ if (push){
+ doc_push(builder, item);
+ }
+ return(item);
+}
+
+internal Document_Item*
+doc_new_item_documentation(Document_Builder *builder, u32 type, String unit, Mangle_Rule mangle_rule, b32 push = false){
+ Document_Item *item = doc_new_item(builder, type);
+ set_item_string(&item->unit_elements.unit, unit);
+ item->unit_elements.mangle_rule = mangle_rule;
+ if (push){
+ doc_push(builder, item);
+ }
return(item);
}
internal void
begin_section(Document_Builder *builder, char *title, char *id){
- Document_Item *section = doc_new_item(builder, Doc_Section);
- builder->section_stack[++builder->section_top] = section;
- set_section_name(section, title, true);
+ Document_Item *item = doc_new_item(builder, Doc_Section, PUSH);
+ set_item_string(&item->section.name, make_string_slowly(title));
+ item->section.show_title = true;
if (id != 0){
- set_section_id(section, id);
+ set_item_string(&item->section.id, make_lit_string(id));
+ }
+}
+
+#define doc_end(b) doc_pop(b)
+
+#define begin_style(b,t) doc_new_item_strings(b, Doc_Style, t, null_string, PUSH)
+#define begin_link(b,t) doc_new_item_strings(b, Doc_Link, t, null_string, PUSH);
+#define begin_list(b) doc_new_item(b, Doc_List, PUSH)
+#define begin_item(b) doc_new_item(b, Doc_Item, PUSH)
+
+internal void
+add_include(Document_System *doc_system, Document_Builder *builder, String text){
+ Document_Item *item = doc_new_item(builder, Doc_Include);
+ set_item_string(&item->include.name, text);
+ create_unresolved_include(doc_system, item);
+}
+
+#define add_error(b,t) doc_new_item_strings(b, Doc_Error, t, null_string)
+#define add_todo(b) doc_new_item(b, Doc_Todo)
+#define add_doc_list(b,u,m) doc_new_item_documentation(b, Doc_DocList, u, m)
+#define add_doc_full(b,u,m) doc_new_item_documentation(b, Doc_DocFull, u, m)
+#define add_table_of_contents(b) doc_new_item(b, Doc_TableOfContents)
+#define add_plain_old_text(b,t) doc_new_item_strings(b, Doc_PlainOldText, t, null_string);
+#define add_version(b) doc_new_item(b, Doc_Version)
+#define add_document_link(b,t) doc_new_item_strings(b, Doc_DocumentLink, t, null_string)
+#define add_image(b,t,e) doc_new_item_strings(b, Doc_Image, t, e)
+#define add_video(b,t) doc_new_item_strings(b, Doc_Video, t, null_string)
+#define add_begin_paragraph(b) doc_new_item(b, Doc_BeginParagraph)
+#define add_end_paragraph(b) doc_new_item(b, Doc_EndParagraph)
+
+internal void
+doc_pop(Document_Builder *builder){
+ if (builder->item_top > 0){
+ --builder->item_top;
+ }
+ else{
+ add_error(builder, make_lit_string("unbalanced groups -- extra end"));
}
}
internal void
-end_section(Document_Builder *builder){
- Assert(builder->section_top > 0);
- --builder->section_top;
+end_document_description(Document_Builder *builder){
+ b32 closing_error = (builder->item_top != 0);
+ if (closing_error){
+ add_error(builder, make_lit_string("unbalanced groups -- extra begin"));
+ }
+
+ for (;builder->item_top > 0;){
+ doc_end(builder);
+ }
}
-internal void
-add_error(Document_Builder *builder, String text){
- doc_new_item_strings(builder, Doc_Error, text, null_string);
-}
+////////////////////////////////
internal void
report_error_missing_body(Document_Builder *builder, String command_body){
@@ -517,135 +592,19 @@ report_error_missing_body(Document_Builder *builder, String command_body){
add_error(builder, error_string);
}
-internal void
-add_todo(Document_Builder *builder){
- doc_new_item(builder, Doc_Todo);
-}
-
-internal void
-add_include(Document_System *doc_system, Document_Builder *builder, String text){
- Document_Item *item = doc_new_item(builder, Doc_Include);
- set_item_string(&item->include.name, text);
- create_unresolved_include(doc_system, item);
-}
-
-internal void
-add_doc_list(Document_Builder *builder, Meta_Unit *unit, Mangle_Rule mangle_rule){
- Document_Item *item = doc_new_item(builder, Doc_DocList);
- item->unit_elements.unit = unit;
- item->unit_elements.mangle_rule = mangle_rule;
-}
-
-internal void
-add_doc_full(Document_Builder *builder, Meta_Unit *unit, Mangle_Rule mangle_rule){
- Document_Item *item = doc_new_item(builder, Doc_DocFull);
- item->unit_elements.unit = unit;
- item->unit_elements.mangle_rule = mangle_rule;
-}
-
-internal void
-add_table_of_contents(Document_Builder *builder){
- doc_new_item(builder, Doc_TableOfContents);
-}
-
-internal void
-add_plain_old_text(Document_Builder *builder, String text){
- doc_new_item_strings(builder, Doc_PlainOldText, text, null_string);
-}
-
-internal void
-add_enriched_text(Document_Builder *builder, Enriched_Text *text){
- Document_Item *item = doc_new_item(builder, Doc_PlainOldText);
- item->enriched_text.text = text;
-}
-
-internal void
-add_version(Document_Builder *builder){
- doc_new_item(builder, Doc_Version);
-}
-
-internal void
-add_begin_style(Document_Builder *builder, String text){
- doc_new_item_strings(builder, Doc_BeginStyle, text, null_string);
-}
-
-internal void
-add_end_style(Document_Builder *builder){
- doc_new_item(builder, Doc_EndStyle);
-}
-
-internal void
-add_document_link(Document_Builder *builder, String text){
- doc_new_item_strings(builder, Doc_DocumentLink, text, null_string);
-}
-
-internal void
-add_begin_link(Document_Builder *builder, String text){
- doc_new_item_strings(builder, Doc_BeginLink, text, null_string);
-}
-
-internal void
-add_end_link(Document_Builder *builder){
- doc_new_item(builder, Doc_EndLink);
-}
-
-internal void
-add_image(Document_Builder *builder, String text, String extra_text){
- doc_new_item_strings(builder, Doc_Image, text, extra_text);
-}
-
-internal void
-add_video(Document_Builder *builder, String text){
- doc_new_item_strings(builder, Doc_Video, text, null_string);
-}
-
-internal void
-add_begin_paragraph(Document_Builder *builder){
- doc_new_item(builder, Doc_BeginParagraph);
-}
-
-internal void
-add_end_paragraph(Document_Builder *builder){
- doc_new_item(builder, Doc_EndParagraph);
-}
-
-internal void
-add_begin_list(Document_Builder *builder){
- doc_new_item(builder, Doc_BeginList);
-}
-
-internal void
-add_end_list(Document_Builder *builder){
- doc_new_item(builder, Doc_EndList);
-}
-
-internal void
-add_begin_item(Document_Builder *builder){
- doc_new_item(builder, Doc_BeginItem);
-}
-
-internal void
-add_end_item(Document_Builder *builder){
- doc_new_item(builder, Doc_EndItem);
-}
-
-// Document Generation from Enriched Text
+////////////////////////////////
enum Command_Types{
Cmd_BackSlash,
- Cmd_BeginStyle,
- Cmd_EndStyle,
+ Cmd_End,
+ Cmd_Section,
+ Cmd_Style,
+ Cmd_List,
+ Cmd_Item,
+ Cmd_Link,
Cmd_DocumentLink,
- Cmd_BeginList,
- Cmd_EndList,
- Cmd_BeginItem,
- Cmd_EndItem,
- Cmd_BeginLink,
- Cmd_EndLink,
Cmd_Image,
Cmd_Video,
- Cmd_Section,
- Cmd_EndSection,
Cmd_Version,
Cmd_TableOfContents,
Cmd_Todo,
@@ -665,19 +624,15 @@ get_enriched_commands(){
if (!did_enriched_commands){
did_enriched_commands = true;
enriched_commands_global_array[Cmd_BackSlash] = make_lit_string("\\");
- enriched_commands_global_array[Cmd_BeginStyle] = make_lit_string("BEGIN_STYLE");
- enriched_commands_global_array[Cmd_EndStyle] = make_lit_string("END_STYLE");
+ enriched_commands_global_array[Cmd_End] = make_lit_string("END");
+ enriched_commands_global_array[Cmd_Section] = make_lit_string("SECTION");
+ enriched_commands_global_array[Cmd_Style] = make_lit_string("STYLE");
+ enriched_commands_global_array[Cmd_List] = make_lit_string("LIST");
+ enriched_commands_global_array[Cmd_Item] = make_lit_string("ITEM");
+ enriched_commands_global_array[Cmd_Link] = make_lit_string("LINK");
enriched_commands_global_array[Cmd_DocumentLink] = make_lit_string("DOC_LINK");
- enriched_commands_global_array[Cmd_BeginList] = make_lit_string("BEGIN_LIST");
- enriched_commands_global_array[Cmd_EndList] = make_lit_string("END_LIST");
- enriched_commands_global_array[Cmd_BeginItem] = make_lit_string("BEGIN_ITEM");
- enriched_commands_global_array[Cmd_EndItem] = make_lit_string("END_ITEM");
- enriched_commands_global_array[Cmd_BeginLink] = make_lit_string("BEGIN_LINK");
- enriched_commands_global_array[Cmd_EndLink] = make_lit_string("END_LINK");
enriched_commands_global_array[Cmd_Image] = make_lit_string("IMAGE");
enriched_commands_global_array[Cmd_Video] = make_lit_string("VIDEO");
- enriched_commands_global_array[Cmd_Section] = make_lit_string("SECTION");
- enriched_commands_global_array[Cmd_EndSection] = make_lit_string("END_SECTION");
enriched_commands_global_array[Cmd_Version] = make_lit_string("VERSION");
enriched_commands_global_array[Cmd_TableOfContents] = make_lit_string("TABLE_OF_CONTENTS");
enriched_commands_global_array[Cmd_Todo] = make_lit_string("TODO");
@@ -695,47 +650,35 @@ get_enriched_commands_count(){
}
internal b32
-extract_command_body(String l, i32 *i_in_out, i32 *body_start_out, i32 *body_end_out){
- b32 result = false;
+extract_command_body(String l, i32 *i_in_out, String *body_text_out){
+ b32 has_body = false;
i32 i = *i_in_out;
-
for (; i < l.size; ++i){
if (!char_is_whitespace(l.str[i])){
break;
}
}
- i32 body_start = 0, body_end = 0;
if (l.str[i] == '{'){
- body_start = i + 1;
+ i32 body_start = i + 1;
+ i32 body_end = 0;
for (++i; i < l.size; ++i){
if (l.str[i] == '}'){
- result = true;
+ has_body = true;
body_end = i;
++i;
break;
}
}
+
+ if (has_body){
+ *i_in_out = i;
+
+ String body_text = substr(l, body_start, body_end - body_start);
+ *body_text_out = skip_chop_whitespace(body_text);
+ }
}
- if (result){
- *i_in_out = i;
- *body_start_out = body_start;
- *body_end_out = body_end;
- }
-
- return(result);
-}
-
-internal b32
-extract_command_body(String l, i32 *i_in_out, String *body_text_out){
- i32 body_start = 0, body_end = 0;
- b32 has_body = extract_command_body(l, i_in_out, &body_start, &body_end);
- if (has_body){
- String body_text = substr(l, body_start, body_end - body_start);
- body_text = skip_chop_whitespace(body_text);
- *body_text_out = body_text;
- }
return(has_body);
}
@@ -798,29 +741,74 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
add_plain_old_text(&builder, make_lit_string("\\"));
}break;
- case Cmd_BeginStyle:
+ case Cmd_End:
+ {
+ for (Document_Item *top = doc_get_item_top(&builder);
+ top->type == Doc_Item;
+ top = doc_get_item_top(&builder)){
+ doc_end(&builder);
+ }
+ doc_end(&builder);
+ }break;
+
+ case Cmd_Section:
{
String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
- add_begin_style(&builder, body_text);
+ if (extract_command_body(l, &i, &body_text)){
+ String extra_text = {0};
+ extract_command_body(l, &i, &extra_text);
+
+ char *title = get_null_terminated_version(body_text);
+ char *id = get_null_terminated_version(extra_text);
+
+ begin_section(&builder, title, id);
}
else{
report_error_missing_body(&builder, command_string);
}
}break;
- case Cmd_EndStyle:
+ case Cmd_Style:
{
- add_end_style(&builder);
+ String body_text = {0};
+ if (extract_command_body(l, &i, &body_text)){
+ begin_style(&builder, body_text);
+ }
+ else{
+ report_error_missing_body(&builder, command_string);
+ }
+ }break;
+
+ case Cmd_List:
+ {
+ begin_list(&builder);
+ }break;
+
+ case Cmd_Item:
+ {
+ Document_Item *top = doc_get_item_top(&builder);
+ if (top->type == Doc_Item){
+ doc_end(&builder);
+ }
+ begin_item(&builder);
+ }break;
+
+ case Cmd_Link:
+ {
+ String body_text = {0};
+ if (extract_command_body(l, &i, &body_text)){
+ begin_link(&builder, body_text);
+ }
+ else{
+ report_error_missing_body(&builder, command_string);
+ }
}break;
// TODO(allen): upgrade this bs
case Cmd_DocumentLink:
{
String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
+ if (extract_command_body(l, &i, &body_text)){
add_document_link(&builder, body_text);
}
else{
@@ -828,48 +816,10 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
}
}break;
- case Cmd_BeginList:
- {
- add_begin_list(&builder);
- }break;
-
- case Cmd_EndList:
- {
- add_end_list(&builder);
- }break;
-
- case Cmd_BeginItem:
- {
- add_begin_item(&builder);
- }break;
-
- case Cmd_EndItem:
- {
- add_end_item(&builder);
- }break;
-
- case Cmd_BeginLink:
- {
- String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
- add_begin_link(&builder, body_text);
- }
- else{
- report_error_missing_body(&builder, command_string);
- }
- }break;
-
- case Cmd_EndLink:
- {
- add_end_link(&builder);
- }break;
-
case Cmd_Image:
{
String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
+ if (extract_command_body(l, &i, &body_text)){
String size_parameter = {0};
extract_command_body(l, &i, &size_parameter);
add_image(&builder, body_text, size_parameter);
@@ -882,8 +832,7 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
case Cmd_Video:
{
String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
+ if (extract_command_body(l, &i, &body_text)){
add_video(&builder, body_text);
}
else{
@@ -891,34 +840,6 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
}
}break;
- case Cmd_Section:
- {
- String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
- String extra_text = {0};
- extract_command_body(l, &i, &extra_text);
-
- String title = str_alloc(body_text.size + 1);
- copy(&title, body_text);
- terminate_with_null(&title);
-
- String id = str_alloc(extra_text.size + 1);
- copy(&id, extra_text);
- terminate_with_null(&id);
-
- begin_section(&builder, title.str, id.str);
- }
- else{
- report_error_missing_body(&builder, command_string);
- }
- }break;
-
- case Cmd_EndSection:
- {
- end_section(&builder);
- }break;
-
case Cmd_Version:
{
add_version(&builder);
@@ -937,8 +858,7 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
case Cmd_Include:
{
String body_text = {0};
- b32 has_body = extract_command_body(l, &i, &body_text);
- if (has_body){
+ if (extract_command_body(l, &i, &body_text)){
add_include(doc_system, &builder, body_text);
}
else{
@@ -952,7 +872,8 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
String file = {0};
if (extract_command_body(l, &i, &name)){
if (extract_command_body(l, &i, &file)){
- if (!create_meta_unit(doc_system, name, file)){
+ u32 result = create_meta_unit(doc_system, name, file);
+ if (result == MetaResult_FailedToParse){
char space[512];
String str = make_fixed_width_string(space);
append(&str, "parse failed for ");
@@ -977,22 +898,20 @@ make_document_from_text(Document_System *doc_system, char *title, char *name, En
String mangle = {0};
extract_command_body(l, &i, &mangle);
- Abstract_Item *item = get_item_by_name(doc_system->meta_list, name);
- if (item != 0){
- u32 mangle_rule = MangleRule_None;
- if (match_part(mangle, "mangle:")){
- String mangle_name = substr_tail(mangle, sizeof("mangle:")-1);
- mangle_name = skip_chop_whitespace(mangle_name);
- mangle_rule = get_mangle_rule(mangle_name);
- }
-
- if (match_index == Cmd_DocList){
- add_doc_list(&builder, item->unit, mangle_rule);
- }
- else{
- add_doc_full(&builder, item->unit, mangle_rule);
- }
+ u32 mangle_rule = MangleRule_None;
+ if (match_part(mangle, "mangle:")){
+ String mangle_name = substr_tail(mangle, sizeof("mangle:")-1);
+ mangle_name = skip_chop_whitespace(mangle_name);
+ mangle_rule = get_mangle_rule(mangle_name);
}
+
+ if (match_index == Cmd_DocList){
+ add_doc_list(&builder, name, mangle_rule);
+ }
+ else{
+ add_doc_full(&builder, name, mangle_rule);
+ }
+
}
else{
report_error_missing_body(&builder, command_string);
@@ -1146,8 +1065,8 @@ img_get_link_string(Abstract_Item *img, char *space, i32 capacity, i32 w, i32 h)
internal void
append_section_number_reduced(String *out, Section_Counter *section_counter, i32 reduce){
- i32 level = section_counter->nest_level-reduce;
- for (i32 i = 1; i <= level; ++i){
+ i32 level = section_counter->nest_level - reduce;
+ for (i32 i = 0; i <= level; ++i){
append_int_to_str(out, section_counter->counter[i]);
if (i != level){
append(out, ".");
@@ -1375,24 +1294,6 @@ output_end_paragraph(String *out){
append(out, "
");
}
-internal void
-output_begin_section(String *out, Section_Counter *section_counter, String l, String l2){
- html_render_section_header(out, l, l2, section_counter);
- ++section_counter->nest_level;
- section_counter->list_item_counter = 0;
-}
-
-internal void
-output_end_section(String *out, Section_Counter *section_counter){
- if (section_counter->nest_level > 0){
- --section_counter->nest_level;
- ++section_counter->counter[section_counter->nest_level];
- }
- else{
- output_error(out, make_lit_string("unmatched section end"));
- }
-}
-
internal void
output_begin_list(String *out){
append(out,"");
@@ -1407,7 +1308,7 @@ internal void
output_begin_item(String *out, Section_Counter *section_counter){
if (section_counter->list_item_counter == 0){
append(out, "- ");
- ++section_counter->list_item_counter;
+ section_counter->list_item_counter = 1;
}
else{
append(out, "
- ");
@@ -2142,39 +2043,38 @@ doc_item_html(Document_Output_System sys, Document_Item *item, b32 head){
// NOTE(allen): Do nothing.
}break;
+
+ case Doc_DocFull:
case Doc_DocList:
{
if (head){
- append(sys.out, "
");
-
Mangle_Rule mangle_rule = item->unit_elements.mangle_rule;
- Meta_Unit *unit = item->unit_elements.unit;
+ String name = item->unit_elements.unit;
+
+ Abstract_Item *unit_item = get_item_by_name(sys.doc_system->meta_list, name);
+ Meta_Unit *unit = unit_item->unit;
i32 count = unit->set.count;
- for (i32 i = 0; i < count; ++i){
- String name = apply_mangle_rule(unit->set.items[i].name, mangle_rule);
- print_item_in_list(sys.out, name, "_doc");
+ if (item->type == Doc_DocList){
+ append(sys.out, "");
+
+ for (i32 i = 0; i < count; ++i){
+ String name = apply_mangle_rule(unit->set.items[i].name, mangle_rule);
+ print_item_in_list(sys.out, name, "_doc");
+ }
+
+ append(sys.out, "
");
}
-
- append(sys.out, "
");
- }
- }break;
-
- case Doc_DocFull:
- {
- if (head){
- Mangle_Rule mangle_rule = item->unit_elements.mangle_rule;
- Meta_Unit *unit = item->unit_elements.unit;
- i32 count = unit->set.count;
-
- char section_space[32];
- String section_str = make_fixed_width_string(section_space);
- append_section_number_reduced(§ion_str, sys.section_counter, 1);
- terminate_with_null(§ion_str);
-
- i32 I = 1;
- for (i32 i = 0; i < count; ++i, ++I){
- print_item_html(sys.out, sys.used_links, &unit->set.items[i], "_doc", section_str.str, I, mangle_rule);
+ else{
+ char section_space[32];
+ String section_str = make_fixed_width_string(section_space);
+ append_section_number_reduced(§ion_str, sys.section_counter, 1);
+ terminate_with_null(§ion_str);
+
+ i32 I = 1;
+ for (i32 i = 0; i < count; ++i, ++I){
+ print_item_html(sys.out, sys.used_links, &unit->set.items[i], "_doc", section_str.str, I, mangle_rule);
+ }
}
}
}break;
@@ -2223,16 +2123,12 @@ doc_item_html(Document_Output_System sys, Document_Item *item, b32 head){
}
}break;
- case Doc_BeginStyle:
+ case Doc_Style:
{
if (head){
output_begin_style(sys.out, item->string.string);
}
- }break;
-
- case Doc_EndStyle:
- {
- if (head){
+ else{
output_end_style(sys.out);
}
}break;
@@ -2244,16 +2140,12 @@ doc_item_html(Document_Output_System sys, Document_Item *item, b32 head){
}
}break;
- case Doc_BeginLink:
+ case Doc_Link:
{
if (head){
output_begin_link(sys.doc_system, sys.out, item->string.string);
}
- }break;
-
- case Doc_EndLink:
- {
- if (head){
+ else{
output_end_link(sys.out);
}
}break;
@@ -2286,30 +2178,22 @@ doc_item_html(Document_Output_System sys, Document_Item *item, b32 head){
}
}break;
- case Doc_BeginList:
+ case Doc_List:
{
if (head){
output_begin_list(sys.out);
}
- }break;
-
- case Doc_EndList:
- {
- if (head){
+ else{
output_end_list(sys.out);
}
}break;
- case Doc_BeginItem:
+ case Doc_Item:
{
if (head){
output_begin_item(sys.out, sys.section_counter);
}
- }break;
-
- case Doc_EndItem:
- {
- if (head){
+ else{
output_end_item(sys.out);
}
}break;
@@ -2323,16 +2207,23 @@ internal void
generate_item_html(Document_Output_System sys, Document_Item *item){
doc_item_html(sys, item, true);
- if (item->type == Doc_Root || item->type == Doc_Section){
- i32 level = ++sys.section_counter->nest_level;
- sys.section_counter->counter[level] = 1;
+ if (item->section.first_child != 0){
+ if (item->type == Doc_Section){
+ i32 level = ++sys.section_counter->nest_level;
+ sys.section_counter->counter[level] = 1;
+ sys.section_counter->list_item_counter = 0;
+ }
+
for (Document_Item *m = item->section.first_child;
m != 0;
m = m->next){
generate_item_html(sys, m);
}
- --sys.section_counter->nest_level;
- ++sys.section_counter->counter[sys.section_counter->nest_level];
+
+ if (item->type == Doc_Section){
+ --sys.section_counter->nest_level;
+ ++sys.section_counter->counter[sys.section_counter->nest_level];
+ }
}
if (item->type == Doc_Include){
diff --git a/site/4ed_sitegen.cpp b/site/4ed_sitegen.cpp
index 77b9a676..36f09a4a 100644
--- a/site/4ed_sitegen.cpp
+++ b/site/4ed_sitegen.cpp
@@ -63,11 +63,9 @@ do_image_resize(char *src_file, char *dst_file, char *extension, i32 w, i32 h){
if (image != 0){
stbi_uc *resized_image = fm_push_array(stbi_uc, w*h*channels);
stbir_resize_uint8(image, x, y, x*channels, resized_image, w, h, w*channels, channels);
-
if (match_cc(extension, "png")){
stbi_write_png(dst_file, w, h, channels, resized_image, w*channels);
}
-
free(image);
}
@@ -79,18 +77,18 @@ generate_site(char *code_directory, char *asset_directory, char *src_directory,
fm_clear_folder(dst_directory);
Document_System doc_system = create_document_system(code_directory, asset_directory, src_directory);
-
- add_image_description(&doc_system, "4coder_logo_low_green.png", "png", "4coder_logo");
- add_image_description(&doc_system, "screen_1.png", "png", "screen_1");
- add_image_description(&doc_system, "screen_2.png", "png", "screen_2");
- add_image_description(&doc_system, "screen_3.png", "png", "screen_3");
- add_generic_file (&doc_system, "4coder_icon.ico", "ico", "4coder_icon");
-
Document_System *docs = &doc_system;
+ // TODO(allen): Declare these in the source files.
+ add_image_description(docs, "4coder_logo_low_green.png", "png", "4coder_logo" );
+ add_image_description(docs, "screen_1.png", "png", "screen_1" );
+ add_image_description(docs, "screen_2.png", "png", "screen_2" );
+ add_image_description(docs, "screen_3.png", "png", "screen_3" );
+ add_generic_file (docs, "4coder_icon.ico", "ico", "4coder_icon" );
+
// TODO(allen): From the text file get "Big Title" and "smallname".
- generate_page(docs, "home.txt" , "4coder Home" , "home" );
generate_page(docs, "docs.txt" , "4coder API Docs" , "custom_docs" );
+ generate_page(docs, "home.txt" , "4coder Home" , "home" );
generate_page(docs, "feature_list.txt", "4coder Feature List", "features" );
generate_page(docs, "binding_list.txt", "4coder Binding List", "bindings" );
generate_page(docs, "roadmap.txt" , "4coder Roadmap" , "roadmap" );
diff --git a/site/source_material/binding_list.txt b/site/source_material/binding_list.txt
index 02647332..914d0800 100644
--- a/site/source_material/binding_list.txt
+++ b/site/source_material/binding_list.txt
@@ -1,192 +1,185 @@
-\BEGIN_LINK{document:home}
-\IMAGE{image:4coder_logo}{width:200}
-\END_LINK
+\INCLUDE{site_header.txt}
These are the default key bindings in 4coder version \VERSION
\SECTION{Global Bindings}
The following bindings apply in all situations.
- \BEGIN_LIST
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Create a new panel with a vertical split \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Create a new panel with a horizontal split \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Close a panel \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Change active panel \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE change active panel backwards \END_ITEM
+ \LIST
+ \ITEM \STYLE{code} \END Create a new panel with a vertical split
+ \ITEM \STYLE{code} \END Create a new panel with a horizontal split
+ \ITEM \STYLE{code} \END Close a panel
+ \ITEM \STYLE{code} \END Change active panel
+ \ITEM \STYLE{code} \END change active panel backwards
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE New file dialogue \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open file dialogue \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open file dialogue in other panel \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Kill buffer dialogue \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Switch open buffer dialogue \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE 'Save As' - save file into new name \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Set hot directory to projet root directory \END_ITEM
+ \ITEM \STYLE{code} \END New file dialogue
+ \ITEM \STYLE{code} \END Open file dialogue
+ \ITEM \STYLE{code} \END Open file dialogue in other panel
+ \ITEM \STYLE{code} \END Kill buffer dialogue
+ \ITEM \STYLE{code} \END Switch open buffer dialogue
+ \ITEM \STYLE{code} \END 'Save As' - save file into new name
+ \ITEM \STYLE{code} \END Set hot directory to projet root directory
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open color and font selection GUI \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open a debug information GUI \END_ITEM
+ \ITEM \STYLE{code} \END Open color and font selection GUI
+ \ITEM \STYLE{code} \END Open a debug information GUI
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Change to footer build panel \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Close footer build panel \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Goto next error/jump location \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Goto previous error/jump location \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Goto first error/jump location \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch basic build (calls build.bat, build.sh, or Makefile) \END_ITEM
+ \ITEM \STYLE{code} \END Change to footer build panel
+ \ITEM \STYLE{code} \END Close footer build panel
+ \ITEM \STYLE{code} \END Goto next error/jump location
+ \ITEM \STYLE{code} \END Goto previous error/jump location
+ \ITEM \STYLE{code} \END Goto first error/jump location
+ \ITEM \STYLE{code} \END Launch basic build (calls build.bat, build.sh, or Makefile)
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Execute arbitrary shell/terminal command in arbitrary buffer \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Repeat previous shell/terminal command \END_ITEM
+ \ITEM \STYLE{code} \END Execute arbitrary shell/terminal command in arbitrary buffer
+ \ITEM \STYLE{code} \END Repeat previous shell/terminal command
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Execute 4coder internal command \END_ITEM
+ \ITEM \STYLE{code} \END Execute 4coder internal command
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Show scrollbar \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Hide scrollbar \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Toggle filebar \END_ITEM
+ \ITEM \STYLE{code} \END Show scrollbar
+ \ITEM \STYLE{code} \END Hide scrollbar
+ \ITEM \STYLE{code} \END Toggle filebar
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Toggle mouse input \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Toggle fullscreen mode \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Exit 4coder \END_ITEM
+ \ITEM \STYLE{code} \END Toggle mouse input
+ \ITEM \STYLE{code} \END Toggle fullscreen mode
+ \ITEM \STYLE{code} \END Exit 4coder
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Launch shell command set in a loaded project \END_ITEM
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
+ \ITEM \STYLE{code} \END Launch shell command set in a loaded project
- \END_LIST
-\END_SECTION
+ \END
+\END
\SECTION{4coder Internal Command}
-Long name commands that can be typed in after \BEGIN_STYLE{code} \END_STYLE for infrequently triggered commands.
- \BEGIN_LIST
- \BEGIN_ITEM \BEGIN_STYLE{code} "load project" \END_STYLE
- Load a project.4coder file, ditching any previously loaded project \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} "open all code" \END_STYLE
- Open all code files in the current directory, extensions set in config.4coder, default to C/C++ extensions \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} "open all code recursive" \END_STYLE
- Like \BEGIN_STYLE{code} "open all code" \END_STYLE but recurses through folders \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} "dos lines" \END_STYLE
- Switch the bufer to 'dos' line ending mode CRLF \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} "nix lines" \END_STYLE
- Switch the bufer to 'nix' line ending mode LF \END_ITEM
- \END_LIST
-\END_SECTION
+Long name commands that can be typed in after \STYLE{code} \END for infrequently triggered commands.
+ \LIST
+ \ITEM \STYLE{code} "load project" \END Load a project.4coder file, ditching any previously loaded project
+ \ITEM \STYLE{code} "open all code" \END Open all code files in the current directory, extensions set in config.4coder, default to C/C++ extensions
+ \ITEM \STYLE{code} "open all code recursive" \END Like \STYLE{code} "open all code" \END but recurses through folders
+ \ITEM \STYLE{code} "dos lines" \END Switch the bufer to 'dos' line ending mode CRLF
+ \ITEM \STYLE{code} "nix lines" \END Switch the bufer to 'nix' line ending mode LF
+ \END
+\END
\SECTION{Text File Bindings}
The following bindings apply in general text files and most apply in code files, but some are overriden by other commands.
- \BEGIN_LIST
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Insert character \END_ITEM
+ \LIST
+ \ITEM \STYLE{code} \END Insert character
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Set cursor position to mouse position \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Set mark position to mouse position \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Set mark position to mouse position \END_ITEM
+ \ITEM \STYLE{code} \END Set cursor position to mouse position
+ \ITEM \STYLE{code} \END Set mark position to mouse position
+ \ITEM \STYLE{code} \END Set mark position to mouse position
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move left \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move right \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Delete character \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Delete character \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Backspace character \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Backspace character \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move up \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move up \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move to end of line \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move to beginning of line \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move up one whole page \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move down one whole page \END_ITEM
+ \ITEM \STYLE{code} \END Move left
+ \ITEM \STYLE{code} \END Move right
+ \ITEM \STYLE{code} \END Delete character
+ \ITEM \STYLE{code} \END Delete character
+ \ITEM \STYLE{code} \END Backspace character
+ \ITEM \STYLE{code} \END Backspace character
+ \ITEM \STYLE{code} \END Move up
+ \ITEM \STYLE{code} \END Move up
+ \ITEM \STYLE{code} \END Move to end of line
+ \ITEM \STYLE{code} \END Move to beginning of line
+ \ITEM \STYLE{code} \END Move up one whole page
+ \ITEM \STYLE{code} \END Move down one whole page
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Seek right, stop at whitespace \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Seek left, stop at whitespace \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Seek up, stop at blank line \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Seek down, stop at blank line \END_ITEM
+ \ITEM \STYLE{code} \END Seek right, stop at whitespace
+ \ITEM \STYLE{code} \END Seek left, stop at whitespace
+ \ITEM \STYLE{code} \END Seek up, stop at blank line
+ \ITEM \STYLE{code} \END Seek down, stop at blank line
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move up ten lines \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move down ten lines \END_ITEM
+ \ITEM \STYLE{code} \END Move up ten lines
+ \ITEM \STYLE{code} \END Move down ten lines
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Delete word backwards \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Delete word forwards \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE snipe_token_or_word \END_ITEM
+ \ITEM \STYLE{code} \END Delete word backwards
+ \ITEM \STYLE{code} \END Delete word forwards
+ \ITEM \STYLE{code} \END snipe_token_or_word
- \BEGIN_ITEM Note: 'the range' in the following commands refers to the text between the mark and cursor. \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Set mark to the cursor position \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Replace a substring in the range \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Copy text from the range \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Delete the text in the range \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Center the active view on the cursor \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Move the view so that it's left edge is near the cursor's current x position \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Begin an incremental search through the current buffer \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Create a jump location list of all loaded exact matches of a string \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Create a jump location list of all loaded substring matches of a string without case sensitivity \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Goto a specific line number \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Convert text in the range to lowercase \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Kill the current buffer \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Toggle line wrapping on the current buffer \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Swap the cursor and mark positions \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Reload the current buffer from the file system \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Begin an iterative query replace \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Begin an iterative query replace to replace the word under the cursor \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Begin a reversed incremental search through the current buffer \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Save the current buffer with it's given filename \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Begin an incremenal search through the current buffer for the word under the cursor \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Create a jump location list of all loaded exact matches of the word under the cursor \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Convert text in the range to uppercase \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Paste from the clipboard \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Toggle the virtual whitespace system \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Paste the next item on the clipboard, 4coder keeps a finite history of past 64 copies \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Copy text from the range and delete the range (aka cut) \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Redo \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Undo \END_ITEM
+ \ITEM Note: 'the range' in the following commands refers to the text between the mark and cursor.
+ \ITEM \STYLE{code} \END Set mark to the cursor position
+ \ITEM \STYLE{code} \END Replace a substring in the range
+ \ITEM \STYLE{code} \END Copy text from the range
+ \ITEM \STYLE{code} \END Delete the text in the range
+ \ITEM \STYLE{code} \END Center the active view on the cursor
+ \ITEM \STYLE{code} \END Move the view so that it's left edge is near the cursor's current x position
+ \ITEM \STYLE{code} \END Begin an incremental search through the current buffer
+ \ITEM \STYLE{code} \END Create a jump location list of all loaded exact matches of a string
+ \ITEM \STYLE{code} \END Create a jump location list of all loaded substring matches of a string without case sensitivity
+ \ITEM \STYLE{code} \END Goto a specific line number
+ \ITEM \STYLE{code} \END Convert text in the range to lowercase
+ \ITEM \STYLE{code} \END Kill the current buffer
+ \ITEM \STYLE{code} \END Toggle line wrapping on the current buffer
+ \ITEM \STYLE{code} \END Swap the cursor and mark positions
+ \ITEM \STYLE{code} \END Reload the current buffer from the file system
+ \ITEM \STYLE{code} \END Begin an iterative query replace
+ \ITEM \STYLE{code} \END Begin an iterative query replace to replace the word under the cursor
+ \ITEM \STYLE{code} \END Begin a reversed incremental search through the current buffer
+ \ITEM \STYLE{code} \END Save the current buffer with it's given filename
+ \ITEM \STYLE{code} \END Begin an incremenal search through the current buffer for the word under the cursor
+ \ITEM \STYLE{code} \END Create a jump location list of all loaded exact matches of the word under the cursor
+ \ITEM \STYLE{code} \END Convert text in the range to uppercase
+ \ITEM \STYLE{code} \END Paste from the clipboard
+ \ITEM \STYLE{code} \END Toggle the virtual whitespace system
+ \ITEM \STYLE{code} \END Paste the next item on the clipboard, 4coder keeps a finite history of past 64 copies
+ \ITEM \STYLE{code} \END Copy text from the range and delete the range (aka cut)
+ \ITEM \STYLE{code} \END Redo
+ \ITEM \STYLE{code} \END Undo
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Decrease the line wrap width for the current buffer \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Increase the line wrap width for the current buffer \END_ITEM
+ \ITEM \STYLE{code} \END Decrease the line wrap width for the current buffer
+ \ITEM \STYLE{code} \END Increase the line wrap width for the current buffer
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Toggle the show whitespace option \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Clean trailing whitespace from all lines \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Interpret jump location under cursor and jump to it, lock the next/prev jump commands to this jump location list (only in read only files) \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Like previous command but tries to open the jump location in the view that currently holds the jump location list \END_ITEM
+ \ITEM \STYLE{code} \END Toggle the show whitespace option
+ \ITEM \STYLE{code} \END Clean trailing whitespace from all lines
+ \ITEM \STYLE{code} \END Interpret jump location under cursor and jump to it, lock the next/prev jump commands to this jump location list (only in read only files)
+ \ITEM \STYLE{code} \END Like previous command but tries to open the jump location in the view that currently holds the jump location list
- \END_LIST
-\END_SECTION
+ \END
+\END
\SECTION{Code File Bindings}
The following commands only apply in C/C++ files where the lexer (syntax highlighting) is turned on.
- \BEGIN_LIST
+ \LIST
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Seek right stop at alphanumeric or camel case \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Seek left stop at alphanumeric or camel case \END_ITEM
+ \ITEM \STYLE{code} \END Seek right stop at alphanumeric or camel case
+ \ITEM \STYLE{code} \END Seek left stop at alphanumeric or camel case
- \BEGIN_ITEM \BEGIN_STYLE{code} <}> \END_STYLE Insert character and trigger auto indentation \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} <)> \END_STYLE Insert character and trigger auto indentation \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} <]> \END_STYLE Insert character and trigger auto indentation \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} <;> \END_STYLE Insert character and trigger auto indentation \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} <#> \END_STYLE Insert character and trigger auto indentation \END_ITEM
+ \ITEM \STYLE{code} <}> \END Insert character and trigger auto indentation
+ \ITEM \STYLE{code} <)> \END Insert character and trigger auto indentation
+ \ITEM \STYLE{code} <]> \END Insert character and trigger auto indentation
+ \ITEM \STYLE{code} <;> \END Insert character and trigger auto indentation
+ \ITEM \STYLE{code} <#> \END Insert character and trigger auto indentation
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Automatically complete partial word \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Auto indent the range \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Auto indent the line at the cursor \END_ITEM
+ \ITEM \STYLE{code} \END Automatically complete partial word
+ \ITEM \STYLE{code} \END Auto indent the range
+ \ITEM \STYLE{code} \END Auto indent the line at the cursor
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Insert a TODO comment \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Insert a NOTE comment \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Insert a block comment \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open a pair of braces \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open a pair of braces ended with a semicolon \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open a pair of braces ended with a break \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Surround the range with #if 0 and #endif \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Try to open a file named by the string surrounded by quotes under the cursor \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Switch from .cpp \BEGIN_STYLE{code} <-> \END_STYLE .h \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Insert the characters " = {0};" \END_ITEM
- \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE List all function signatures in the current buffer \END_ITEM
+ \ITEM \STYLE{code} \END Insert a TODO comment
+ \ITEM \STYLE{code} \END Insert a NOTE comment
+ \ITEM \STYLE{code} \END Insert a block comment
+ \ITEM \STYLE{code} \END Open a pair of braces
+ \ITEM \STYLE{code} \END Open a pair of braces ended with a semicolon
+ \ITEM \STYLE{code} \END Open a pair of braces ended with a break
+ \ITEM \STYLE{code} \END Surround the range with #if 0 and #endif
+ \ITEM \STYLE{code} \END Try to open a file named by the string surrounded by quotes under the cursor
+ \ITEM \STYLE{code} \END Switch from .cpp \STYLE{code} <-> \END .h
+ \ITEM \STYLE{code} \END Insert the characters " = {0};"
+ \ITEM \STYLE{code} \END List all function signatures in the current buffer
- \END_LIST
-\END_SECTION
\ No newline at end of file
+ \END
+\END
\ No newline at end of file
diff --git a/site/source_material/docs.txt b/site/source_material/docs.txt
index e37d6e4b..668efffc 100644
--- a/site/source_material/docs.txt
+++ b/site/source_material/docs.txt
@@ -1,76 +1,68 @@
-\META_PARSE{custom_funcs}{4ed_api_implementation.cpp}
-\META_PARSE{custom_types}{4coder_API/types.h}
-\META_PARSE{string} {string/internal_4coder_string.cpp}
-\META_PARSE{lexer_funcs} {4cpp/4cpp_lexer.h}
-\META_PARSE{lexer_types} {4cpp/4cpp_lexer_types.h}
-
-\BEGIN_LINK{document:home}
-\IMAGE{image:4coder_logo}{width:200}
-\END_LINK
+\INCLUDE{site_header.txt}
\TABLE_OF_CONTENTS
\SECTION{Introduction}{introduction}
\INCLUDE{introduction.txt}
-\END_SECTION
+\END
\SECTION{4coder Systems}{4coder_systems}
\TODO
-\END_SECTION
+\END
\SECTION{Types and Functions}{types_and_functions}
\SECTION{Function List}
\DOC_LIST{custom_funcs}{mangle:to lower}
- \END_SECTION
+ \END
\SECTION{Type List}
\DOC_LIST{custom_types}
- \END_SECTION
+ \END
\SECTION{Function Descriptions}
\DOC_FULL{custom_funcs}{mangle:to lower}
- \END_SECTION
+ \END
\SECTION{Type Descriptions}
\DOC_FULL{custom_types}
- \END_SECTION
-\END_SECTION
+ \END
+\END
\SECTION{String Library}{string_library}
\SECTION{String Library Intro}
\TODO
- \END_SECTION
+ \END
\SECTION{String Function List}
\DOC_LIST{string}
- \END_SECTION
+ \END
\SECTION{String Function Descriptions}
\DOC_FULL{string}
- \END_SECTION
-\END_SECTION
+ \END
+\END
\SECTION{Lexer Library}{lexer_library}
\SECTION{Lexer Intro}
\INCLUDE{lexer_introduction.txt}
- \END_SECTION
+ \END
\SECTION{Lexer Function List}
\DOC_LIST{lexer_funcs}
- \END_SECTION
+ \END
\SECTION{Lexer Type List}
\DOC_LIST{lexer_types}
- \END_SECTION
+ \END
\SECTION{Lexer Function Descriptions}
\DOC_FULL{lexer_funcs}
- \END_SECTION
+ \END
\SECTION{Lexer Type Descriptions}
\DOC_FULL{lexer_types}
- \END_SECTION
-\END_SECTION
+ \END
+\END
diff --git a/site/source_material/feature_list.txt b/site/source_material/feature_list.txt
index b9ab5e5c..72939240 100644
--- a/site/source_material/feature_list.txt
+++ b/site/source_material/feature_list.txt
@@ -1,73 +1,71 @@
-\BEGIN_LINK{document:home}
-\IMAGE{image:4coder_logo}{width:200}
-\END_LINK
+\INCLUDE{site_header.txt}
-This page provides a list of 4coder features for anyone trying to determine whether 4coder is the right editor for them. To find a complete list of every default key binding visit \BEGIN_LINK{document:bindings} binding list \END_LINK. If a feature is missing here you should check out the \BEGIN_LINK{document:roadmap} roadmap \END_LINK page to see what is coming in the future. If the feature you want is on neither, it might be missing from this list, or it might actually be missing from 4coder, you should contact \BEGIN_STYLE{code} editor@4coder.net \END_STYLE to ask questions and make requests.
+This page provides a list of 4coder features for anyone trying to determine whether 4coder is the right editor for them. To find a complete list of every default key binding visit \LINK{document:bindings} binding list \END. If a feature is missing here you should check out the \LINK{document:roadmap} roadmap \END page to see what is coming in the future. If the feature you want is on neither, it might be missing from this list, or it might actually be missing from 4coder, you should contact \STYLE{code} editor@4coder.net \END to ask questions and make requests.
\SECTION{Text Editing}
- \BEGIN_LIST
- \BEGIN_ITEM Support for UTF8 encoded files \END_ITEM
- \BEGIN_ITEM Cursor-Mark editing paradigm \END_ITEM
- \BEGIN_ITEM Navigation by characters, words, tokens, lines, and blank lines \END_ITEM
- \BEGIN_ITEM Modern style undo and redo \END_ITEM
- \BEGIN_ITEM Incremental word complete with matching words in open files \END_ITEM
- \BEGIN_ITEM Incremental word search \END_ITEM
- \BEGIN_ITEM Word replace \END_ITEM
- \BEGIN_ITEM List all occurences of words in open buffers \END_ITEM
- \BEGIN_ITEM Clipboard history and "paste-next" to copy multiple chunks of text around easily \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Support for UTF8 encoded files
+ \ITEM Cursor-Mark editing paradigm
+ \ITEM Navigation by characters, words, tokens, lines, and blank lines
+ \ITEM Modern style undo and redo
+ \ITEM Incremental word complete with matching words in open files
+ \ITEM Incremental word search
+ \ITEM Word replace
+ \ITEM List all occurences of words in open buffers
+ \ITEM Clipboard history and "paste-next" to copy multiple chunks of text around easily
+ \END
+\END
\SECTION{C/C++ Editing}
- \BEGIN_LIST
- \BEGIN_ITEM Code highlighting for C/C++ code \END_ITEM
- \BEGIN_ITEM Code auto-layout rendering engine \END_ITEM
- \BEGIN_ITEM Text level auto-indenting \END_ITEM
- \BEGIN_ITEM Run scripts and command line commands in editor \END_ITEM
- \BEGIN_ITEM Jump to error \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Code highlighting for C/C++ code
+ \ITEM Code auto-layout rendering engine
+ \ITEM Text level auto-indenting
+ \ITEM Run scripts and command line commands in editor
+ \ITEM Jump to error
+ \END
+\END
\SECTION{Project Organization}
- \BEGIN_LIST
- \BEGIN_ITEM Set file extensions you care about in your project type to automatically open all code files \END_ITEM
- \BEGIN_ITEM Set shell/terminal commands to various fkeys for build scripts, test scripts etc \END_ITEM
- \BEGIN_ITEM project.4coder is a text file so it works painlessly with source control and can it is easy to start working with an existing project on a new machine \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Set file extensions you care about in your project type to automatically open all code files
+ \ITEM Set shell/terminal commands to various fkeys for build scripts, test scripts etc
+ \ITEM project.4coder is a text file so it works painlessly with source control and can it is easy to start working with an existing project on a new machine
+ \END
+\END
\SECTION{The Customization API}
These features are included in the alpha builds for supporters at the $5 tier and above.
- \BEGIN_LIST
- \BEGIN_ITEM Easy key rebinding \END_ITEM
- \BEGIN_ITEM Create custom commands \END_ITEM
- \BEGIN_ITEM Buffer reading and editing \END_ITEM
- \BEGIN_ITEM View opening, closing, positioning \END_ITEM
- \BEGIN_ITEM Access to the code intelligence engine \END_ITEM
- \BEGIN_ITEM Access to the clipboard \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Easy key rebinding
+ \ITEM Create custom commands
+ \ITEM Buffer reading and editing
+ \ITEM View opening, closing, positioning
+ \ITEM Access to the code intelligence engine
+ \ITEM Access to the clipboard
+ \END
+\END
\SECTION{The Experimental Features}
These features are included in the alpha builds for supporters at the $10 tier and above and are generally only partially implemented, hence not being fully upgraded to the standard build.
- \BEGIN_LIST
- \BEGIN_ITEM Moving cursor and mark to surrounding and matching braces
- \BEGIN_ITEM Rectangular delete
- \BEGIN_ITEM Multi-line editing
- \BEGIN_ITEM Rename a parameter
- \BEGIN_ITEM Write in explicit enum values from 0 to n
- \BEGIN_ITEM Scope aware features: scope navigation & scope absorb down
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Moving cursor and mark to surrounding and matching braces
+ \ITEM Rectangular delete
+ \ITEM Multi-line editing
+ \ITEM Rename a parameter
+ \ITEM Write in explicit enum values from 0 to n
+ \ITEM Scope aware features: scope navigation & scope absorb down
+ \END
+\END
\SECTION{Transition From Emacs}
4coder's current setup and editing paradigm is modeled after emacs, so it is very natural to transition to 4coder from emacs for many users. 4coder customization is quite different from emacs though, so anyone who wants to keep their current keybinds will have to take the time to rewrite the keybinding code. Once the initial transition is done, any user who prefers C++ to Lisp will have a much better time in their 4coder configuration code.
-\END_SECTION
+\END
\SECTION{Transition From Vim}
-For vim users the built-in editing paradigm will not line up with editing habits, but thanks to the open customization model, a vim paradigm and default vim key bindings can be used in 4coder. The vim customization \BEGIN_LINK{!https://github.com/Chronister/4vim} here \END_LINK is an early example of this with many basic vim systems up and running.
+For vim users the built-in editing paradigm will not line up with editing habits, but thanks to the open customization model, a vim paradigm and default vim key bindings can be used in 4coder. The vim customization \LINK{!https://github.com/Chronister/4vim} here \END is an early example of this with many basic vim systems up and running.
Right now 4coder is admittedly not great for vim users, but the transition path exists so keep your eyes on 4coder as better vim emulation is still on the way.
-\END_SECTION
+\END
diff --git a/site/source_material/home.txt b/site/source_material/home.txt
index 9708298e..6b9e43fd 100644
--- a/site/source_material/home.txt
+++ b/site/source_material/home.txt
@@ -1,23 +1,21 @@
-\BEGIN_LINK{document:home}
-\IMAGE{image:4coder_logo}{width:200}
-\END_LINK
+\INCLUDE{site_header.txt}
4coder is a code editor that lives in a space between an IDE and a power editor such as Emacs or Vim. It targets maximum ease of customization, extension, and cross platform reliability. Earlier versions of 4coder focussed entirely on C/C++ but it is now transitioning to be a more general purpose editor. Here you can learn about the features of 4coder, how to get started with 4coder, and how to get the absolute most out of 4coder.
-If you cannot find what you are looking for please contact \BEGIN_STYLE{code} editor@4coder.net \END_STYLE with questions.
+If you cannot find what you are looking for please contact \STYLE{code} editor@4coder.net \END with questions.
-\BEGIN_LINK{!http://patreon.com/mr4thdimention} Get an alpha build by supporting development \END_LINK
+\LINK{!http://patreon.com/mr4thdimention} Get an alpha build by supporting development \END
-\BEGIN_LINK{document:features} The official 4coder feature list \END_LINK
+\LINK{document:features} The official 4coder feature list \END
-\BEGIN_LINK{document:bindings} The list of default 4coder bindings \END_LINK
+\LINK{document:bindings} The list of default 4coder bindings \END
-\BEGIN_LINK{document:roadmap} The official 4coder road map \END_LINK
+\LINK{document:roadmap} The official 4coder road map \END
-\BEGIN_LINK{document:custom_docs} The official documentation for the 4coder customization system \END_LINK
+\LINK{document:custom_docs} The official documentation for the 4coder customization system \END
-\BEGIN_LINK{document:tutorials} Using 4coder tutorials \END_LINK
+\LINK{document:tutorials} Using 4coder tutorials \END
\IMAGE{image:screen_1}
diff --git a/site/source_material/introduction.txt b/site/source_material/introduction.txt
index 155f422b..c467d276 100644
--- a/site/source_material/introduction.txt
+++ b/site/source_material/introduction.txt
@@ -1,4 +1,4 @@
This is the documentation for \VERSION. The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections.
-If you have questions or discover errors please contact \BEGIN_STYLE{code}editor@4coder.net\END_STYLE or to get help from members of the 4coder and handmade network community you can post on the 4coder forums hosted at \BEGIN_STYLE{code}4coder.handmade.network\END_STYLE.
+If you have questions or discover errors please contact \STYLE{code}editor@4coder.net\END or to get help from members of the 4coder and handmade network community you can post on the 4coder forums hosted at \STYLE{code}4coder.handmade.network\END.
diff --git a/site/source_material/roadmap.txt b/site/source_material/roadmap.txt
index 1e4680bf..7fd25601 100644
--- a/site/source_material/roadmap.txt
+++ b/site/source_material/roadmap.txt
@@ -1,40 +1,38 @@
-\BEGIN_LINK{document:home}
-\IMAGE{image:4coder_logo}{width:200}
-\END_LINK
+\INCLUDE{site_header.txt}
Right now I am working on upgrading some core internal systems that should buy me the flexibility I need to get the rest of the envisioned features done. Because these core upgrades are experimental in nature, it's hard to predict how long it will take before they are ready.
\SECTION{Improve the Core Buffer Systems}
- \BEGIN_LIST
- \BEGIN_ITEM Programmable code wrapping. \END_ITEM
- \BEGIN_ITEM Virtual/Ghost text for features such as word complete and code folding. \END_ITEM
- \BEGIN_ITEM Binary buffer mode. \END_ITEM
- \BEGIN_ITEM Fix up the undo/redo system. \END_ITEM
- \BEGIN_ITEM Expose undo/redo system in the custom layer. \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Programmable code wrapping.
+ \ITEM Virtual/Ghost text for features such as word complete and code folding.
+ \ITEM Binary buffer mode.
+ \ITEM Fix up the undo/redo system.
+ \ITEM Expose undo/redo system in the custom layer.
+ \END
+\END
\SECTION{Provide Customizations for Multiple Editing Paradgims}
- \BEGIN_LIST
- \BEGIN_ITEM Restructure custom layer to work as an event loop. \END_ITEM
- \BEGIN_ITEM Custom layer reloading at runtime. \END_ITEM
- \BEGIN_ITEM New frameworks for vim like and sublime like editing. \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Restructure custom layer to work as an event loop.
+ \ITEM Custom layer reloading at runtime.
+ \ITEM New frameworks for vim like and sublime like editing.
+ \END
+\END
\SECTION{Platform Layer Features and Porting Issues}
- \BEGIN_LIST
- \BEGIN_ITEM Upgrade the worker thread system to better support async and parallel solutions. \END_ITEM
- \BEGIN_ITEM Support for double click opening files in an existing window. \END_ITEM
- \BEGIN_ITEM Make the rendeirng system modular. \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Upgrade the worker thread system to better support async and parallel solutions.
+ \ITEM Support for double click opening files in an existing window.
+ \ITEM Make the rendeirng system modular.
+ \END
+\END
\SECTION{Buffer Driven GUI}
- \BEGIN_LIST
- \BEGIN_ITEM Labels, clickable buttons, text fields. \END_ITEM
- \BEGIN_ITEM Tables. \END_ITEM
- \BEGIN_ITEM IMGUI helper wrapper. \END_ITEM
- \END_LIST
-\END_SECTION
+ \LIST
+ \ITEM Labels, clickable buttons, text fields.
+ \ITEM Tables.
+ \ITEM IMGUI helper wrapper.
+ \END
+\END
diff --git a/site/source_material/site_header.txt b/site/source_material/site_header.txt
new file mode 100644
index 00000000..c6d9dc93
--- /dev/null
+++ b/site/source_material/site_header.txt
@@ -0,0 +1,12 @@
+
+\META_PARSE{custom_funcs}{4ed_api_implementation.cpp}
+\META_PARSE{custom_types}{4coder_API/types.h}
+\META_PARSE{string} {string/internal_4coder_string.cpp}
+\META_PARSE{lexer_funcs} {4cpp/4cpp_lexer.h}
+\META_PARSE{lexer_types} {4cpp/4cpp_lexer_types.h}
+
+\LINK{document:home}
+\IMAGE{image:4coder_logo}{width:200}
+\END
+
+
diff --git a/site/source_material/tutorials.txt b/site/source_material/tutorials.txt
index 321d38f2..c26d7aa9 100644
--- a/site/source_material/tutorials.txt
+++ b/site/source_material/tutorials.txt
@@ -1,7 +1,5 @@
-\BEGIN_LINK{document:home}
-\IMAGE{image:4coder_logo}{width:200}
-\END_LINK
+\INCLUDE{site_header.txt}
Getting started with 4coder and navigating your files: