mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 12:54:07 +03:00
csv: interpolated field names in values are now case insensitive
Field names are supposed to be case insensitive, but a field assignment like fields ...,Transaction_Date,... date %Transaction_Date was failing, because of the capitalised letters. Fixed now.
This commit is contained in:
parent
7266064557
commit
fe73f2a6b5
@ -800,10 +800,10 @@ getEffectiveAssignment rules record f = lastMay $ assignmentsFor f
|
||||
renderTemplate :: CsvRules -> CsvRecord -> FieldTemplate -> String
|
||||
renderTemplate rules record t = regexReplaceBy "%[A-z0-9]+" replace t
|
||||
where
|
||||
replace ('%':pat) = maybe pat (\i -> atDef "" record (i-1)) mi
|
||||
replace ('%':pat) = maybe pat (\i -> atDef "" record (i-1)) mindex
|
||||
where
|
||||
mi | all isDigit pat = readMay pat
|
||||
| otherwise = lookup pat $ rcsvfieldindexes rules
|
||||
mindex | all isDigit pat = readMay pat
|
||||
| otherwise = lookup (map toLower pat) $ rcsvfieldindexes rules
|
||||
replace pat = pat
|
||||
|
||||
-- Parse the date string using the specified date-format, or if unspecified try these default formats:
|
||||
|
Loading…
Reference in New Issue
Block a user