From f7c3a29a57558cdd3d38fcb80d03979c7a49a9da Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 14 Apr 2013 19:14:46 -0400 Subject: [PATCH] Display note title even if first line is just an opening HTML tag https://forums.zotero.org/discussion/28857/#Item_14 --- chrome/content/zotero/xpcom/data/notes.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/data/notes.js b/chrome/content/zotero/xpcom/data/notes.js index 88a2599c3..74c18983c 100644 --- a/chrome/content/zotero/xpcom/data/notes.js +++ b/chrome/content/zotero/xpcom/data/notes.js @@ -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: + // + //
+ //

Foo

+ //
+ if (/^<[^>\n]+[^\/]>\n/.test(origText)) { + text = text.trim(); + } + var max = this.MAX_TITLE_LENGTH; var t = text.substring(0, max);