Skip to content

Commit 154a0b8

Browse files
committed
format
1 parent 47064fd commit 154a0b8

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

Sources/Streamer/Parser/EPUB/EPUBMetadataParser.swift

+11-12
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ final class EPUBMetadataParser: Loggable {
3636

3737
let contributorsWithRoles = findContributorElements()
3838
.compactMap { createContributor(from: $0) }
39-
39+
4040
let contributorsByRole = Dictionary(grouping: contributorsWithRoles, by: \.role)
4141
.mapValues { $0.map(\.contributor) }
42-
42+
4343
func contributorsForRole(role: String?) -> [Contributor] {
44-
return contributorsByRole[role] ?? []
44+
contributorsByRole[role] ?? []
4545
}
4646

4747
return Metadata(
@@ -422,22 +422,22 @@ final class EPUBMetadataParser: Loggable {
422422
guard let name = localizedString(for: element) else {
423423
return nil
424424
}
425-
425+
426426
let knownRoles: Set = ["aut", "trl", "edt", "pbl", "art", "ill", "clr", "nrt"]
427-
427+
428428
// Look up for possible meta refines for contributor's role.
429429
let role: String? = element.attr("id")
430430
.map { id in metas["role", refining: id].map(\.content) }?.first
431431
?? element.attr("role") // falls back to EPUB 2 role attribute
432-
432+
433433
let roles = role.map { role in knownRoles.contains(role) ? [] : [role] } ?? []
434434

435435
let contributor = Contributor(
436436
name: name,
437437
sortAs: element.attr("file-as"),
438438
roles: roles
439439
)
440-
440+
441441
let type: String? = if element.tag == "creator" || element.attr("property") == "dcterms:creator" {
442442
"aut"
443443
} else if element.tag == "publisher" || element.attr("property") == "dcterms:publisher" {
@@ -449,9 +449,8 @@ final class EPUBMetadataParser: Loggable {
449449
} else {
450450
knownRoles.contains(role!) ? role : nil
451451
}
452-
452+
453453
return (role: type, contributor: contributor)
454-
455454
}
456455

457456
private lazy var readingProgression: ReadingProgression = {
@@ -490,14 +489,14 @@ final class EPUBMetadataParser: Loggable {
490489
return metas["collection-type", refining: id].first?.content == "series"
491490
}
492491
.compactMap(collection(from:))
493-
492+
494493
if !epub3Series.isEmpty {
495494
return epub3Series
496495
}
497-
496+
498497
let epub2Position = metas["series_index", in: .calibre].first
499498
.flatMap { Double($0.content) }
500-
499+
501500
return metas["series", in: .calibre]
502501
.map { meta in
503502
Metadata.Collection(

0 commit comments

Comments
 (0)