Skip to content

Commit f559aad

Browse files
committed
issue #10504 A list inside an alias on a markdown page seems broken, it repeats the alias indefinitely
When the HTML tag is an end tag and matches the tag just before the list it is handled as an end list as well.
1 parent 8669711 commit f559aad

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

src/docnode.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5380,6 +5380,47 @@ int DocPara::parse()
53805380
}
53815381
else // found an end tag
53825382
{
5383+
const DocNodeVariant *n=parent();
5384+
int indent = 0;
5385+
bool rerun = false;
5386+
while (n)
5387+
{
5388+
if (std::get_if<DocAutoListItem>(n))
5389+
{
5390+
continue;
5391+
}
5392+
else if (std::get_if<DocAutoList>(n))
5393+
{
5394+
const DocAutoList *al = std::get_if<DocAutoList>(n);
5395+
indent = al->indent();
5396+
}
5397+
else if (std::get_if<DocPara>(n))
5398+
{
5399+
QCString tagNameLower = QCString(parser()->context.token->name).lower();
5400+
auto topStyleChange = [](const DocStyleChangeStack &stack) -> const DocStyleChange &
5401+
{
5402+
return std::get<DocStyleChange>(*stack.top());
5403+
};
5404+
5405+
if (parser()->context.styleStack.empty() || // no style change
5406+
topStyleChange(parser()->context.styleStack).tagName()!=tagNameLower || // wrong style change
5407+
topStyleChange(parser()->context.styleStack).position()!=parser()->context.nodeStack.size() // wrong position
5408+
)
5409+
{
5410+
QCString indentStr;
5411+
indentStr.fill(' ',indent);
5412+
parser()->tokenizer.unputString("\\ilinebr.\\ilinebr"+indentStr+"</"+parser()->context.token->name+">");
5413+
rerun = true;
5414+
break;
5415+
}
5416+
}
5417+
else
5418+
{
5419+
break;
5420+
}
5421+
n=::parent(n);
5422+
}
5423+
if (rerun) break;
53835424
retval = handleHtmlEndTag(parser()->context.token->name);
53845425
}
53855426
if (retval!=RetVal_OK)

src/doctokenizer.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ OPTSTARS ("/""/"{BLANK}*)?"*"*{BLANK}*
271271
LISTITEM {BLANK}*[-]("#")?{WS}
272272
MLISTITEM {BLANK}*[+*]{WS}
273273
OLISTITEM {BLANK}*[1-9][0-9]*"."{BLANK}
274-
ENDLIST {BLANK}*"."{BLANK}*\n
274+
ENDLIST {BLANK}*"."{BLANK}*(\n|"\\ilinebr")
275275
ATTRNAME [a-z_A-Z\x80-\xFF][:a-z_A-Z0-9\x80-\xFF\-]*
276276
ATTRIB {ATTRNAME}{WS}*("="{WS}*(("\""[^\"]*"\"")|("'"[^\']*"'")|[^ \t\r\n'"><]+))?
277277
URLCHAR [a-z_A-Z0-9\!\~\,\:\;\'\$\?\@\&\%\#\.\-\+\/\=\x80-\xFF]

0 commit comments

Comments
 (0)