Add test suite.
[srt2vtt.git] / srt2vtt / subrip.scm
index 44f118e8752223e614ad35d437f6203aaea729fc..0031db363eafd1a2b5b70774a0f73a4fc757a7f9 100644 (file)
@@ -32,7 +32,8 @@
 element list.  Valid input looks like '00:00:03.417'."
       (let ((match (regexp-exec regexp s)))
         (if match
-            (map (cut match:substring match <>) '(1 2 3 4))
+            (map (compose string->number (cut match:substring match <>))
+                 '(1 2 3 4))
             (error "Invalid SubRip timestamp: " s))))))
 
 (define parse-time-span
@@ -57,7 +58,7 @@ two values: the start time and the end time.  Valid input looks like
                                     (and (string-null? line)
                                          ;; A subtitle may be a blank line!
                                          (not (null? lines))))
-                                lines
+                                (reverse lines)
                                 (loop (cons line lines)))))))
     (make-subtitle id start end lines)))