Gemini/GeminiFormat/Document.swift

37 lines
723 B
Swift
Raw Normal View History

2020-07-13 03:09:22 +00:00
//
// Document.swift
// GeminiFormat
//
// Created by Shadowfacts on 7/12/20.
//
import Foundation
2020-07-13 03:25:20 +00:00
public struct Document {
public let url: URL
public var lines: [Line]
2020-07-13 03:09:22 +00:00
2020-07-13 03:52:38 +00:00
public init(url: URL, lines: [Line] = []) {
2020-07-13 03:09:22 +00:00
self.url = url
self.lines = lines
}
}
2020-07-13 03:25:20 +00:00
public extension Document {
2020-07-13 03:09:22 +00:00
enum Line: Equatable {
case text(String)
case link(URL, text: String?)
2020-07-13 03:52:38 +00:00
case preformattedToggle(alt: String?)
case preformattedText(String)
2020-07-13 03:09:22 +00:00
case heading(String, level: HeadingLevel)
case unorderedListItem(String)
case quote(String)
}
}
2020-07-13 03:25:20 +00:00
public extension Document {
2020-07-13 03:09:22 +00:00
enum HeadingLevel: Int {
case h1 = 1, h2 = 2, h3 = 3
}
}