display plain summary line in javascript
This commit is contained in:
parent
58a257bcdf
commit
0c06442bcd
1 changed files with 13 additions and 1 deletions
|
@ -669,6 +669,18 @@
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function plainSummaryLine(markdown) {
|
||||||
|
var str = markdown.replace(/\n/g, ' ')
|
||||||
|
str = str.replace(/</g, "<")
|
||||||
|
str = str.replace(/>/g, ">")
|
||||||
|
str = str.replace(/"/g, """)
|
||||||
|
str = str.replace(/'/g, "'")
|
||||||
|
str = str.replace(/^#+? (.+?)/, "$1")
|
||||||
|
str = str.replace(/\[(.*?)\]\(.*?\)/g, "$1")
|
||||||
|
str = str.replace(/\[(.*?)\]\[.*?\]/g, "$1")
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
index = buildIndex(rawSearchIndex);
|
index = buildIndex(rawSearchIndex);
|
||||||
startSearch();
|
startSearch();
|
||||||
|
|
||||||
|
@ -691,7 +703,7 @@
|
||||||
}
|
}
|
||||||
var desc = rawSearchIndex[crates[i]].items[0][3];
|
var desc = rawSearchIndex[crates[i]].items[0][3];
|
||||||
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
|
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
|
||||||
'title': desc.replace(/\n/g, ' '),
|
'title': plainSummaryLine(desc),
|
||||||
'class': klass}).text(crates[i]));
|
'class': klass}).text(crates[i]));
|
||||||
}
|
}
|
||||||
sidebar.append(div);
|
sidebar.append(div);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue