aboutsummaryrefslogtreecommitdiff
path: root/Converter
diff options
context:
space:
mode:
authordx <aryadevchavali1@gmail.com>2020-05-06 06:25:37 +0100
committerdx <aryadevchavali1@gmail.com>2020-05-06 06:25:37 +0100
commitec7f4c70338ffe9e0226300d71336fe916df2db0 (patch)
tree31ef4bd625af45c8a3b70b1acb463814b2fbf03f /Converter
parented72f50d39da7a689e44f814efec9de59f5f24ac (diff)
downloadmdhtml-ec7f4c70338ffe9e0226300d71336fe916df2db0.tar.gz
mdhtml-ec7f4c70338ffe9e0226300d71336fe916df2db0.tar.bz2
mdhtml-ec7f4c70338ffe9e0226300d71336fe916df2db0.zip
+list handler for parser
This checks if the first item is a hyphen, then generates a <li> tag surrounding the content
Diffstat (limited to 'Converter')
-rw-r--r--Converter/src/compiler.c13
1 files changed, 13 insertions, 0 deletions
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 = "<li>";
+ string close_tag = "</li>";
+ 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