« get me outta code hell

consistent numbering across <ol> in groups - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2020-10-29 12:04:39 -0300
committer(quasar) nebula <towerofnix@gmail.com>2020-10-29 12:04:39 -0300
commit4c03731a140d5d8a68ae330a2884f210acae511c (patch)
tree83822e90f9d9d62c3a02431ad4dbd2f9c87c6f77
parent27a4e25b190054d092fe1adf1081877aa35529b0 (diff)
consistent numbering across <ol> in groups
-rw-r--r--upd8.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/upd8.js b/upd8.js
index 6dc80028..1010a268 100644
--- a/upd8.js
+++ b/upd8.js
@@ -1339,7 +1339,7 @@ async function writeAlbumPage(album) {
                             (i > 0 && track.group !== arr[i - 1].group) && `</${listTag}></dd>`,
                             (i === 0 || track.group !== arr[i - 1].group) && fixWS`
                                 ${track.group && `<dt>${track.group}:</dt>`}
-                                <dd><${listTag}>
+                                <dd><${listTag === 'ol' ? `ol start="${i + 1}"` : listTag}>
                             `,
                             trackToListItem(track),
                             i === arr.length && `</${listTag}></dd>`
@@ -2449,8 +2449,12 @@ function generateSidebarForAlbum(album, currentTrack = null) {
                 ${album.tracks.flatMap((track, i, arr) => [
                     (i > 0 && track.group !== arr[i - 1].group) && `</${listTag}></dd>`,
                     (i === 0 || track.group !== arr[i - 1].group) && fixWS`
-                        ${track.group && `<dt style="${getThemeString(track)}" ${classes(currentTrack && track.group === currentTrack.group && 'current')}><a href="${C.TRACK_DIRECTORY}/${track.directory}/index.html">${track.group}</a></dt>`}
-                        <dd style="${getThemeString(track)}"><${listTag}>
+                        ${track.group && fixWS`
+                            <dt style="${getThemeString(track)}" ${classes(currentTrack && track.group === currentTrack.group && 'current')}>
+                                <a href="${C.TRACK_DIRECTORY}/${track.directory}/index.html">${track.group}</a>
+                            </dt>
+                        `}
+                        <dd style="${getThemeString(track)}"><${listTag === 'ol' ? `ol start="${i + 1}"` : listTag}>
                     `,
                     (!currentTrack || track.group === currentTrack.group) && trackToListItem(track),
                     i === arr.length && `</${listTag}></dd>`