6057{
6061 Token retval = Token::make_TK_NONE();
6062
6063
6065 DocPara *lastPar = nullptr;
6066 do
6067 {
6068 {
6071 if (isFirst) { par->markFirst(); isFirst=
FALSE; }
6072 retval=par->parse();
6073 if (par->isEmpty() && par->attribs().empty())
6074 {
6076 }
6077 else
6078 {
6079 lastPar = par;
6080 }
6081 }
6082 auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) {
6083 if (retval == t)
6084 {
6086 {
6088 parser()->tokenizer.getLineNr(),
6089 "found {} command (id: '{}') outside of {} context!",
6090 sectionType,
parser()->context.token->sectionId,parentSectionType);
6091 }
6092 while (retval==t)
6093 {
6094 if (!
parser()->context.token->sectionId.isEmpty())
6095 {
6097 if (sec)
6098 {
6100 level,
6103 }
6104 else
6105 {
6107 sectionType,
parser()->context.token->sectionId,sectionType);
6108 retval = Token::make_TK_NONE();
6109 }
6110 }
6111 else
6112 {
6113 warn_doc_error(
parser()->context.fileName,
parser()->tokenizer.getLineNr(),
"Missing id for {}; ignoring {}",sectionType,sectionType);
6114 retval = Token::make_TK_NONE();
6115 }
6116 }
6117 }
6118 };
6119 checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" );
6120 checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" );
6121 checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" );
6122 checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" );
6123 checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" );
6124
6125 if (retval.
is(TokenRetval::TK_LISTITEM))
6126 {
6128 }
6129 if (retval.
is(TokenRetval::RetVal_Internal))
6130 {
6133 }
6134 }
while (!retval.
is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section));
6136
6137
6138
6139 while (retval.
is(TokenRetval::RetVal_Section))
6140 {
6141 if (!
parser()->context.token->sectionId.isEmpty())
6142 {
6144 if (sec)
6145 {
6147 1,
6150 }
6151 else
6152 {
6154 retval = Token::make_TK_NONE();
6155 }
6156 }
6157 else
6158 {
6160 retval = Token::make_TK_NONE();
6161 }
6162 }
6163
6165}
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,...