emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/subed 1c8e0d1 064/389: Sanitize separator between start an


From: ELPA Syncer
Subject: [nongnu] elpa/subed 1c8e0d1 064/389: Sanitize separator between start and stop time
Date: Fri, 3 Dec 2021 10:59:58 -0500 (EST)

branch: elpa/subed
commit 1c8e0d11c0791184585ccfc4eb2d55dbcac6bb18
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>

    Sanitize separator between start and stop time
---
 subed/subed-srt.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index d4dfd12..be301f1 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -495,7 +495,14 @@ each subtitle."
        (goto-char (point-max))
        (subed-srt-move-to-subtitle-end)
        (when (looking-at "\n*")
-         (replace-match "\n"))))))
+         (replace-match "\n"))
+
+       ;; Ensure there is one space before and after " --> "
+       (goto-char (point-min))
+       (while (re-search-forward (format "^%s" subed-srt--regexp-timestamp) 
nil t)
+         (when (looking-at "[[:blank:]]*-->[[:blank:]]*")
+           (unless (= (length (match-string 0)) 5)
+             (replace-match " --> "))))))))
 
 (defun subed-srt-validate ()
   "Move point to the first invalid subtitle and report an error."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]