Add tag overview, improve assets

This commit is contained in:
Christoph Hagen
2024-12-15 21:20:12 +01:00
parent 8a3a0f1797
commit 1e67a99866
59 changed files with 1301 additions and 480 deletions

View File

@@ -0,0 +1,55 @@
import Foundation
class Item: ObservableObject, Identifiable {
unowned let content: Content
@Published
var id: String
init(content: Content, id: String) {
self.content = content
self.id = id
}
func makeCleanAbsolutePath(_ path: String) -> String {
"/" + makeCleanRelativePath(path)
}
func makeCleanRelativePath(_ path: String) -> String {
path.components(separatedBy: "/").filter { !$0.isEmpty }.joined(separator: "/")
}
func title(in language: ContentLanguage) -> String {
fatalError()
}
func absoluteUrl(in language: ContentLanguage) -> String {
fatalError()
}
var itemType: ItemType {
fatalError()
}
}
extension Item: Equatable {
static func == (lhs: Item, rhs: Item) -> Bool {
lhs.id == rhs.id
}
}
extension Item: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
}
extension Item: Comparable {
static func < (lhs: Item, rhs: Item) -> Bool {
lhs.id < rhs.id
}
}