@@ -67,7 +67,7 @@ enum class ExplicitPageResult
6767{
6868 explicitPage, /* *< docs start with a page command */
6969 explicitMainPage, /* *< docs start with a mainpage command */
70- explicitDirPage, /* *< docs start with a dir command */
70+ explicitOtherPage, /* *< docs start with a dir / defgroup / addtogroup command */
7171 notExplicit /* *< docs doesn't start with either page or mainpage */
7272};
7373
@@ -3434,6 +3434,31 @@ QCString Markdown::Private::processBlocks(std::string_view data,const size_t ind
34343434 return out;
34353435}
34363436
3437+ #define OPC (x ) #x " " ,#x " \n "
3438+ static const StringVector otherPagingCmds =
3439+ {
3440+ OPC (dir), OPC (defgroup), OPC (addtogroup), OPC (weakgroup), OPC (ingroup),
3441+ OPC (fn), OPC (property), OPC (typedef ), OPC (var), OPC (def),
3442+ OPC (enum ), OPC (namespace ) , OPC (class ), OPC (concept ), OPC (module ),
3443+ OPC (protocol), OPC (category), OPC (union ), OPC (struct ), OPC (interface),
3444+ OPC (idlexcept)
3445+ };
3446+ #undef OPC
3447+
3448+ static bool literal_at_local (std::string_view data,const char *str)
3449+ {
3450+ size_t len = strlen (str);
3451+ return len<=data.size () && data[0 ]==str[0 ] && qstrncmp (data.data ()+1 ,str+1 ,len-1 )==0 ;
3452+ }
3453+
3454+ static bool isOtherPage (std::string_view data)
3455+ {
3456+ for (const auto &str : otherPagingCmds)
3457+ {
3458+ if (literal_at_local (data,str.c_str ())) return true ;
3459+ }
3460+ return false ;
3461+ }
34373462
34383463static ExplicitPageResult isExplicitPage (const QCString &docs)
34393464{
@@ -3471,13 +3496,10 @@ static ExplicitPageResult isExplicitPage(const QCString &docs)
34713496 return ExplicitPageResult::explicitMainPage;
34723497 }
34733498 }
3474- else if (i+1 <size &&
3475- (data[i]==' \\ ' || data[i]==' @' ) &&
3476- (literal_at (data.substr (i+1 )," dir\n " ) || literal_at (data.substr (i+1 )," dir " ))
3477- )
3499+ else if (i+1 <size && (data[i]==' \\ ' || data[i]==' @' ) && isOtherPage (data.substr (i+1 )))
34783500 {
3479- AUTO_TRACE_EXIT (" result=ExplicitPageResult::explicitDirPage " );
3480- return ExplicitPageResult::explicitDirPage ;
3501+ AUTO_TRACE_EXIT (" result=ExplicitPageResult::explicitOtherPage " );
3502+ return ExplicitPageResult::explicitOtherPage ;
34813503 }
34823504 }
34833505 AUTO_TRACE_EXIT (" result=ExplicitPageResult::notExplicit" );
@@ -3629,6 +3651,7 @@ void MarkdownOutlineParser::parseInput(const QCString &fileName,
36293651 current->docFile = fileName;
36303652 current->docLine = 1 ;
36313653 QCString docs = stripIndentation (fileBuf);
3654+ if (!docs.stripWhiteSpace ().size ()) return ;
36323655 Debug::print (Debug::Markdown,0 ," ======== Markdown =========\n ---- input ------- \n {}\n " ,fileBuf);
36333656 QCString id;
36343657 Markdown markdown (fileName,1 ,0 );
@@ -3721,7 +3744,7 @@ void MarkdownOutlineParser::parseInput(const QCString &fileName,
37213744 break ;
37223745 case ExplicitPageResult::explicitMainPage:
37233746 break ;
3724- case ExplicitPageResult::explicitDirPage :
3747+ case ExplicitPageResult::explicitOtherPage :
37253748 break ;
37263749 }
37273750 int lineNr=1 ;
0 commit comments