Commit 39262936 authored by aggsol's avatar aggsol 🙉

Allow level 1 headers for the very first section

parent 19ac5e05
Pipeline #26011880 (#5) passed with stage
in 1 minute and 45 seconds
......@@ -296,17 +296,18 @@ void Parser::parseLine(const std::string& line, std::map<int, Section>& sections
}
else if(c == ' ')
{
if(counter != 3)
{
throw std::runtime_error("Level 2 header expected: ===");
}
try
{
int section = std::stoi(line.substr(i));
const int section = std::stoi(line.substr(i));
if(section != m_currSection)
{
throw std::runtime_error("Mismatch section title and section anchor");
}
if(counter != 3 && section > 1)
{
std::cerr << "section=" << section << "\n";
throw std::runtime_error("Level 2 header expected: ===");
}
state = State::Done;
}
catch(const std::exception& ex)
......
......@@ -143,7 +143,7 @@ int main(int argc, char* argv[])
if(s.first - last != 1)
{
std::cerr << rang::fg::yellow
<< "Warning: Missing section(s) " << last+1 << "-" << s.first-1 << "\n"
<< "Warning: Missing section(s) " << last+1 << " to " << s.first-1 << "\n"
<< rang::fg::reset;
}
......
[[section-0]]
== Hintergrund
== 0
[.intro]
Seit vielen Jahren ist Venyra deine Partnerin bei der Stadtwache. Ihr seid der Wache am Osttor von Oxhaven zugeteilt, der härtestens Truppe der Stadt. Zumindest behaupten Venyra und du das nach dem dritten Bier lautstark.
......@@ -16,6 +16,7 @@ Willst du in die Bar gehen, springe zu <<section-2>> +
Willst du in der Sauna entspanne, spinge zu <<section-3>>
[[section-2]]
<<<
=== 2
Kein freier Tisch in
......@@ -36,7 +37,7 @@ Springe zu <<section-4>> +
Springe zu <<section-5>>
[[section-4]]
== 4
=== 4
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
......@@ -45,7 +46,6 @@ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
Blättere nach <<section-5>>
[[section-5]]
<<<
=== 5
[.add-item-key]
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
......@@ -65,21 +65,21 @@ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
*YOU DIED!*
[[section-7]]
== 7
=== 7
This is section 7
[[section-8]]
== 8
=== 8
This section is unreached
Turn to <<section-12>>
[[section-16]]
== 16
=== 16
Far ahead in the story
[[section-10]]
== 10
=== 10
This section was written very late!
Turn to <<section-12>>
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