~alcinnz/rhapsode

bbf907aef2cee36b1098934bbe2810791a1f99a6 — Adrian Cochrane 5 years ago b0b897e
Fix crash upon pause/rest-before/after: none
2 files changed, 5 insertions(+), 4 deletions(-)

M css-reference.html
M src/StyleTree.hs
M css-reference.html => css-reference.html +3 -3
@@ 31,7 31,7 @@
    <dt>pause-before (initial <code>none</code>, non-inherited)</dt>
    <dd style="pause-before: 500ms">_ms, e.g. 500ms</dd>
    <dd style="pause-before: 1s">_s, e.g. 1s</dd>
    <!--<dd style="pause-before: none">none</dd>-->
    <dd style="pause-before: none">none</dd>
    <dd style="pause-before: x-weak">x-weak</dd>
    <dd style="pause-before: weak">weak</dd>
    <dd style="pause-before: medium">medium</dd>


@@ 55,7 55,7 @@
    <dt>rest-before (initial <code>none</code>, non-inherited)</dt>
    <dd style="rest-before: 500ms">_ms, e.g. 500ms</dd>
    <dd style="rest-before: 1s">_s, e.g. 1s</dd>
    <!--<dd style="rest-before: none">none</dd>-->
    <dd style="rest-before: none">none</dd>
    <dd style="rest-before: x-weak">x-weak</dd>
    <dd style="rest-before: weak">weak</dd>
    <dd style="rest-before: medium">medium</dd>


@@ 65,7 65,7 @@
    <dt>rest-after (initial <code>none</code>, non-inherited)</dt>
    <dd style="rest-after: 500ms">_ms, e.g. 500ms</dd>
    <dd style="rest-after: 1s">_s, e.g. 1s</dd>
    <!--<dd style="rest-after: none">none</dd>-->
    <dd style="rest-after: none">none</dd>
    <dd style="rest-after: x-weak">x-weak</dd>
    <dd style="rest-after: weak">weak</dd>
    <dd style="rest-after: medium">medium</dd>

M src/StyleTree.hs => src/StyleTree.hs +2 -1
@@ 52,8 52,9 @@ data Pause = Pause {
    strength :: Maybe Text,
    time :: Maybe Text
}
parsePause [Ident "none"] = Nothing
parsePause [Ident kw]
    | kw `elem` ["none", "x-weak", "weak", "medium", "strong", "x-strong"] = Just Pause {
    | kw `elem` ["x-weak", "weak", "medium", "strong", "x-strong"] = Just Pause {
        strength = Just kw, time = Nothing
    }
parsePause toks@[Dimension _ _ unit] | unit `elem` ["s", "ms"] = Just Pause {