Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser fail to find a list if it is not explicitly in its own paragraph #32

Open
NicoG60 opened this issue Aug 13, 2020 · 3 comments
Open
Labels
feature Feature Request

Comments

@NicoG60
Copy link

NicoG60 commented Aug 13, 2020

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.

@progsource
Copy link
Owner

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.

@progsource progsource added the feature Feature Request label Oct 4, 2020
@NicoG60
Copy link
Author

NicoG60 commented Oct 5, 2020

Not saying maddy is bad! I think it's awesome, I just wanted to let you now abut that tiny detail.

@progsource
Copy link
Owner

I'm happy for every contribution, also for you telling me this. So no worries ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants