6069{
6073 Token retval = Token::make_TK_NONE();
6074
6075
6077 DocPara *lastPar = nullptr;
6078 do
6079 {
6080 {
6083 if (isFirst) { par->markFirst(); isFirst=
FALSE; }
6084 retval=par->parse();
6085 if (par->isEmpty() && par->attribs().empty())
6086 {
6088 }
6089 else
6090 {
6091 lastPar = par;
6092 }
6093 }
6094 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6095 if (retval == t)
6096 {
6098 {
6100 parser()->tokenizer.getLineNr(),
6101 "found {} command (id: '{}') outside of {} context!",
6102 sectionType,
parser()->context.token->sectionId,parentSectionType);
6103 }
6104 while (retval==t)
6105 {
6106 if (!
parser()->context.token->sectionId.isEmpty())
6107 {
6109 if (sec)
6110 {
6112 level,
6115 }
6116 else
6117 {
6119 sectionType,
parser()->context.token->sectionId,sectionType);
6120 retval = Token::make_TK_NONE();
6121 }
6122 }
6123 else
6124 {
6125 warn_doc_error(
parser()->context.fileName,
parser()->tokenizer.getLineNr(),
"Missing id for {}; ignoring {}",sectionType,sectionType);
6126 retval = Token::make_TK_NONE();
6127 }
6128 }
6129 }
6130 };
6131 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6132 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6133 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6134 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6135 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6136
6137 if (retval.
is(TokenRetval::TK_LISTITEM))
6138 {
6140 }
6141 if (retval.
is(TokenRetval::RetVal_Internal))
6142 {
6145 }
6146 }
while (!retval.
is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6148
6149
6150
6151 while (retval.
is(TokenRetval::RetVal_Section))
6152 {
6153 if (!
parser()->context.token->sectionId.isEmpty())
6154 {
6156 if (sec)
6157 {
6159 1,
6162 }
6163 else
6164 {
6166 retval = Token::make_TK_NONE();
6167 }
6168 }
6169 else
6170 {
6172 retval = Token::make_TK_NONE();
6173 }
6174 }
6175
6177}
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,...