fix: one-liner quote parser does not give any output

This commit is contained in:
Petra Baranski
2025-10-06 01:08:02 +02:00
parent 07dde0c630
commit ddd965e9fc
3 changed files with 25 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ maddy uses [semver versioning](https://semver.org/).
## Upcoming
* ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) One-liner quote is not producing any output.
* ...
## version 1.6.0 2025-07-26

View File

@@ -99,6 +99,8 @@ public:
this->childParser = nullptr;
}
this->finishQuote(finish);
return;
}
@@ -107,11 +109,7 @@ public:
this->parseLine(line);
}
if (finish)
{
this->result << "</blockquote>";
this->isFinished = true;
}
this->finishQuote(finish);
this->result << line;
}
@@ -145,6 +143,15 @@ protected:
private:
bool isStarted;
bool isFinished;
void finishQuote(bool finish)
{
if (finish)
{
this->result << "</blockquote>";
this->isFinished = true;
}
}
}; // class QuoteParser
// -----------------------------------------------------------------------------

View File

@@ -21,6 +21,18 @@ TEST(MADDY_PARSER, ItShouldParse)
ASSERT_EQ(testHtml, output);
}
TEST(MADDY_PARSER, ItShouldParseOneLiner)
{
auto parser = std::make_shared<maddy::Parser>();
std::stringstream markdown("> This is a **test**");
const std::string output = parser->Parse(markdown);
ASSERT_EQ(
"<blockquote><p>This is a <strong>test</strong> </p></blockquote>", output
);
}
TEST(MADDY_PARSER, ItShouldParseWithBitwiseConfig)
{
auto config = std::make_shared<maddy::ParserConfig>();