toc trim white char

This commit is contained in:
Chris Li 2016-10-01 15:05:47 -04:00
parent 49f64ca16f
commit 166bb815c6
4 changed files with 3 additions and 5 deletions

View File

@ -49,7 +49,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.8.1550</string> <string>1.8.1553</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.8.1550</string> <string>1.8.1553</string>
<key>NSExtension</key> <key>NSExtension</key>
<dict> <dict>
<key>NSExtensionMainStoryboard</key> <key>NSExtensionMainStoryboard</key>

View File

@ -15,7 +15,7 @@ class HTMLHeading {
init?(rawValue: [String: String]) { init?(rawValue: [String: String]) {
let tagName = rawValue["tagName"] ?? "" let tagName = rawValue["tagName"] ?? ""
self.id = rawValue["id"] ?? "" self.id = rawValue["id"] ?? ""
self.textContent = rawValue["textContent"] ?? "" self.textContent = (rawValue["textContent"] ?? "").stringByTrimmingCharactersInSet(.whitespaceCharacterSet())
self.tagName = tagName self.tagName = tagName
self.level = Int(tagName.stringByReplacingOccurrencesOfString("H", withString: "")) ?? -1 self.level = Int(tagName.stringByReplacingOccurrencesOfString("H", withString: "")) ?? -1

View File

@ -51,8 +51,6 @@ class KiwixURLProtocol: NSURLProtocol {
} }
extension NSURL { extension NSURL {
class func kiwixURLWithZimFileid(id: String, contentURLString: String) -> NSURL? { class func kiwixURLWithZimFileid(id: String, contentURLString: String) -> NSURL? {
guard let escapedContentURLString = contentURLString.stringByAddingPercentEncodingWithAllowedCharacters(.URLPathAllowedCharacterSet()) else {return nil} guard let escapedContentURLString = contentURLString.stringByAddingPercentEncodingWithAllowedCharacters(.URLPathAllowedCharacterSet()) else {return nil}
let baseURLString = "kiwix://" + id let baseURLString = "kiwix://" + id