sfc-utils 1.3.12 → 1.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/topper.js +27 -4
package/package.json
CHANGED
package/topper.js
CHANGED
|
@@ -84,6 +84,29 @@ let getTopper = function(settings){
|
|
|
84
84
|
// Check safely for MOD_DATE
|
|
85
85
|
let readableModDate = storySettings.LastModDate_C2P ? convertDatesToAP(storySettings.LastModDate_C2P) : false;
|
|
86
86
|
let getBylineText = (authorName, authorLink, publishDate, modifyDate) =>{
|
|
87
|
+
let authorNames = []
|
|
88
|
+
if (authorName) {
|
|
89
|
+
authorNames = authorName.split(',')
|
|
90
|
+
}
|
|
91
|
+
let authorLinks = []
|
|
92
|
+
if (authorLink) {
|
|
93
|
+
authorLinks = authorLink.split(',')
|
|
94
|
+
}
|
|
95
|
+
let authorHTML = ""
|
|
96
|
+
for (let i = 0; i<authorNames.length; i++){
|
|
97
|
+
// If we have a matching link, build it
|
|
98
|
+
if (authorLinks[i]){
|
|
99
|
+
authorHTML += `<a class="byline-link" href=${authorLinks[i].includes('http') ? `\"${authorLinks[i].trim()}\"` : `\"https://${authorLinks[i].trim()}\"`}>${authorNames[i].trim()}</a>`
|
|
100
|
+
} else {
|
|
101
|
+
// If we don't just print the name
|
|
102
|
+
authorHTML += `<span>${authorNames[i].trim()}</span>`
|
|
103
|
+
}
|
|
104
|
+
if (i < authorNames.length - 1){
|
|
105
|
+
authorHTML += ", "
|
|
106
|
+
} else if (i === authorNames.length - 1){
|
|
107
|
+
authorHTML += " and "
|
|
108
|
+
}
|
|
109
|
+
}
|
|
87
110
|
let newPubDateString = publishDate;
|
|
88
111
|
try {
|
|
89
112
|
newPubDateString = publishDate.match(/.*\d{4}/gm)[0];
|
|
@@ -91,10 +114,10 @@ let getTopper = function(settings){
|
|
|
91
114
|
// That's fine
|
|
92
115
|
console.log(err);
|
|
93
116
|
}
|
|
94
|
-
let author = authorLink ?
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let initialText = (`By ${
|
|
117
|
+
// let author = authorLink ?
|
|
118
|
+
// `<a class="byline-link" href=${authorLink.includes('http') ? `\"${authorLink}\"` : `\"https://${authorLink}\"`}>${authorName.trim()}</a>`
|
|
119
|
+
// : authorName.trim();
|
|
120
|
+
let initialText = (`By ${authorHTML} | ${newPubDateString}`);
|
|
98
121
|
if(modifyDate){
|
|
99
122
|
return initialText + (" | Updated: " + modifyDate);
|
|
100
123
|
}
|