6297{
6301 Token retval = Token::make_TK_NONE();
6302
6303
6305 DocPara *lastPar = nullptr;
6306 do
6307 {
6308 {
6311 if (isFirst) { par->markFirst(); isFirst=
FALSE; }
6312 retval=par->parse();
6313 if (par->isEmpty() && par->attribs().empty())
6314 {
6316 }
6317 else
6318 {
6319 lastPar = par;
6320 }
6321 }
6322 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6323 if (retval == t)
6324 {
6326 {
6328 parser()->tokenizer.getLineNr(),
6329 "found {} command (id: '{}') outside of {} context!",
6330 sectionType,
parser()->context.token->sectionId,parentSectionType);
6331 }
6332 while (retval==t)
6333 {
6334 if (!
parser()->context.token->sectionId.isEmpty())
6335 {
6337 if (sec)
6338 {
6340 level,
6343 }
6344 else
6345 {
6347 sectionType,
parser()->context.token->sectionId,sectionType);
6348 retval = Token::make_TK_NONE();
6349 }
6350 }
6351 else
6352 {
6353 warn_doc_error(
parser()->context.fileName,
parser()->tokenizer.getLineNr(),
"Missing id for {}; ignoring {}",sectionType,sectionType);
6354 retval = Token::make_TK_NONE();
6355 }
6356 }
6357 }
6358 };
6359 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6360 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6361 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6362 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6363 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6364
6365 if (retval.
is(TokenRetval::TK_LISTITEM))
6366 {
6368 }
6369 if (retval.
is(TokenRetval::RetVal_Internal))
6370 {
6373 }
6374 }
while (!retval.
is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6376
6377
6378
6379 while (retval.
is(TokenRetval::RetVal_Section))
6380 {
6381 if (!
parser()->context.token->sectionId.isEmpty())
6382 {
6384 if (sec)
6385 {
6387 1,
6390 }
6391 else
6392 {
6394 retval = Token::make_TK_NONE();
6395 }
6396 }
6397 else
6398 {
6400 retval = Token::make_TK_NONE();
6401 }
6402 }
6403
6405}
static AnchorGenerator & instance()
Returns the singleton instance.
DocNodeVariant * thisVariant()
void markLast(bool v=TRUE)
void handleUnclosedStyleCommands()
void pop_back()
removes the last element
const T * find(const std::string &key) const
static SectionManager & instance()
returns a reference to the singleton
bool is(TokenRetval rv) const
bool is_any_of(ARGS... args) const
#define warn_doc_error(file, line, fmt,...)
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...