Display note title even if first line is just an opening HTML tag
https://forums.zotero.org/discussion/28857/#Item_14
This commit is contained in:
parent
d0d0f14edb
commit
f7c3a29a57
1 changed files with 13 additions and 1 deletions
|
@ -36,9 +36,21 @@ Zotero.Notes = new function() {
|
|||
* Return first line (or first MAX_LENGTH characters) of note content
|
||||
**/
|
||||
function noteToTitle(text) {
|
||||
text = Zotero.Utilities.trim(text);
|
||||
var origText = text;
|
||||
text = text.trim();
|
||||
text = Zotero.Utilities.unescapeHTML(text);
|
||||
|
||||
// If first line is just an opening HTML tag, remove it
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// <blockquote>
|
||||
// <p>Foo</p>
|
||||
// </blockquote>
|
||||
if (/^<[^>\n]+[^\/]>\n/.test(origText)) {
|
||||
text = text.trim();
|
||||
}
|
||||
|
||||
var max = this.MAX_TITLE_LENGTH;
|
||||
|
||||
var t = text.substring(0, max);
|
||||
|
|
Loading…
Add table
Reference in a new issue