From ec7f4c70338ffe9e0226300d71336fe916df2db0 Mon Sep 17 00:00:00 2001 From: dx Date: Wed, 6 May 2020 06:25:37 +0100 Subject: +list handler for parser This checks if the first item is a hyphen, then generates a
  • tag surrounding the content --- Converter/src/compiler.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Converter/src/compiler.c') diff --git a/Converter/src/compiler.c b/Converter/src/compiler.c index 86f6fbd..b7e1871 100644 --- a/Converter/src/compiler.c +++ b/Converter/src/compiler.c @@ -136,6 +136,19 @@ string compile_line(string line, size_t size_of_line, string line_or_source) strncpy(compiled_line + size_of_content + tag_size - 1, close_tag, close_tag_size + 1); } + // Compile a list item + else if (line[0] == '-') + { + string tag = "
  • "; + string close_tag = "
  • "; + size_of_content = size_of_line - 1; + + compiled_line = malloc(sizeof(*compiled_line) * (size_of_line + 10)); + strncpy(compiled_line, tag, 4); + strncpy(compiled_line + 4, line + 1, size_of_line); + strncpy(compiled_line + size_of_content + 4, close_tag, 5); + } + // Compile a standard piece of text else { // Assume standard text -- cgit v1.2.3-13-gbd6f