Skip to content

Commit

Permalink
Merge pull request #5 from ddanilyuk/fix/removeCodeSnippet
Browse files Browse the repository at this point in the history
Fix: Remove code snippet
  • Loading branch information
ddanilyuk authored Jun 14, 2022
2 parents e275b6e + b914769 commit 090bfcf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 62 deletions.
2 changes: 1 addition & 1 deletion Sources/App/Controllers/LessonsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class LessonsController {
)
let html = try (response.body).htmlString(encoding: .utf8)
let lessons = try LessonsParser().parse(html)
return LessonsResponse(id: uuid, lessons: lessons)
return LessonsResponse(id: groupUUID, lessons: lessons)
}

}
10 changes: 1 addition & 9 deletions Sources/KPIHubParser/GroupParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import Foundation
import Parsing

public struct GroupParser: Parser, Equatable {

typealias Input = String

typealias Output = [Group]
public struct GroupParser: Parser {

public let groupName: String

Expand Down Expand Up @@ -51,9 +47,5 @@ public struct GroupParser: Parser, Equatable {
}
return try parser.parse(input)
}

static func == (lhs: GroupParser, rhs: GroupParser) -> Bool {
return lhs.groupName == rhs.groupName
}

}
52 changes: 0 additions & 52 deletions Sources/KPIHubParser/LessonsParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,55 +215,3 @@ public struct LessonsParser: Parser {
}

}


public func parse(_ input: inout String) throws -> [Lesson] {

let upToNextTag = PrefixUpTo("<".utf8)
let quotedField = Parse { ... }

// MARK: - Lesson name

let nameParser = Parse { ... }
let multipleNamesParser = Parse { ... }

// MARK: - Teacher

let teacherFullNameParser = Parse { ... }
let teacherShortNameParser = Parse { ... }
let teacherParser = Parse(Teacher.init) { ... }
let multipleTeachersParser = Parse { ... }

// MARK: - Location

let locationWithLinkParser = Parse { ... }
let locationPlainTextParser = Parse { ... }
let multipleLocationParser = Parse { ... }

// MARK: - Lesson

let lessonCellParser = Parse { ... }

// MARK: - Row

/// Cell with pair number and time
let skipFirstCell = Parse { ... }

let rowParser = Parse { ... }

// MARK: - Table

let skipTableHeader = Parse { ... }

let firstTable = Parse { ... }
.replaceError( ... )

let secondTable = Parse { ... }
.replaceError( ... )

let allTables = Parse { ... } with: { ... }

let fullParser = allTables.map { ... }

return try fullParser.parse(input)
}

0 comments on commit 090bfcf

Please sign in to comment.