diff --git a/CLAUDE.md b/CLAUDE.md index e7ff22d..ceb2330 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -314,7 +314,7 @@ IBAN wrapped across continuation lines stays contiguous for a glob to match. A new parser must do the same rather than reintroduce a structured field. **A parser may name its statements, and only uploads use it.** `parser.Namer` is -optional, like `parser.Warner`: `nlb` names an izpisek `izpisek_YYYY_MM_DD` +optional, like `parser.Warner`: `nlb` names an izpisek `izpisek_YYYY-MM-DD` after its *Datum izpiska*, ported from the `rename_izpiski.py` it replaced, and `traderepublic` names a statement `traderepublic_YYYY_MM_DD_YYYY_MM_DD` after the period in its header. A name is derived from what the statement says, never diff --git a/README.md b/README.md index 2c01211..9a457f3 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ it does not create one. Some banks name their downloads unhelpfully, so a parser may name the statement instead — lowercase throughout, extension included — and the status line says -what each file became. An NLB izpisek is saved as `izpisek_YYYY_MM_DD.pdf` after +what each file became. An NLB izpisek is saved as `izpisek_YYYY-MM-DD.pdf` after the *Datum izpiska* in its header, and a Trade Republic statement, which downloads as `document-N.pdf`, as `traderepublic_YYYY_MM_DD_YYYY_MM_DD.pdf` after the period on its first page (`DATE 01 May 2025 - 31 Jul 2026`). Either @@ -679,7 +679,7 @@ nothing else to configure — `parser` names one of these and that is all. | `parser` | Statement | Notes | | --- | --- | --- | -| `nlb` | NLB izpisek PDF | Wrapped descriptions are folded in from continuation lines, and the IBAN column is appended to the description. Uploads are saved as `izpisek_YYYY_MM_DD.pdf` after the statement date. | +| `nlb` | NLB izpisek PDF | Wrapped descriptions are folded in from continuation lines, and the IBAN column is appended to the description. Uploads are saved as `izpisek_YYYY-MM-DD.pdf` after the statement date. | | `traderepublic` | Trade Republic PDF | Handles both the single-line and the stacked layout by measuring column positions. Uploads are saved as `traderepublic_YYYY_MM_DD_YYYY_MM_DD.pdf` after the statement period. | | `revolut` | `account-statement*.csv` | Skips non-COMPLETED rows, folds the fee into the amount. | diff --git a/internal/parser/nlb.go b/internal/parser/nlb.go index b727b14..b820ccf 100644 --- a/internal/parser/nlb.go +++ b/internal/parser/nlb.go @@ -65,7 +65,7 @@ func (p *nlbParser) Parse(path string, acc *config.Account) ([]RawTxn, error) { return parseNLBText(text, p.digits) } -// StatementName names an izpisek after its statement date, izpisek_YYYY_MM_DD, +// StatementName names an izpisek after its statement date, izpisek_YYYY-MM-DD, // so the folder sorts by date and two downloads of one statement collide. func (p *nlbParser) StatementName(path string) (string, error) { text, err := pdfToText(path) @@ -80,7 +80,7 @@ func nlbStatementName(text string) string { if m == nil { return "" } - return fmt.Sprintf("izpisek_%s_%s_%s", m[3], m[2], m[1]) + return fmt.Sprintf("izpisek_%s-%s-%s", m[3], m[2], m[1]) } // parseNLBText holds the whole parser, separated from PDF extraction so it can diff --git a/internal/parser/nlb_test.go b/internal/parser/nlb_test.go index 8a2aa56..3fbfb4b 100644 --- a/internal/parser/nlb_test.go +++ b/internal/parser/nlb_test.go @@ -117,8 +117,8 @@ func TestParseNLBRejectsMalformedLine(t *testing.T) { func TestNLBStatementName(t *testing.T) { header := " IZPISEK 001/2026\n" + " Datum izpiska 31.01.2026 Stran 1\n" - if got := nlbStatementName(header + nlbPage); got != "izpisek_2026_01_31" { - t.Errorf("name = %q, want izpisek_2026_01_31", got) + if got := nlbStatementName(header + nlbPage); got != "izpisek_2026-01-31" { + t.Errorf("name = %q, want izpisek_2026-01-31", got) } if got := nlbStatementName(nlbPage); got != "" { t.Errorf("name without a statement date = %q, want none", got)