From d94a3ecb9788980310707c7bc6a4a66ab68d6d6c Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Thu, 30 Apr 2020 08:01:28 +1200 Subject: [PATCH] Propagate local attrs through to output. --- src/SSML.hs | 1 + src/SpeechStyle.hs | 3 +++ useragent.css | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SSML.hs b/src/SSML.hs index 778341b..3422487 100644 --- a/src/SSML.hs +++ b/src/SSML.hs @@ -22,6 +22,7 @@ styleToNodes = Prelude.map style . postorder styleToSSML' styleToSSML' SpeechStyle { speak = False } _ = [] styleToSSML' self@SpeechStyle {content = ""} children = el "prosody" [ + ("xml:lang", lang self), ("rhapsode:pseudo", pseudoEl self), ("volume", volume self), ("rate", rate self), diff --git a/src/SpeechStyle.hs b/src/SpeechStyle.hs index 15598f1..ba45361 100644 --- a/src/SpeechStyle.hs +++ b/src/SpeechStyle.hs @@ -36,6 +36,7 @@ data SpeechStyle = SpeechStyle { marker :: Maybe Text, content :: Text, + lang :: Maybe Text, pseudoEl :: Maybe Text } @@ -67,6 +68,7 @@ instance PropertyParser SpeechStyle where marker = Nothing, content = "", + lang = Nothing, pseudoEl = Nothing } inherit _ = temp -- Text synthesizers handle inheritance. @@ -114,6 +116,7 @@ instance PropertyParser SpeechStyle where longhand _ self "content" [Ident "initial"] = Just self {content = ""} longhand _ self "content" toks = (\v -> self {content = v}) <$> parseStrings toks longhand _ self "::" [Ident pseudo] = Just self {pseudoEl = Just pseudo} -- To make sure content doesn't override :before & :after + longhand _ self "-rhaps-lang" [String v] = Just self {lang = Just v} longhand _ _ _ _ = Nothing shorthand _ "pause" [a, b] | isPause [a], isPause [b] = [("pause-before", [a]), ("pause-after", [b])] diff --git a/useragent.css b/useragent.css index f6dc9c6..6a83593 100644 --- a/useragent.css +++ b/useragent.css @@ -1,7 +1,7 @@ head, link, meta, style, script, title, base {speak: never} datalist, template {speak: never} html {speak-as: normal no-punctuation} -* {white-space: normal;} +[lang] {-rhaps-lang: attr(lang)} /* Pass this info through styletree into output */ /** Forms **/ button, select, textarea, input, output {speak: never} /* Leave to special form entry mode */ -- 2.30.2