Simplify some code.
This commit is contained in:
parent
af996d3c12
commit
0be7211082
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user