commit f7c3a29a57558cdd3d38fcb80d03979c7a49a9da parent d0d0f14edba35edab121203116458efd7aaad62a Author: Dan Stillman <dstillman@zotero.org> Date: Sun, 14 Apr 2013 19:14:46 -0400 Display note title even if first line is just an opening HTML tag https://forums.zotero.org/discussion/28857/#Item_14 Diffstat:
| M | 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 @@ -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);