From f58afc008d833a9bd70d3c4e62d8042ba0c4f851 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Wed, 3 May 2023 15:26:04 +1200 Subject: [PATCH] Correct inherieance to include unmodified counters. --- src/Data/CSS/Preprocessor/Text.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Data/CSS/Preprocessor/Text.hs b/src/Data/CSS/Preprocessor/Text.hs index 9eaf6a8..7b3eea1 100644 --- a/src/Data/CSS/Preprocessor/Text.hs +++ b/src/Data/CSS/Preprocessor/Text.hs @@ -304,8 +304,9 @@ t = flip StyleTree [] type Context = M.HashMap Text [([Integer], Int)] inheritCounters :: Context -> Context -> Context -inheritCounters counterSource valueSource = M.intersectionWith cb valueSource counterSource -- indexed by name & el-path - where cb val source = [counter | counter@(path, _) <- val, path `elem` [p | (p, _) <- source]] +inheritCounters counterSource valueSource = M.unionWith cb valueSource counterSource -- indexed by name & el-path + where cb val source = [counter | counter@(path, _) <- val, + path `elem` [p | (p, _) <- source]] instantiateCounter :: Context -> Path -> Text -> Int -> Context instantiateCounter counters path name val = M.insertWith appendCounter name [(path, val)] counters -- 2.30.2