got site builder end section working

master
Allen Webster 2017-07-10 13:52:01 -04:00
parent e5abd6a135
commit 58d7599978
4 changed files with 16 additions and 4 deletions

View File

@ -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[] = {

View File

@ -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, "<span style='color:#F00'>! Doc generator error: unmatched section end !</span>");
fprintf(stderr, "error: unmatched section end\n");
}
}break;
}
}
else{

View File

@ -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"
///////////////////////////////////////////////////////////////////////////

View File

@ -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 <stdio.h>
#include <string.h>