From 1424a1f2f16b28df85afe4f2bc52fe75e0d7b096 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 1 Mar 2024 17:58:28 +0000 Subject: [PATCH] ;cln:import: update some Haddock strings to reflect #2158 Signed-off-by: Jonathan Dowland --- hledger-lib/Hledger/Read/RulesReader.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hledger-lib/Hledger/Read/RulesReader.hs b/hledger-lib/Hledger/Read/RulesReader.hs index dd6bdecc6a1..1995a297898 100644 --- a/hledger-lib/Hledger/Read/RulesReader.hs +++ b/hledger-lib/Hledger/Read/RulesReader.hs @@ -715,7 +715,7 @@ hledgerField rules record f = fmap (getEffectiveAssignment rules record f) -- | Look up the final value assigned to a hledger field, with csv field --- references interpolated. +-- references and regular expression match group references interpolated. hledgerFieldValue rules record f = (flip fmap) (getEffectiveAssignment rules record f) $ either (renderTemplate rules record) $ \cb -> let @@ -730,9 +730,10 @@ maybeNegate :: MatcherPrefix -> Bool -> Bool maybeNegate Not origbool = not origbool maybeNegate _ origbool = origbool --- | Given the conversion rules, a CSV record and a hledger field name, find --- the value template ultimately assigned to this field, if any, by a field --- assignment at top level or in a conditional block matching this record. +-- | Given the conversion rules, a CSV record and a hledger field name, collect +-- the value templates (and their parent Conditional Blocks where applicable) +-- assigned to this field, if any, by top-level field assignments and +-- conditional blocks matching this record. -- -- Note conditional blocks' patterns are matched against an approximation of the -- CSV record: all the field values, without enclosing quotes, comma-separated. @@ -748,7 +749,7 @@ getEffectiveAssignment rules record f = lastMay assignments assignments = dbg9 "csv assignments" $ toplevelassignments ++ conditionalassignments -- all top level field assignments toplevelassignments = map (Left . snd) $ filter ((==f).fst) $ rassignments rules - -- all field assignments in conditional blocks assigning to field f and active for the current csv record + -- all conditional blocks assigning to field f and active for the current csv record conditionalassignments = map Right $ filter (any (==f) . map fst . cbAssignments) $ filter (isBlockActive rules record)