report

package
v0.0.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package report provides functionality for generating reports and formatted output from text conversion operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyser

type Analyser struct {
	// contains filtered or unexported fields
}

Analyser provides functionality to analyse text changes and generate statistics

func NewAnalyser

func NewAnalyser(americanWords map[string]string) *Analyser

NewAnalyser creates a new text change analyser

func (*Analyser) AnalyseChanges

func (a *Analyser) AnalyseChanges(original, converted string) ChangeStats

AnalyseChanges compares original and converted text to generate detailed statistics

type ChangeStats

type ChangeStats struct {
	TotalWords      int
	SpellingChanges int
	UnitConversions int
	QuoteChanges    int
	ChangedWords    []WordChange
	ChangedUnits    []UnitChange
}

ChangeStats represents statistics about changes made during conversion

type FileResult

type FileResult struct {
	FilePath   string
	Original   string
	Converted  string
	Stats      ChangeStats
	HasChanges bool
	Error      error
}

FileResult represents the result of processing a single file

type OutputFormat

type OutputFormat string

OutputFormat represents the different output formats available

const (
	OutputDiff     OutputFormat = "diff"
	OutputText     OutputFormat = "text"
	OutputMarkdown OutputFormat = "markdown"
	OutputStats    OutputFormat = "stats"
)

type ReportOptions

type ReportOptions struct {
	ShowDiff     bool
	ShowText     bool
	ShowMarkdown bool
	ShowStats    bool
	ExitOnChange bool
	Width        int
}

ReportOptions configures the report generation

func DefaultOptions

func DefaultOptions() ReportOptions

DefaultOptions returns sensible default options for report generation

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter handles the generation and formatting of conversion reports

func NewReporter

func NewReporter(options ReportOptions) (*Reporter, error)

NewReporter creates a new Reporter with the given options

func (*Reporter) GenerateMultiFileReport

func (r *Reporter) GenerateMultiFileReport(results []FileResult) (string, error)

GenerateMultiFileReport creates a comprehensive report from multiple file conversion results

func (*Reporter) GenerateReport

func (r *Reporter) GenerateReport(original, converted string, stats ChangeStats) (string, error)

GenerateReport creates a comprehensive report from the conversion results

func (*Reporter) HasChanges

func (r *Reporter) HasChanges() bool

HasChanges returns true if any changes were detected

func (*Reporter) ShouldExitWithError

func (r *Reporter) ShouldExitWithError() bool

ShouldExitWithError returns true if the tool should exit with code 1

type UnitChange

type UnitChange struct {
	Original string
	Changed  string
	Position int
	UnitType string
}

UnitChange represents a single unit conversion

type WordChange

type WordChange struct {
	Original string
	Changed  string
	Position int
}

WordChange represents a single spelling change

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL