Skip to content

Commit 5421849

Browse files
committed
issue #11557 @TableofContents shows <tt> tags for MarkDown headings with inline code
1 parent 2604e3f commit 5421849

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

src/searchindex_js.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,31 @@ static void splitSearchTokens(QCString &title,IntVector &indices)
134134
for (size_t si=0; si<title.length(); si++)
135135
{
136136
char c = title.at(si);
137-
if (isId(c) || c==':') // add "word" character
137+
if (c=='@' || c=='\\') // skip over special commands
138+
{
139+
title.at(di)=' ';
140+
if (si<title.length()-1)
141+
{
142+
c = title.at(++si);
143+
while (si<title.length() && (isId(c) || c==':')) c = title.at(++si);
144+
--si;
145+
}
146+
}
147+
else if (c=='<') // skip over html tags
148+
{
149+
if (si<title.length()-1)
150+
{
151+
for (size_t tsi = si; tsi<title.length(); ++tsi)
152+
{
153+
if (title.at(tsi)=='>')
154+
{
155+
si=tsi;
156+
break;
157+
}
158+
}
159+
}
160+
}
161+
else if (isId(c) || c==':') // add "word" character
138162
{
139163
title.at(di)=c;
140164
di++;
@@ -504,9 +528,11 @@ void createJavaScriptSearchIndex()
504528
QCString title = filterTitle(sectionInfo->title());
505529
IntVector tokenIndices;
506530
splitSearchTokens(title,tokenIndices);
531+
//printf("split(%s)=(%s) %zu\n",qPrint(sectionInfo->title()),qPrint(title),tokenIndices.size());
507532
for (int index : tokenIndices)
508533
{
509534
g_searchIndexInfo[SEARCH_INDEX_ALL].add(SearchTerm(title.mid(index),sectionInfo.get()));
535+
g_searchIndexInfo[SEARCH_INDEX_PAGES].add(SearchTerm(title.mid(index),sectionInfo.get()));
510536
}
511537
}
512538
}
@@ -779,7 +805,7 @@ static void writeJavasScriptSearchDataPage(const QCString &baseName,const QCStri
779805
}
780806
else if (si)
781807
{
782-
name = convertToXML(filterTitle(si->title()));
808+
name = convertTitleToHtml(si->definition(),si->fileName(),si->lineNr(),si->title());
783809
found = true;
784810
}
785811
if (!found) // fallback

templates/html/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,9 @@ function createResults(resultsPath) {
654654
setKeyActions(srChild,'return searchResults.NavChild(event,'+index+','+c+')');
655655
setClassAttr(srChild,'SRScope');
656656
if (elem[1][c+1][0].startsWith('http://') || elem[1][c+1][0].startsWith('https://')) { // absolute path
657-
srLink.setAttribute('href',elem[1][c+1][0]);
657+
srChild.setAttribute('href',elem[1][c+1][0]);
658658
} else { // relative path
659-
srLink.setAttribute('href',resultsPath+elem[1][c+1][0]);
659+
srChild.setAttribute('href',resultsPath+elem[1][c+1][0]);
660660
}
661661
srChild.setAttribute('onclick','searchBox.CloseResultsWindow()');
662662
if (elem[1][c+1][1]) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy