maddy
maddy copied to clipboard
Parser fail to find a list if it is not explicitly in its own paragraph
Minimal Code Example
#include <iostream>
#include <string>
#include <maddy/parser.h>
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
// Parser is not giving expected output
std::string bad =
"**Some Title**\n"
"- List element 1\n"
"- List element 2";
std::stringstream badInput(bad);
// Parser works as expected
std::string good =
"**Some Title**\n"
"\n"
"- List element 1\n"
"- List element 2";
std::stringstream goodInput(good);
auto parser = std::make_shared<maddy::Parser>();
std::cout << "Bad: " << parser->Parse(badInput) << std::endl;
std::cout << "Good: " << parser->Parse(goodInput) << std::endl;
}
Output
Bad: <p><strong>Some Title</strong> - List element 1 - List element 2 </p>
Good: <p><strong>Some Title</strong> </p><ul><li>List element 1</li><li>List element 2</li></ul>
Conditions
. | . |
---|---|
Operating System: | macOS 10.15.6 |
Compiler: | Apple clang 11.0.3 |
Compiler flags: | clang++ -std=c++17 -Imaddy/include -o maddy_test main.cpp |
maddy version: | 1.1.1 |
I don't think it is a platform issue, just filling for the sake of completeness
Description
The parser doesn't recognise the list if there is not a empty line before it. It feels a bit weird as most other parsers/viewer handles it. I'll have a deeper look at the code and try to make a pull request.
The problem with it is that maddy ends blocks usually only at empty lines. I consider rewriting maddy at some point, that it doesn't use regex anymore, but a lexer. Just have to find the time for it.
Not saying maddy is bad! I think it's awesome, I just wanted to let you now abut that tiny detail.
I'm happy for every contribution, also for you telling me this. So no worries ;)