Simon Michael
97f2235bca
;lib: refactor amount cost functions
...
Rename costOfAmount -> amountCost, costOfMixedAmount -> mixedAmountCost,
drop amountToCost, mixedAmountToCost.
2020-05-31 15:48:08 -07:00
Simon Michael
660ba7e1d9
lib: clarify zero-checking function names
...
isZeroAmount -> amountLooksZero
isReallyZeroAmount -> amountIsZero
isZeroMixedAmount -> mixedAmountLooksZero
isReallyZeroMixedAmount -> mixedAmountIsZero
isReallyZeroMixedAmountCost dropped
2020-05-29 18:57:22 -07:00
Simon Michael
40c296a446
lib: rename finaliseJournal -> journalFinalise
2020-05-23 09:45:35 -07:00
Simon Michael
2c1cbb7956
;csv: remove a comment breaking doctests
2020-05-12 18:01:05 -07:00
Simon Michael
6b2dfad98c
;csv: clarify that whitespace is not stripped when matching
2020-05-09 15:43:44 -07:00
Vladimir Sorokin
5b88bfb834
csv: Increase maximum number of postings in CSV reader from 9 to 99.
...
The ordering of journalfieldnames is changed in order to comply with the requirement stated in the comment:
"Names must precede any other name they contain, for the parser".
If left unchanged, "account1" would precede "account11", "account12", and so on, which would break the parsing.
With the new ordering, "account11" precedes "account1".
2020-04-26 14:52:02 -07:00
Simon Michael
784d882e01
csv: combine amount assignments better, fix 1.17.1 regression ( #1226 )
2020-04-16 19:04:36 -07:00
Simon Michael
b149c0ba0c
;csv: tweak the too-many-amounts error more
2020-04-16 12:59:19 -07:00
Simon Michael
3693fd4eb6
;csv: mention doc url in too many amounts error ( #1226 )
2020-04-16 08:36:04 -07:00
Simon Michael
3cc79a67f2
csv: don't discard explicit assignments of a 0 amount
...
Eg: an `amount1 $0.00` assignment was generating a posting1 with
missing amount.
2020-04-05 14:19:02 -07:00
Simon Michael
9868d7f20d
;lib: update emacs code-folding config
...
orgstruct-mode was dropped from org 9.2, and I shouldn't have been
forcing it on anyway.
The new config allows its "replacement", outshine-mode, to do similar
code folding when you press tab on any of the lines matching
outline-regexp. But only if you patch it as mentioned at
https://github.com/alphapapa/outshine/issues/77 .
Enable it by, eg: (add-hook 'haskell-mode-hook 'outshine-mode)
2020-03-28 17:09:47 -07:00
Simon Michael
e15eabdf15
csv: ignore amount if any amountN's are assigned; improve error msg
...
The change for hledger 1.17.1 broke one of my csv rules, where I used
`amount` but then tried to override it with `amountN`s in a
conditional block; the two clashed. Now in that situation any
`amountN`s take precedence, causing `amount` to be ignored entirely.
Also clarified the "too many non-zero amounts" error message a bit.
2020-03-25 18:09:41 -07:00
Simon Michael
4e7a893efc
;csv: cleanup
2020-03-17 17:55:32 -07:00
Simon Michael
a1361ecc04
csv: don't force a second posting with amount1
...
A rewrite and simplification of the posting-generating code. The
"special handling for pre 1.17 rules" should now be less noticeable.
amount1/amount2 no longer force a second posting or explicit amounts
on both postings. (Only amount/amount-in/amount-out do that.)
Error messages and handling of corner cases may be more robust, also.
2020-03-16 16:18:58 -07:00
Stephen Morgan
e0dde6fe57
lib: Remove non-law-abiding Monoid instance for Journal.
2020-03-02 12:45:30 -08:00
Stephen Morgan
702c958487
lib: Replace some utility functions with library functions.
2020-03-02 12:45:30 -08:00
Simon Michael
374be00223
;lib: fix org headings and doctest setup that were breaking haddock
...
(and in some cases, installation).
[ci skip]
2020-03-01 22:00:39 -08:00
Simon Michael
b9954bff60
journal, lib: the include directive no longer guesses the format
...
The include directive now tries just one reader, based on the file
extension and defaulting to journal, like the rest of hledger.
(It doesn't yet handle a reader prefix.)
Reader-finding utilities have moved from Hledger.Read to
Hledger.Read.JournalReader so the include directive can use them.
Reader changes:
- rExperimental flag removed
- old rParser renamed to rReadFn
- new rParser field provides the actual parser.
This seems to require making Reader a higher-kinded type, unfortunately.
2020-03-01 14:06:29 -08:00
Simon Michael
2c8a6e988f
lib: Hledger.Read.CsvReader cleanup
...
Exports added: CsvRecord, CsvValue, csvFileFor
Exports removed: expandIncludes, parseAndValidateCsvRules, transactionFromCsvRecord
2020-02-27 23:37:32 -08:00
Simon Michael
bc4ea83d86
;csv: refactor transactionFromCsvRecord
2020-02-27 12:58:30 -08:00
Simon Michael
2dd6e2d797
;csv: refactor transactionFromCsvRecord
2020-02-27 12:09:39 -08:00
Simon Michael
b18f71a81b
;csv: extract mkPosting! and refactor
2020-02-27 11:51:11 -08:00
Simon Michael
f2767477ab
;csv: refactor transactionFromCsvRecord, extract those helpers
2020-02-27 11:19:37 -08:00
Simon Michael
6f08eed719
;csv: refactor transactionFromCsvRecord, note forgotten rule
...
Clarify some helpers. Also note the forgotten default-accountN rule.
2020-02-27 11:03:58 -08:00
Simon Michael
5a2f28f3ac
;csv: refactor transactionFromCsvRecord
...
[ci skip]
2020-02-27 01:23:28 -08:00
Simon Michael
a87baf4b29
;csv: refactor: rename JournalFieldName -> HledgerFieldName
2020-02-27 01:00:35 -08:00
Simon Michael
be5fc09ebb
;csv: refactor: more transactionFromCsvRecord cleanups
2020-02-27 00:41:10 -08:00
Simon Michael
93358d72b4
;csv: refactor transactionFromCsvRecord
2020-02-27 00:30:45 -08:00
Simon Michael
02f2e3bd9b
csv: refine unknown accounts more thoroughly, a better fix for #1192
2020-02-26 22:45:49 -08:00
Simon Michael
58bb0df5ab
csv: undo failed #1192 fix, causing "_unknown_" accounts; refactor
...
Restore the old logic, while also trying to clarify this
transaction-generating code, and add some tests.
See also #1198 .
2020-02-26 21:46:11 -08:00
Simon Michael
fb788a64e8
;csv: cleanups, drop match operator for now
2020-02-26 11:52:47 -08:00
Simon Michael
d537f1fe07
csv: allow single field matching; more docs and tests
2020-02-26 08:55:55 -08:00
Simon Michael
becd891dd1
;csv: Matcher type, simplify
2020-02-25 13:44:45 -08:00
Simon Michael
1cbce98a68
;csv: refactor, ConditionalBlock ADT
2020-02-25 13:44:45 -08:00
Simon Michael
2d90074b2e
;csv: avoid a potential display of internal placeholder ( #1192 )
...
With a multicommodity amount, the unknown account name will always be
"expenses:unknown".
2020-02-15 14:02:53 -08:00
Simon Michael
017d3355f8
csv: allow manual assignment of "expenses:unknown" again ( fix #1192 )
2020-02-15 13:52:59 -08:00
Simon Michael
80ab45984b
csv: also recognise .tsv, .ssv extensions; document thoroughly ( #1179 )
2020-01-20 12:58:47 -08:00
Aleksandar Dimitrov
3ead97975c
Inline function, add debug statement
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
9011aaa5ba
Refactor getSeparator
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
92f680875f
Parse reserved words case insensitively
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
8df4e1ed83
Remove --separator command line argument
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
02d9205af7
Allow separator to be overridden from command line
...
This also fixes that parsing separators on the command line and the
rules file was not handled the same way.
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
b524a088c7
Implement getting separator from rules
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
32ccc3a2b2
Add directive
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
ec0f55d18e
Add missing type signature
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
b104b3b8a3
Explictly discard result
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
42d585d20b
Refactor: rename variable
2020-01-05 14:45:57 -08:00
Aleksandar Dimitrov
63cda87e86
Whitespace
2020-01-05 14:45:57 -08:00
Brian Wignall
2852f9dbee
Fix typos
2019-12-21 12:09:05 -08:00
Simon Michael
13e6c7dfdf
lib: drop "assertion" alias for nullassertion
...
Perhaps we'll stick with the null* convention. Fixes a warning in Transaction.hs.
2019-12-09 06:08:03 -08:00