Simplify some code.

This commit is contained in:
Brent Simmons 2025-02-02 10:25:04 -08:00
parent af996d3c12
commit 0be7211082
2 changed files with 2 additions and 6 deletions

View File

@ -191,8 +191,7 @@ private extension ArticleRenderer {
static let defaultTemplate: String = {
let path = Bundle.main.path(forResource: "template", ofType: "html")!
let s = try! String(contentsOfFile: path, encoding: .utf8)
return s as String
return try! String(contentsOfFile: path, encoding: .utf8)
}()
func styleString() -> String {

View File

@ -87,10 +87,7 @@ struct ArticleTheme: Equatable {
}
var encoding = String.Encoding.utf8
if let s = try? String(contentsOfFile: f, usedEncoding: &encoding) {
return s
}
return nil
return try? String(contentsOfFile: f, usedEncoding: &encoding)
}
static func filenameWithThemeSuffixRemoved(_ filename: String) -> String {