New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use default commodity and commodity directives when inferring decimal point/digit group separator #635
use default commodity and commodity directives when inferring decimal point/digit group separator #635
Conversation
61265d2
to
0a73008
Compare
fe9df19
to
4297b95
Compare
4297b95
to
75decad
Compare
7d83698
to
e42fbd3
Compare
I trust your judgement that this works better. We should have haddocks for the two get*Style functions, and an update to the manual explaining how things work now. |
hledger-lib/Hledger/Read/Common.hs
Outdated
@@ -145,6 +146,12 @@ setDefaultCommodityAndStyle cs = modify' (\j -> j{jparsedefaultcommodity=Just cs | |||
getDefaultCommodityAndStyle :: JournalParser m (Maybe (CommoditySymbol,AmountStyle)) | |||
getDefaultCommodityAndStyle = jparsedefaultcommodity `fmap` get | |||
|
|||
getDefaultDecimalHint :: JournalParser m (Maybe Char) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add short haddocks explaining what these do.
@simonmichael , as you probably noticed expecting that If you think we should have a separate directive for that (probably still currency-specific) it should be easy to add that. |
- Hunt down adjacent punctuations with altering char. - Add some tests dedicated to parsing amounts.
Make use of commodity format directive as a hint for parsing amount. Kinda resolves simonmichael#487
If appropriate commodity directive is missing fallback to default commodity directive to get number representation style.
Use whole AmountStyle in process of resolving decimal/groups separator ambiguity. Resolve simonmichael#399
e42fbd3
to
6f25bd1
Compare
The doc looks reasonable to me. Merging, thank you! |
Trust latest
commodity
orD
(default commodity) directives in case of ambiguity in parsing number.This kinda resolves #399 and its duplicate #487. We still may get issues caused by misinterpreting numbers
1,000
and1.0
both as1
if nocommodity
directive or default commodityD
directive were provided in same journal file earlier.