From 58d7599978c5caeee339a049244584c44f88f38b Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 10 Jul 2017 13:52:01 -0400 Subject: [PATCH] got site builder end section working --- meta/4ed_metagen.cpp | 1 - site/4ed_abstract_document.cpp | 17 ++++++++++++++++- site/4ed_sitegen.cpp | 1 - string/4ed_string_builder.cpp | 1 - 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/meta/4ed_metagen.cpp b/meta/4ed_metagen.cpp index 96c253b2..9e25be80 100644 --- a/meta/4ed_metagen.cpp +++ b/meta/4ed_metagen.cpp @@ -32,7 +32,6 @@ #include "4ed_file_moving.h" #include "4ed_meta_parser.cpp" #include "4ed_meta_keywords.h" -#include "4ed_out_context.cpp" ////////////////////////////////////////////////////////////////////////////////////////////////// char *keys_that_need_codes[] = { diff --git a/site/4ed_abstract_document.cpp b/site/4ed_abstract_document.cpp index 9ed8a8ff..753d8107 100644 --- a/site/4ed_abstract_document.cpp +++ b/site/4ed_abstract_document.cpp @@ -666,6 +666,7 @@ write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_ Cmd_EndLink, Cmd_Image, Cmd_Video, + Cmd_EndSection, // never below this Cmd_COUNT, }; @@ -687,6 +688,7 @@ write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_ 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"); i = command_end; @@ -767,7 +769,8 @@ write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_ body_text = skip_chop_whitespace(body_text); html_render_section_header(out, body_text, null_string, section_counter); - ++section_counter->counter[section_counter->nest_level]; + section_counter->counter[section_counter->nest_level]; + ++section_counter->nest_level; item_counter = 0; } }break; @@ -891,6 +894,18 @@ write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_ } } }break; + + case Cmd_EndSection: + { + if (section_counter->nest_level > 0){ + --section_counter->nest_level; + ++section_counter->counter[section_counter->nest_level]; + } + else{ + append(out, "! Doc generator error: unmatched section end !"); + fprintf(stderr, "error: unmatched section end\n"); + } + }break; } } else{ diff --git a/site/4ed_sitegen.cpp b/site/4ed_sitegen.cpp index 6a75bf7c..3bde6493 100644 --- a/site/4ed_sitegen.cpp +++ b/site/4ed_sitegen.cpp @@ -32,7 +32,6 @@ #include "../meta/4ed_file_moving.h" #include "../meta/4ed_meta_parser.cpp" #include "../meta/4ed_meta_keywords.h" -#include "../meta/4ed_out_context.cpp" #include "4ed_abstract_document.cpp" /////////////////////////////////////////////////////////////////////////// diff --git a/string/4ed_string_builder.cpp b/string/4ed_string_builder.cpp index 6b17a908..5341e9af 100644 --- a/string/4ed_string_builder.cpp +++ b/string/4ed_string_builder.cpp @@ -30,7 +30,6 @@ #include "../meta/4ed_file_moving.h" #include "../meta/4ed_meta_parser.cpp" #include "../meta/4ed_meta_keywords.h" -#include "../meta/4ed_out_context.cpp" #include #include