~alcinnz/rhapsode

3898dfa381ef511aa7766e5c6358f5f39980947c — Adrian Cochrane 4 years ago ee018b4
Implement new -rhaps-marker property for controlling user interaction.
2 files changed, 6 insertions(+), 0 deletions(-)

M src/SSML.hs
M src/SpeechStyle.hs
M src/SSML.hs => src/SSML.hs +1 -0
@@ 53,6 53,7 @@ buildBox self childs = concat [
        breakEl $ pauseBefore self,
        audioEl $ cueBefore self,
        breakEl $ restBefore self,
        el "mark" [("name", marker self)] [],
        childs,
        breakEl $ restAfter self,
        audioEl $ cueAfter self,

M src/SpeechStyle.hs => src/SpeechStyle.hs +5 -0
@@ 31,6 31,7 @@ data SpeechStyle = SpeechStyle {

    cueBefore :: Cue,
    cueAfter :: Cue,
    marker :: Maybe Text,

    content :: Text,
    pseudoEl :: Maybe Text


@@ 61,6 62,7 @@ instance PropertyParser SpeechStyle where
        restAfter = Pause Nothing Nothing,
        cueBefore = NoCue,
        cueAfter = NoCue,
        marker = Nothing,

        content = "",
        pseudoEl = Nothing


@@ 105,6 107,7 @@ instance PropertyParser SpeechStyle where

    longhand _ self "cue-before" toks = (\v -> self { cueBefore = v }) <$> parseCue toks
    longhand _ self "cue-after" toks = (\v -> self { cueAfter = v }) <$> parseCue toks
    longhand _ self "-rhaps-marker" toks = (\v -> self { marker = Just v }) <$> parseStrings toks

    longhand _ self "content" [Ident "initial"] = Just self {content = ""}
    longhand _ self "content" toks = (\v -> self {content = v}) <$> parseStrings toks


@@ 120,6 123,8 @@ instance PropertyParser SpeechStyle where
    shorthand _ "cue" (a:b) | isCue [a], isCue b = [("cue-before", [a]), ("cue-after", b)]
    shorthand _ "cue" toks | isCue toks = [("cue-before", toks), ("cue-after", toks)]

    shorthand _ "-rhaps-marker" [Ident m] = [("mark", [String m, Function "counter", Ident m, RightParen])]

    shorthand self key value | isJust $ longhand self self key value = [(key, value)]
        | otherwise = []