Commit Graph

11993 Commits

Author SHA1 Message Date
Simon Michael
50dc7bebb1 imp: set display style, natural precision on valued amounts (fix #2105, precisiongeddon)
Cost/value conversion now applies the standard display style, and
sets the display precision equal to the internal decimal precision
(or 8 if the decimal appears to be infinite).
This means value reports and especially `print -V` now show amounts
with more accurate and standard style and precision.

New tests have been added describing and explaining various
style/precision behaviours in print cost/value reports.
2023-11-08 13:59:18 -08:00
Simon Michael
64ffdd7c9c dev: clarify some amount operations 2023-11-08 13:59:18 -08:00
Simon Michael
d435557979 lib: Hledger.Utils.Debug: lbl_ helper, cleanups, notes 2023-11-08 13:50:33 -08:00
Simon Michael
b1dc550c35 ;tools:bake dbgstrs 2023-11-08 13:50:33 -08:00
Simon Michael
6e54de12b2 ;tools:ghci :rmain 2023-11-08 13:50:33 -08:00
Simon Michael
a4d3573d29 ;dev: valuation.test: cleanup 2023-11-08 13:50:33 -08:00
Jonathan Dowland
d424966706 ;doc: import: document Match Groups
Add a description of Match Groups to the manual; Section "Matchers".
Include two examples.

Clarify a description of regular expression features with respect
to match groups.

Expand the description of field assignments to cover match group
interpolation, cross-referencing to Section "Matchers" for the full
description.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2023-11-08 13:49:39 -08:00
Jonathan Dowland
aaf50c165c test: import: functional tests for match group interpolation
Add functional tests for matching substrings in field matchers and
interpolating them into the corresponding field assignments. Check
the following properties and use-cases:

 * Use-case 1: matching a portion of a date in a known format
   (YYY-MM-DD) and writing a comment-command to warp a posting date.
   Useful for credit cards.
 * Use-case 2: match a portion of a CSV field and use it as an
   account assignment. Useful for my byzantine setup with two
   separate ledgers cross-importing to each other.
 * Ensure bracketed portions of field matchers are captured.
 * Ensure bracketed portions of record matchers are captured.
 * Check match token numerical offset is relative to match group,
   not the whole rules file.
 * Check nested matches work.
 * Ensure match group token expansion works with or without
   surrounding text.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2023-11-08 13:49:39 -08:00
Jonathan Dowland
8bfa382c68 feat: import: interpolate regex matches in field templates (#2009)
Replace occurrences of '\N' (where N is a positive number) in field
templates with the corresponding regular expression match group, if it
exists.

E.g. Warp the date to the first of the month for the second posting

    if %date (....-..)-..
        comment2 date:\1-01

E.g. Strip a prefix from an imported account name

    if %account1 liabilities:jon:(.*)
        account1 \1

Fixes #2009.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2023-11-08 13:49:39 -08:00
Jonathan Dowland
549c47bca8 ;dev: add Utils.Regex.regexMatchTextGroups
A matcher function which returns the list of match-groups, which may
be empty.

Signed-off-by: Jonathan Dowland <jon@dow.land>
2023-11-08 13:49:39 -08:00
Jonathan Dowland
c619e387ea ;fix: import: minor typo 2023-11-08 13:49:39 -08:00
Simon Michael
23c961f4bb ;doc: Setting LEDGER_FILE: fix a quote (hledger_site#93) 2023-11-07 16:19:21 -08:00
Simon Michael
250d98df29 cabal: update cabal files 2023-11-07 09:25:29 -08:00
Simon Michael
fef3413c51 pkg:web: clean up some apparently redundant declarations and deps 2023-11-07 09:06:58 -08:00
Simon Michael
4813e3fc5f pkg:ui: fix wasteful double-building of hledger-ui modules 2023-11-07 09:06:56 -08:00
Simon Michael
96117ae514 ci: do haddock testing less often, in the mac binaries workflow
It costs 1m+, doesn't fail that often, and is not hard to fix even if
detected late.
2023-11-07 05:27:18 -08:00
Simon Michael
617e35ec57 ci: really fix some redundant building of hledger-lib and hledger 2023-11-07 04:59:53 -08:00
Simon Michael
1eee7f0208 ci: fix some redundant building of hledger-lib and hledger 2023-11-07 04:47:04 -08:00
Simon Michael
54b4c2ed22 fix: auto postings: detect redundant costs properly (fix #2110) 2023-11-07 04:38:39 -08:00
Peter Sagerson
efcea0600a feat: cli: Add tsv output (#869)
All commands that suport csv output now also support tsv output. The
data is identical, but the fields are separated by tab characters and
there is no quoting or escaping. Tab, carriage return, and newline
characters in data are converted to spaces (this should rarely if ever
happen in practice).
2023-11-06 16:46:04 -08:00
Simon Michael
dae7b352dd ;ci: disable weekly scheduled builds
They also run in forks, which I don't want.
2023-11-06 10:13:57 -08:00
Simon Michael
66cb349998 ci: fix tests breakage 2023-11-05 01:02:13 -07:00
Simon Michael
b19a9ff56d ;doc:tests:readme 2023-11-01 06:53:25 +00:00
Simon Michael
876bdacf5d ;tools:make:etags: include .test files 2023-11-01 06:53:25 +00:00
Simon Michael
abc99d8dca ;dev: tests: ledger-compat tests cleanup 2023-10-29 00:16:47 +01:00
Simon Michael
65efc8b87f ;dev: tests: add outshine headings for more readability (in emacs) 2023-10-29 00:16:47 +01:00
Simon Michael
48732e6655 ;doc: TESTS name/link 2023-10-28 17:27:45 +01:00
Simon Michael
da2f021654 ;tools:bake:lastweek: improvements 2023-10-28 16:46:39 +01:00
Simon Michael
2ba321885d dev:web: refactor permission checking 2023-10-25 12:51:08 +01:00
Simon Michael
24ce9b5be1 ;bin:report1: cleanups 2023-10-24 13:38:08 +01:00
Simon Michael
efc87d9c0d ;web:sandstorm: bump app version, tweak title 2023-10-24 13:38:08 +01:00
Simon Michael
e40c82c153 ;cabal: update cabal files 2023-10-24 13:37:36 +01:00
Simon Michael
795dbd97f8 imp:web: cleanups; use --allow on Sandstorm (#834) 2023-10-24 13:37:36 +01:00
Simon Michael
95d33f20f6 imp:web: access control UX cleanups (fix #834)
Changes:

1. rename the sandstorm "manage" permission to "edit"
(old permission names: view, add, manage;
 new permission names: view, add, edit).

Rationale: "edit" best describes this permission's current powers, to users and to operators.
If we ever added more manager-type features we'd want that to be a new permission,
not a rename of the existing one (which would change the powers of existing users).

2. rename the sandstorm roles for consistency with permissions
(old role names: viewer, editor, manager;
 new role names: viewer, adder, editor)

Rationale: it's needed to avoid confusion.

3. add a new option: --allow=view|add|edit|sandstorm (default: add).
'sandstorm' sets permissions according to the X-Sandstorm-Permissions header.
Drop the --capabilities and --capabilities-header options.

Rationale: it's simpler and more intuitive.

4. replace "capability" with "permission" in ui/docs/code.

Rationale: consistent with the above, more familiar.
2023-10-24 13:37:36 +01:00
Simon Michael
c195e35572 ;bin:report1: cleanups 2023-10-23 19:29:32 +01:00
Simon Michael
15e76488e3 ;bin: link hledger-report1 scripts 2023-10-23 19:13:52 +01:00
Simon Michael
33cef6f494 ;imp:Hledger.Cli.Script: don't export main, do export CompoundBalanceCommand 2023-10-23 19:09:19 +01:00
Simon Michael
da774bd708 ;bin: hledger-report1: a custom compound report in haskell and bash 2023-10-23 19:07:52 +01:00
Simon Michael
31ecc9f4f2 imp:demo: improve error message when asciinema fails 2023-10-23 14:21:20 +01:00
Simon Michael
d8021ef754 fix:demo: avoid breaking asciinema 2.3.0 (fix #2094)
We were adding a trailing newline, which causes asciinema 2.3.0 to
show a JSON decode error.
2023-10-23 14:08:01 +01:00
Simon Michael
63d41b30db ;doc: haddock, comment fixes 2023-10-21 17:58:43 +01:00
Simon Michael
6d849f9e73 ;make: copy-exe[s]-*: fix help
vv#	examples/shared-expenses.journal
2023-10-21 17:58:43 +01:00
Simon Michael
b6a0ecd424 fix:web: check options like --capabilities before starting the app 2023-10-21 08:54:44 +01:00
Simon Michael
9b8044f737 fix:web:edit form: fix broken "File format help" link (fix #2103)
Now not broken, https rather than http, and pointing to the "Data
formats" section, which has links to each of the file formats
(in case editing a non-journal file).
2023-10-21 03:36:04 +01:00
Simon Michael
3a717d1625 ;doc:cli:Data formats: link to each format's doc 2023-10-21 03:36:04 +01:00
Simon Michael
605b3d6b94 imp:cli:Hledger.Cli.Version: export packagemajorversion 2023-10-21 03:36:04 +01:00
Jacob Weisz
b5bf0cbdb9 ;feat: Upgrade Sandstorm package with permissions 2023-10-20 16:18:37 +01:00
Philipp Klocke
6312446cbf web: Use guessAppRootOr to enable relative root if desired (fix #2099)
This is useful when serving on 0.0.0.0, such that querying from any
other device with <IP>:<PORT> does not fallback to 0.0.0.0:PORT,
which would fail.

Tested: Manually
2023-10-20 09:25:31 +01:00
Simon Michael
edeb906922 ;dev:bake lastweek 2023-10-20 08:34:57 +01:00
Simon Michael
03f757204b ;examples:csv: note where to find vanguard, fidelity CSV 2023-10-20 08:00:27 +01:00