Skip to content

Commit

Permalink
Refactor Utils.readJSContents (#37)
Browse files Browse the repository at this point in the history
* Refactor Utils.readJSContents

* Fix Regex
  • Loading branch information
KS1019 authored Mar 6, 2022
1 parent 8b152da commit be6564b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Sources/Commands/Sync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ extension Sync {
jsContent = try Utils.readJSContents(from: .hondanaDir)
try Utils.write(bookmarklets: jsContent, to: .plist)
case .plist:
jsContent = try Utils.readJSContents(from: .plist)
jsContent = (try Utils.readJSContents(from: .plist))
.map { Bookmarklet(uuid: $0.uuid, title: $0.title, url: $0.url.unminified) }
try Utils.write(bookmarklets: jsContent, to: .hondanaDir)
case .safariHTML:
jsContent = try Utils.readJSContents(from: .safariHTML)
jsContent = (try Utils.readJSContents(from: .safariHTML))
.map { Bookmarklet(uuid: $0.uuid, title: $0.title, url: $0.url.unminified) }
try Utils.write(bookmarklets: jsContent, to: .hondanaDir)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Commands/Utils/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ enum Utils {
in: html
)

let regex = "<DT><A HREF=\"javascript:(.+)>(.+)</A>"
let regex = "<DT><A HREF=\"javascript:(.+)\">(.+)</A>"
let captureRegex = try NSRegularExpression(
pattern: regex,
options: []
Expand Down

0 comments on commit be6564b

Please sign in to comment.