« get me outta code hell

don't do transformMultiline calls early - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/upd8.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-01-28 13:36:14 -0400
committer(quasar) nebula <towerofnix@gmail.com>2021-02-01 12:25:20 -0400
commitbb50b1788d4d25d549a38d85c02d2de5f23bf1cb (patch)
treedb2f000ad2b6c473786a8acb593d174214e3117b /upd8.js
parent4fd426627198ae071788eb00b0dc1c1fbc0dfd8e (diff)
don't do transformMultiline calls early
these expect to have access to the full data array, so they shouldn't be
executed until render time!

this also makes the output data more consistent.
Diffstat (limited to 'upd8.js')
-rw-r--r--upd8.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/upd8.js b/upd8.js
index 1f12fa7..94cb436 100644
--- a/upd8.js
+++ b/upd8.js
@@ -934,9 +934,6 @@ async function processNewsDataFile(file) {
 
         let bodyShort = body.split('<hr class="split">')[0];
 
-        body = transformMultiline(body);
-        bodyShort = transformMultiline(bodyShort);
-
         return {
             name,
             body,
@@ -1033,9 +1030,6 @@ async function processGroupDataFile(file) {
 
         let descriptionShort = description.split('<hr class="split">')[0];
 
-        description = transformMultiline(description);
-        descriptionShort = transformMultiline(descriptionShort);
-
         const urls = (getListField(section, 'URLs') || []).filter(Boolean);
 
         return {
@@ -1784,7 +1778,7 @@ async function writeHomepage() {
                 ${newsData.slice(0, 3).map((entry, i) => fixWS`
                     <article ${classes('news-entry', i === 0 && 'first-news-entry')}>
                         <h2><time>${getDateString(entry)}</time> <a href="${C.NEWS_DIRECTORY}/#${entry.id}">${entry.name}</a></h2>
-                        ${entry.bodyShort}
+                        ${transformMultiline(entry.bodyShort)}
                         ${entry.bodyShort !== entry.body && `<a href="${C.NEWS_DIRECTORY}/#${entry.id}">(View rest of entry!)</a>`}
                     </article>
                 `).join('\n')}
@@ -1875,7 +1869,7 @@ function writeMiscellaneousPages() {
                         ${newsData.map(entry => fixWS`
                             <article id="${entry.id}">
                                 <h2><a href="#${entry.id}">${getDateString(entry)} - ${entry.name}</a></h2>
-                                ${entry.body}
+                                ${transformMultiline(entry.body)}
                             </article>
                         `).join('\n')}
                     </div>
@@ -3586,7 +3580,7 @@ function generateSidebarRightForAlbum(album, currentTrack = null) {
                 return {group, next, previous};
             }).map(({group, next, previous}) => fixWS`
                 <h1><a href="${C.GROUP_DIRECTORY}/${group.directory}/">${group.name}</a></h1>
-                ${!currentTrack && group.descriptionShort}
+                ${!currentTrack && transformMultiline(group.descriptionShort)}
                 ${group.urls.length && `<p>Visit on ${joinNoOxford(group.urls.map(fancifyURL), 'or')}.</p>`}
                 ${!currentTrack && fixWS`
                     ${next && `<p class="group-chronology-link">Next: <a href="${C.ALBUM_DIRECTORY}/${next.directory}/" style="${getThemeString(next)}">${next.name}</a></p>`}