implemented convert function

This commit is contained in:
2020-11-09 13:50:19 -05:00
parent 0a041c4f1f
commit 3674dc72c8
4 changed files with 81 additions and 3 deletions

View File

@@ -29,6 +29,8 @@ module SubFix (
encode,
) where
import Data.Char (chr)
-- | Defines a caption group
data Caption = Caption
{ capID :: Int
@@ -43,7 +45,7 @@ data Caption = Caption
-- | Applies the transformations to a caption group
convert :: Caption -> Caption
convert = undefined
convert c = c { capText = editText $ capText c }
-- | Decodes the text of a subtitle file
decode
@@ -58,4 +60,16 @@ decode = undefined
encode :: [Caption] -> String
encode = undefined
editText :: String -> String
editText = checkCaret . checkNotes
checkCaret :: String -> String
checkCaret ('^' : str) = "{\\an8}" ++ str
checkCaret str = str
checkNotes :: String -> String
checkNotes "" = ""
checkNotes ('#' : '#' : str) = chr 0x2669 : checkNotes str
checkNotes (ch : str) = ch : checkNotes str
--jl