Skip to content

Commit 98fd484

Browse files
committed
add HTML line breaks to timestamps for better display in podcast clients
Add <br> tags after each timestamp to ensure proper line breaks in HTML-based podcast clients while maintaining readability.
1 parent bf6adf2 commit 98fd484

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

rss_generator/proc/generator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ func (g *RSSGenerator) createItemData(feed FeedConfig, post Post) (ItemData, err
174174
ulRegex := regexp.MustCompile(`<ul>[\s\S]*?</ul>`)
175175
cleanedHTML := ulRegex.ReplaceAllString(postDescriptionHTML, "")
176176

177-
// YouTube chapters as plain text
178-
chaptersText := strings.Join(youtubeChapters, "\n")
177+
// YouTube chapters with HTML line breaks
178+
chaptersText := strings.Join(youtubeChapters, "<br>\n")
179179

180180
// combine chapters with remaining HTML (image and audio links)
181181
rssDescriptionHTML = chaptersText + "\n" + cleanedHTML

rss_generator/proc/generator_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func TestRSSGenerator_createItemData(t *testing.T) {
241241
require.NoError(t, err)
242242

243243
// check that timestamps were converted to YouTube format (HH:MM:SS for videos over 1 hour)
244-
assert.Contains(t, res.Description, "00:00:00 Вступление\n")
244+
assert.Contains(t, res.Description, "00:00:00 Вступление<br>")
245245
assert.Contains(t, res.Description, "00:08:46 <a href")
246246
assert.Contains(t, res.Description, "00:27:21 <a href")
247247
assert.Contains(t, res.Description, "01:51:51 <a href")
@@ -291,9 +291,9 @@ func TestRSSGenerator_createItemData(t *testing.T) {
291291
})
292292
require.NoError(t, err)
293293

294-
expectedDescription := `00:00:00 Вступление
295-
00:08:46 <a href="https://example.com/apple">Apple останавливает продажи часов</a>
296-
00:27:21 <a href="https://example.com/debt">Весь код это технический долг</a>
294+
expectedDescription := `00:00:00 Вступление<br>
295+
00:08:46 <a href="https://example.com/apple">Apple останавливает продажи часов</a><br>
296+
00:27:21 <a href="https://example.com/debt">Весь код это технический долг</a><br>
297297
01:51:51 Темы слушателей
298298
<p><img src="https://example.com/image.jpg" alt="" /></p>
299299
@@ -345,7 +345,7 @@ func TestRSSGenerator_createItemData(t *testing.T) {
345345
require.NoError(t, err)
346346

347347
// should still convert properly without the period
348-
assert.Contains(t, res.Description, "00:00:00 Intro\n")
348+
assert.Contains(t, res.Description, "00:00:00 Intro<br>")
349349
assert.Contains(t, res.Description, "00:15:30 <a href")
350350
assert.Contains(t, res.Description, "01:45:20 <a href")
351351
})

0 commit comments

Comments
 (0)