File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ class ScheduleParser {
276276 case 1 : currentEvent. time = stringToDate ( cellText) ?? Date ( )
277277 case 2 : currentEvent. title = cellText
278278 case 3 : currentEvent. location = cellText
279- case 4 : currentEvent. description = cellText
279+ case 4 : currentEvent. description = filterDescription ( cellText)
280280 case 5 : currentEvent. uuid = cellText
281281 default : break
282282 }
@@ -286,6 +286,21 @@ class ScheduleParser {
286286
287287 }
288288
289+ // Strips the description of any HTML
290+ private static func filterDescription( _ text: String ) -> String {
291+
292+ var result = String ( text)
293+
294+ while result. contains ( " < " ) && result. contains ( " > " ) {
295+ let htmlStart = result. firstIndex ( of: " < " ) !
296+ let htmlEnd = result. firstIndex ( of: " > " ) !
297+
298+ result. removeSubrange ( htmlStart... htmlEnd)
299+ }
300+
301+ print ( " Converted \( text) to \( result) " )
302+ return result
303+ }
289304
290305 private static func stringToDate( _ text: String ) -> Date ? {
291306
You can’t perform that action at this time.
0 commit comments