36 lines
649 B
Swift
36 lines
649 B
Swift
|
//
|
||
|
// Document.swift
|
||
|
// GeminiFormat
|
||
|
//
|
||
|
// Created by Shadowfacts on 7/12/20.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
struct Document {
|
||
|
let url: URL
|
||
|
var lines: [Line]
|
||
|
|
||
|
init(url: URL, lines: [Line] = []) {
|
||
|
self.url = url
|
||
|
self.lines = lines
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Document {
|
||
|
enum Line: Equatable {
|
||
|
case text(String)
|
||
|
case link(URL, text: String?)
|
||
|
case preformattedText(String, alt: String?)
|
||
|
case heading(String, level: HeadingLevel)
|
||
|
case unorderedListItem(String)
|
||
|
case quote(String)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Document {
|
||
|
enum HeadingLevel: Int {
|
||
|
case h1 = 1, h2 = 2, h3 = 3
|
||
|
}
|
||
|
}
|