From fc200250e8afa35e0662d5358611503db6287ef0 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 24 Aug 2017 22:20:07 -0600 Subject: [PATCH] Better quote prefix generator --- core/ftn_util.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/ftn_util.js b/core/ftn_util.js index c482650f..8dd1f25c 100644 --- a/core/ftn_util.js +++ b/core/ftn_util.js @@ -165,8 +165,18 @@ function getUTCTimeZoneOffset() { // Get a FSC-0032 style quote prefixes function getQuotePrefix(name) { - // :TODO: Add support for real names (e.g. with spaces) -> initials - return ' ' + name[0].toUpperCase() + name[1].toLowerCase() + '> '; + let initials; + + const parts = name.split(' '); + if(parts.length > 1) { + // First & Last initials - (Bryan Ashby -> BA) + initials = `${parts[0].slice(0, 1)}${parts[parts.length - 1].slice(0, 1)}`.toUpperCase(); + } else { + // Just use the first two - (NuSkooler -> Nu) + initials = _.capitalize(name.slice(0, 2)); + } + + return ` ${initials}> `; } //