mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-08 11:49:44 +03:00
journal: allow commodity directive to set style of no-symbol commodity (#1461)
(cherry picked from commit c5571f6468ab11ffe3cd3f86a86f0b3253be10d1)
This commit is contained in:
parent
4332893d1f
commit
034c317496
@ -813,9 +813,12 @@ amountwithoutpricep = do
|
||||
return $ nullamt{acommodity=c, aquantity=sign q, aismultiplier=mult, astyle=s, aprice=Nothing}
|
||||
-- no symbol amount
|
||||
Nothing -> do
|
||||
mdecmarkStyle <- getDecimalMarkStyle
|
||||
mcommodityStyle <- getDefaultAmountStyle
|
||||
let msuggestedStyle = mdecmarkStyle <|> mcommodityStyle
|
||||
-- look for a number style to use when parsing, based on
|
||||
-- these things we've already parsed, in this order of preference:
|
||||
mdecmarkStyle <- getDecimalMarkStyle -- a decimal-mark CSV rule
|
||||
mcommodityStyle <- getAmountStyle "" -- a commodity directive for the no-symbol commodity
|
||||
mdefaultStyle <- getDefaultAmountStyle -- a D default commodity directive
|
||||
let msuggestedStyle = mdecmarkStyle <|> mcommodityStyle <|> mdefaultStyle
|
||||
(q,prec,mdec,mgrps) <- lift $ interpretNumber numRegion msuggestedStyle ambiguousRawNum mExponent
|
||||
-- if a default commodity has been set, apply it and its style to this amount
|
||||
-- (unless it's a multiplier in an automated posting)
|
||||
|
Loading…
Reference in New Issue
Block a user