Commit 3ae3db56 authored by aggsol's avatar aggsol 🙉

* fix: allow sections after styles

parent 5c29572d
......@@ -123,6 +123,7 @@ void Parser::parseLine(const std::string& line, std::map<int, Section>& sections
case State::ReferenceStart:
if(c == '<')
{
value.clear();
state = State::ReferenceSection;
}
else // stray '<' is allowed
......@@ -147,7 +148,9 @@ void Parser::parseLine(const std::string& line, std::map<int, Section>& sections
}
catch(const std::exception& ex)
{
throw std::runtime_error("Invalid section number");
std::ostringstream msg;
msg << "Invalid section number. value=" << value;
throw std::runtime_error(msg.str());
}
}
else if(std::isdigit(c))
......
......@@ -10,11 +10,22 @@ public:
ParserTest()
: tiny::Unit(__FILE__)
{
tiny::Unit::registerTest(&ParserTest::stylesection, "stylesection");
tiny::Unit::registerTest(&ParserTest::badheader, "badheader");
tiny::Unit::registerTest(&ParserTest::badref, "badref");
tiny::Unit::registerTest(&ParserTest::classes, "classes");
}
static void stylesection()
{
bodhi::Parser parser("../test/stylesection.adoc");
std::map<int, bodhi::Section> sections;
bool error = parser.parse(sections);
TINY_ASSERT_OK(not error);
}
static void badheader()
{
bodhi::Parser parser("../test/badheading.adoc");
......
[[section-12]]
=== 12
asd asd
asd asd [.style]#Hello World# asd asd <<section-13>>
[[section-13]]
=== 13
[.nothing-here]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment