@@ -517,16 +517,22 @@ int Markdown::isSpecialCommand(const char *data,int offset,int size)
517
517
return endOfLabel (data_,offset_,size_);
518
518
};
519
519
520
- static const auto endOfFunc = [](const char *data_,int offset_,int size_) -> int
520
+ static const auto endOfFuncLike = [](const char *data_,int offset_,int size_, bool allowSpaces ) -> int
521
521
{
522
522
if (offset_<size_ && data_[offset_]==' ' ) // we expect a space before the name
523
523
{
524
524
char c=0 ;
525
525
offset_++;
526
526
// skip over spaces
527
- while (offset_<size_ && data_[offset_]==' ' ) offset_++;
528
- // skip over name
529
- while (offset_<size_ && (c=data_[offset_])!=' ' && c!=' \n ' && c!=' (' ) offset_++;
527
+ while (offset_<size_ && data_[offset_]==' ' )
528
+ {
529
+ offset_++;
530
+ }
531
+ // skip over name (and optionally type)
532
+ while (offset_<size_ && (c=data_[offset_])!=' \n ' && (allowSpaces || c!=' ' ) && c!=' (' )
533
+ {
534
+ offset_++;
535
+ }
530
536
if (c==' (' ) // find the end of the function
531
537
{
532
538
int count=1 ;
@@ -543,9 +549,14 @@ int Markdown::isSpecialCommand(const char *data,int offset,int size)
543
549
return 0 ;
544
550
};
545
551
552
+ static const auto endOfFunc = [](const char *data_,int offset_,int size_) -> int
553
+ {
554
+ return endOfFuncLike (data_,offset_,size_,true );
555
+ };
556
+
546
557
static const auto endOfGuard = [](const char *data_,int offset_,int size_) -> int
547
558
{
548
- return endOfFunc (data_,offset_,size_);
559
+ return endOfFuncLike (data_,offset_,size_, false );
549
560
};
550
561
551
562
static const std::unordered_map<std::string,EndCmdFunc> cmdNames =
0 commit comments