Skip to content

Commit ddd965e

Browse files
committed
fix: one-liner quote parser does not give any output
1 parent 07dde0c commit ddd965e

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ maddy uses [semver versioning](https://semver.org/).
1414

1515
## Upcoming
1616

17+
* ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) One-liner quote is not producing any output.
1718
* ...
1819

1920
## version 1.6.0 2025-07-26

include/maddy/quoteparser.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class QuoteParser : public BlockParser
9999
this->childParser = nullptr;
100100
}
101101

102+
this->finishQuote(finish);
103+
102104
return;
103105
}
104106

@@ -107,11 +109,7 @@ class QuoteParser : public BlockParser
107109
this->parseLine(line);
108110
}
109111

110-
if (finish)
111-
{
112-
this->result << "</blockquote>";
113-
this->isFinished = true;
114-
}
112+
this->finishQuote(finish);
115113

116114
this->result << line;
117115
}
@@ -145,6 +143,15 @@ class QuoteParser : public BlockParser
145143
private:
146144
bool isStarted;
147145
bool isFinished;
146+
147+
void finishQuote(bool finish)
148+
{
149+
if (finish)
150+
{
151+
this->result << "</blockquote>";
152+
this->isFinished = true;
153+
}
154+
}
148155
}; // class QuoteParser
149156

150157
// -----------------------------------------------------------------------------

tests/maddy/test_maddy_parser.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ TEST(MADDY_PARSER, ItShouldParse)
2121
ASSERT_EQ(testHtml, output);
2222
}
2323

24+
TEST(MADDY_PARSER, ItShouldParseOneLiner)
25+
{
26+
auto parser = std::make_shared<maddy::Parser>();
27+
std::stringstream markdown("> This is a **test**");
28+
29+
const std::string output = parser->Parse(markdown);
30+
31+
ASSERT_EQ(
32+
"<blockquote><p>This is a <strong>test</strong> </p></blockquote>", output
33+
);
34+
}
35+
2436
TEST(MADDY_PARSER, ItShouldParseWithBitwiseConfig)
2537
{
2638
auto config = std::make_shared<maddy::ParserConfig>();

0 commit comments

Comments
 (0)