Simplify some code.
This commit is contained in:
parent
af996d3c12
commit
0be7211082
@ -191,8 +191,7 @@ private extension ArticleRenderer {
|
|||||||
|
|
||||||
static let defaultTemplate: String = {
|
static let defaultTemplate: String = {
|
||||||
let path = Bundle.main.path(forResource: "template", ofType: "html")!
|
let path = Bundle.main.path(forResource: "template", ofType: "html")!
|
||||||
let s = try! String(contentsOfFile: path, encoding: .utf8)
|
return try! String(contentsOfFile: path, encoding: .utf8)
|
||||||
return s as String
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
func styleString() -> String {
|
func styleString() -> String {
|
||||||
|
@ -87,10 +87,7 @@ struct ArticleTheme: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var encoding = String.Encoding.utf8
|
var encoding = String.Encoding.utf8
|
||||||
if let s = try? String(contentsOfFile: f, usedEncoding: &encoding) {
|
return try? String(contentsOfFile: f, usedEncoding: &encoding)
|
||||||
return s
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func filenameWithThemeSuffixRemoved(_ filename: String) -> String {
|
static func filenameWithThemeSuffixRemoved(_ filename: String) -> String {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user