5 files changed,
22 insertions(+),
15 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-08-03 12:52:15 +0300
Authored at:
2026-08-03 12:07:48 +0300
Change ID:
vkxsqywltzwrqtulvsrmwxzzkwxvuskx
Parent:
a91ce69
M
journal/parser/testdata/period_transaction_expressions.txtar
··· 24 24 BlankLine j:2:0-2:1 25 25 PeriodicTransaction j:2:1-6:0 26 26 Period: "monthly" 27 - Status: "*" 28 27 Posting j:3:1-4:1 29 28 Account j:3:5-3:18 30 29 SubAccount: "expenses" j:3:5-3:13 ··· 47 46 Period: "monthly from 2023-04-15 to 2023-06-16" 48 47 From: 2023-04-15 49 48 To: 2023-06-16 50 - Status: "*" 51 49 Posting j:7:1-8:1 52 50 Account j:7:5-7:23 53 51 SubAccount: "expenses" j:7:5-7:13 ··· 68 66 BlankLine j:10:0-10:1 69 67 PeriodicTransaction j:10:1-14:0 70 68 Period: "every 2 months" 71 - Status: "*" 72 69 Description: "in 2023, we will review" j:10:19-11:0 73 70 Posting j:11:1-12:1 74 71 Account j:11:5-11:23 ··· 90 87 BlankLine j:14:0-14:1 91 88 PeriodicTransaction j:14:1-18:0 92 89 Period: "monthly" 93 - Status: "*" 94 90 Description: "Next year blah blah" j:14:12-15:0 95 91 Posting j:15:1-16:1 96 92 Account j:15:5-15:18 ··· 111 107 BlankLine j:18:0-18:1 112 108 PeriodicTransaction j:18:1-21:1 113 109 Period: "monthly from 2018/6" 114 - Status: "*" 115 110 Comment j:18:23-19:0 116 111 Marker: ";" 117 112 Text: "In 2019 we will change this"
M
journal/printer/amount.go
··· 11 11 } 12 12 13 13 if a.IsExpr { 14 - p.buf.WriteString(a.Expr) 15 - return 14 + if a.Expr != "" { 15 + // parenthesized expression, e.g. (amount * 0.5) 16 + p.buf.WriteByte('(') 17 + p.buf.WriteString(a.Expr) 18 + p.buf.WriteByte(')') 19 + return 20 + } else { 21 + // bare scaling expr, e.g. `*-1`, `*.33` — parser stored the value in Quantity 22 + p.buf.WriteByte('*') 23 + } 16 24 } 17 25 18 26 prec := max(a.QuantityFmt.Precision, 2)
M
journal/printer/directives.go
··· 114 114 p.buf.WriteByte('\n') 115 115 } 116 116 } 117 - p.buf.WriteString("end") 118 - if cb.Header != "" { 119 - p.buf.WriteByte(' ') 120 - p.buf.WriteString(cb.Header) 121 - } 117 + p.buf.WriteString("end\n") 122 118 } 123 119 124 120 func (p *printer) writeApplyDirective(a *ast.ApplyDirective) {
M
journal/printer/testdata/entries.txtar
··· 26 26 Expenses:Food $100.00 27 27 Assets:Cash $-100.00 28 28 29 += expenses:gifts 30 + budget:gifts *-1 31 + assets:budget (amount * 0.5) 32 + 29 33 2026/01/15 * (CODE) Test with code and note | Some note 30 34 Expenses:Food $100 31 35 Assets:Cash $-100 ··· 79 83 Expenses:Food 30.00$ 80 84 Assets:Cash -30.00$ 81 85 82 -~ monthly * 86 +~ monthly 83 87 Expenses:Food 100.00$ 84 88 Assets:Cash -100.00$ 85 89 86 90 = account:Expenses 87 91 Expenses:Food 100.00$ 88 92 Assets:Cash -100.00$ 93 + 94 += expenses:gifts 95 + budget:gifts *-1.00 96 + assets:budget (amount * 0.5) 89 97 90 98 2026-01-15 * (CODE) Test with code and note | Some note 91 99 Expenses:Food 100.00$