Insert more line breaks
This commit is contained in:
parent
5937369223
commit
09b1f48aea
@ -68,7 +68,7 @@ final class FeedPageGenerator {
|
|||||||
header: pageHeader,
|
header: pageHeader,
|
||||||
additionalFooter: footer) { content in
|
additionalFooter: footer) { content in
|
||||||
if let pageTitle {
|
if let pageTitle {
|
||||||
content += "<h1 class='separated-headline'>\(pageTitle)</h1>"
|
content += "<h1 class='separated-headline'>\(pageTitle)</h1>\n"
|
||||||
}
|
}
|
||||||
for post in posts {
|
for post in posts {
|
||||||
content += FeedEntry(data: post).content
|
content += FeedEntry(data: post).content
|
||||||
|
@ -122,7 +122,13 @@ struct AudioPlayer: HtmlProducer {
|
|||||||
|
|
||||||
var content: String {
|
var content: String {
|
||||||
"""
|
"""
|
||||||
<div class="playlist-song amplitude-song-container amplitude-play-pause amplitude-paused" data-amplitude-song-index="\(index)"><img src="\(image)"><div class="playlist-song-meta"><span class="playlist-song-name">\(name)</span><span class="playlist-song-artist">\(album) • \(artist)</span></div></div>
|
<div class="playlist-song amplitude-song-container amplitude-play-pause amplitude-paused" data-amplitude-song-index="\(index)">
|
||||||
|
<img src="\(image)">
|
||||||
|
<div class="playlist-song-meta">
|
||||||
|
<span class="playlist-song-name">\(name)</span>
|
||||||
|
<span class="playlist-song-artist">\(album) • \(artist)</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@ struct AudioPlayerScript: HtmlProducer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func populate(_ result: inout String) {
|
func populate(_ result: inout String) {
|
||||||
result += "<script>window.onload = () => { "
|
result += "<script>\nwindow.onload = () => { "
|
||||||
result += "Amplitude.init({ songs: "
|
result += "Amplitude.init({ songs: "
|
||||||
let songData = try! JSONEncoder().encode(items)
|
let songData = try! JSONEncoder().encode(items)
|
||||||
result += String(data: songData, encoding: .utf8)!
|
result += String(data: songData, encoding: .utf8)!
|
||||||
result += "}); }; " // Close Amplitude.init and window.onload
|
result += "}); };\n" // Close Amplitude.init and window.onload
|
||||||
result += "function playEntry(index) { Amplitude.playSongAtIndex(index) };"
|
result += "function playEntry(index) { Amplitude.playSongAtIndex(index) };"
|
||||||
result += animatePlaylist
|
result += animatePlaylist
|
||||||
result += "</script>"
|
result += "\n</script>"
|
||||||
}
|
}
|
||||||
|
|
||||||
private var animatePlaylist: String {
|
private var animatePlaylist: String {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct FeedEntry {
|
struct FeedEntry: HtmlProducer {
|
||||||
|
|
||||||
private let data: FeedEntryData
|
private let data: FeedEntryData
|
||||||
|
|
||||||
@ -12,8 +12,8 @@ struct FeedEntry {
|
|||||||
data.link != nil ? " linked-card" : ""
|
data.link != nil ? " linked-card" : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var content: String {
|
func populate(_ result: inout String) {
|
||||||
var result = "<article><div class='card\(cardLinkClassText)'>"
|
result += "<article><div class='card\(cardLinkClassText)'>"
|
||||||
switch data.media {
|
switch data.media {
|
||||||
case .images(let images):
|
case .images(let images):
|
||||||
ImageGallery(id: data.entryId, images: images).populate(&result)
|
ImageGallery(id: data.entryId, images: images).populate(&result)
|
||||||
@ -41,7 +41,6 @@ struct FeedEntry {
|
|||||||
if let url = data.link {
|
if let url = data.link {
|
||||||
result += "<div class='link-center'><div class='link'>\(url.text)</div></div>"
|
result += "<div class='link-center'><div class='link'>\(url.text)</div></div>"
|
||||||
}
|
}
|
||||||
result += "</div></div></article>" // Closes card-content, card, article
|
result += "</div></div></article>\n" // Closes card-content, card, article
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,9 @@ struct GenericPage {
|
|||||||
var content: String {
|
var content: String {
|
||||||
var result = ""
|
var result = ""
|
||||||
header.populate(&result) // Opens <html><body><main>
|
header.populate(&result) // Opens <html><body><main>
|
||||||
|
result += "\n"
|
||||||
insertedContent(&result)
|
insertedContent(&result)
|
||||||
result += "</main>" // Close <main>
|
result += "</main>\n" // Close <main>
|
||||||
result += additionalFooter
|
result += additionalFooter
|
||||||
result += "</body></html>" // Close <body><html>
|
result += "</body></html>" // Close <body><html>
|
||||||
return result
|
return result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user