eleventy-plugin-podcaster 2.0.0-alpha.1 → 2.0.0-alpha.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-podcaster",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.2",
4
4
  "description": "An Eleventy plugin that allows you to create a podcast and its accompanying website",
5
5
  "main": "eleventy.config.js",
6
6
  "exports": {
@@ -52,7 +52,7 @@ export default function (eleventyConfig) {
52
52
  })
53
53
 
54
54
  const filenameSeasonAndEpisodePattern =
55
- /^.*?\b[sS](?<seasonNumber>\d+)[eE](?<episodeNumber>\d+)\b.*\.mp3$/
55
+ /^.*?\b[sS](?<seasonNumber>\d+)\s*[eE](?<episodeNumber>\d+)\b.*\.mp3$/
56
56
  const filenameEpisodePattern = /^.*?\b(?<episodeNumber>\d+)\b.*\.mp3$/
57
57
 
58
58
  eleventyConfig.addGlobalData('eleventyComputed.episode.filename', () => {
@@ -13,12 +13,17 @@ export default function (eleventyConfig, options = {}) {
13
13
  return result.setLocale(readableDateLocale).toLocaleString(DateTime.DATE_HUGE)
14
14
  })
15
15
 
16
- eleventyConfig.addFilter('readableDuration', (seconds) => {
16
+ eleventyConfig.addFilter('readableDuration', (seconds, length) => {
17
17
  if (!seconds) return '0:00:00'
18
- if (seconds < 3600) {
18
+ if (length === 'long') {
19
+ return Duration.fromMillis(seconds * 1000)
20
+ .shiftTo('days', 'hours', 'minutes', 'seconds')
21
+ .toHuman()
22
+ } else if (seconds < 60 * 60) {
19
23
  return Duration.fromMillis(seconds * 1000).toFormat('mm:ss')
24
+ } else {
25
+ return Duration.fromMillis(seconds * 1000).toFormat('h:mm:ss')
20
26
  }
21
- return Duration.fromMillis(seconds * 1000).toFormat('h:mm:ss')
22
27
  })
23
28
 
24
29
  eleventyConfig.addFilter('readableSize', (bytes, fixedPrecision = 1) =>