@@ -715,7 +715,7 @@ hledgerField rules record f = fmap
715
715
(getEffectiveAssignment rules record f)
716
716
717
717
-- | Look up the final value assigned to a hledger field, with csv field
718
- -- references interpolated.
718
+ -- references and regular expression match group references interpolated.
719
719
hledgerFieldValue rules record f = (flip fmap ) (getEffectiveAssignment rules record f)
720
720
$ either (renderTemplate rules record)
721
721
$ \ cb -> let
@@ -730,9 +730,10 @@ maybeNegate :: MatcherPrefix -> Bool -> Bool
730
730
maybeNegate Not origbool = not origbool
731
731
maybeNegate _ origbool = origbool
732
732
733
- -- | Given the conversion rules, a CSV record and a hledger field name, find
734
- -- the value template ultimately assigned to this field, if any, by a field
735
- -- assignment at top level or in a conditional block matching this record.
733
+ -- | Given the conversion rules, a CSV record and a hledger field name, collect
734
+ -- the value templates (and their parent Conditional Blocks where applicable)
735
+ -- assigned to this field, if any, by top-level field assignments and
736
+ -- conditional blocks matching this record.
736
737
--
737
738
-- Note conditional blocks' patterns are matched against an approximation of the
738
739
-- CSV record: all the field values, without enclosing quotes, comma-separated.
@@ -748,7 +749,7 @@ getEffectiveAssignment rules record f = lastMay assignments
748
749
assignments = dbg9 " csv assignments" $ toplevelassignments ++ conditionalassignments
749
750
-- all top level field assignments
750
751
toplevelassignments = map (Left . snd ) $ filter ((== f). fst ) $ rassignments rules
751
- -- all field assignments in conditional blocks assigning to field f and active for the current csv record
752
+ -- all conditional blocks assigning to field f and active for the current csv record
752
753
conditionalassignments = map Right
753
754
$ filter (any (== f) . map fst . cbAssignments)
754
755
$ filter (isBlockActive rules record)
0 commit comments