Implement HTML writer #33

Merged
natercio merged 7 commits from html into main 2026-10-05 16:25:21 +01:00
4 changed files with 8 additions and 22 deletions
Showing only changes of commit 4384f28df9 - Show all commits

No files matched your search

+8 -2
View File
@@ -20,10 +20,16 @@ go install github.com/nmoniz/any2anexoj/cmd/any2anexoj-cli@latest
## Usage
```bash
cat statement.csv | any2anexoj-cli --platform=tranding212
cat statement.csv | any2anexoj-cli --platform=trading212
```
Pass `--format html` to emit a complete, standalone Bootstrap-styled HTML report (a `<!DOCTYPE html>` document with the Anexo J table embedded and Bootstrap loaded via CDN); the default `--format table` prints the pretty terminal table and `--format csv` writes the Anexo J CSV schema.
`trading212` is currently the only supported platform. The output format is selected with `-f`/`--format`:
- `table` (default): pretty terminal table
- `csv`: the Anexo J CSV schema
- `html`: a complete, standalone Bootstrap-styled HTML report — a `<!DOCTYPE html>` document with the Anexo J table embedded and Bootstrap loaded via CDN
The `table` and `html` formats are translated according to `--language`/`-l` (`pt` by default, `en` available). Other flags: `--selectors` filters which entries are processed (`code`, `assetCountry`), `--open-figi-api-key` raises OpenFIGI rate limits for faster report generation, and `--debug` enables debug logging.
### Incremental Reports
-4
View File
@@ -1,8 +1,4 @@
<<<<<<<< HEAD:cmd/any2anexoj-cli/localizer.go
package main
========
package writing
>>>>>>>> 6ba3d78 (writers in writing package):internal/writing/localizer.go
import (
"embed"
-10
View File
@@ -1,8 +1,3 @@
<<<<<<<< HEAD:cmd/any2anexoj-cli/localizer_test.go
package main
import "testing"
========
package writing_test
import (
@@ -10,7 +5,6 @@ import (
"github.com/nmoniz/any2anexoj/internal/writing"
)
>>>>>>>> 6ba3d78 (writers in writing package):internal/writing/localizer_test.go
func TestNewLocalizer(t *testing.T) {
tests := []struct {
@@ -25,11 +19,7 @@ func TestNewLocalizer(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
<<<<<<<< HEAD:cmd/any2anexoj-cli/localizer_test.go
_, err := NewLocalizer(tt.lang)
========
_, err := writing.NewLocalizer(tt.lang)
>>>>>>>> 6ba3d78 (writers in writing package):internal/writing/localizer_test.go
if err != nil {
t.Fatalf("want success call but failed: %v", err)
}
-6
View File
@@ -6,8 +6,6 @@ import (
"time"
"github.com/nmoniz/any2anexoj/internal"
<<<<<<<< HEAD:cmd/any2anexoj-cli/pretty_printer_test.go
========
"github.com/nmoniz/any2anexoj/internal/writing"
"github.com/nmoniz/any2anexoj/internal/writing/table"
"github.com/shopspring/decimal"
@@ -52,11 +50,7 @@ func TestPrinter_Render(t *testing.T) {
}
// Create English localizer
<<<<<<<< HEAD:cmd/any2anexoj-cli/pretty_printer_test.go
localizer, err := NewLocalizer("en")
========
localizer, err := writing.NewLocalizer("en")
>>>>>>>> 6ba3d78 (writers in writing package):internal/writing/pretty/printer_test.go
if err != nil {
t.Fatalf("failed to create localizer: %v", err)
}