Add quote parsing

This commit is contained in:
Romain de Laage 2021-02-12 18:01:03 +01:00
parent 4496f3a3a9
commit 65cf0357f2
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
1 changed files with 20 additions and 0 deletions

View File

@ -10,6 +10,7 @@ void addH2 (const char *line);
void addH3 (const char *line);
void addLink (const char *url, const char *text);
void addCode (const char *meta, const char *code);
void addQuote (const char *line);
// general functions
@ -129,6 +130,19 @@ parseFile (char *path)
addCode (line + 3, code);
}
else if (size > 1 && line[0] == '>')
{
int i = 1;
//Remove whitespace before the text
while (i < size && line[i] == ' ')
i++;
//Remove tailing '\n'
line[size - 1] = '\0';
addQuote (line + i);
}
else
printf ("%s", line);
}
@ -187,4 +201,10 @@ addCode (const char *meta,
printf ("code {\n%s\n%s\n}\n", meta, code);
}
void
addQuote (const char *text)
{
printf ("quote {\n%s\n}\n", text);
}
#endif