Documentation
¶
Index ¶
- func CalculateAlignmentColumn(postings []ast.Posting) int
- func CalculateGlobalAlignmentColumn(transactions []ast.Transaction) int
- func CalculateGlobalAlignmentColumnWithIndent(transactions []ast.Transaction, indentSize int) int
- func FormatDocument(journal *ast.Journal, content string) []protocol.TextEdit
- func FormatDocumentWithFormats(journal *ast.Journal, content string, ...) []protocol.TextEdit
- func FormatDocumentWithOptions(journal *ast.Journal, content string, ...) []protocol.TextEdit
- func FormatNumber(qty decimal.Decimal, format NumberFormat) string
- func FormatPosting(posting *ast.Posting, alignCol int) string
- func FormatPostingWithAlignment(posting *ast.Posting, alignment AlignmentInfo, ...) string
- type AlignmentInfo
- type CommodityFormat
- type NumberFormat
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateGlobalAlignmentColumn ¶
func CalculateGlobalAlignmentColumn(transactions []ast.Transaction) int
func CalculateGlobalAlignmentColumnWithIndent ¶ added in v0.2.8
func CalculateGlobalAlignmentColumnWithIndent(transactions []ast.Transaction, indentSize int) int
CalculateGlobalAlignmentColumnWithIndent returns the column at which amounts should be aligned, using the given indentSize instead of the default indent.
func FormatNumber ¶
func FormatNumber(qty decimal.Decimal, format NumberFormat) string
func FormatPostingWithAlignment ¶
func FormatPostingWithAlignment(posting *ast.Posting, alignment AlignmentInfo, commodityFormats map[string]CommodityFormat) string
Types ¶
type AlignmentInfo ¶
func CalculateAlignment ¶
func CalculateAlignment(postings []ast.Posting, commodityFormats map[string]CommodityFormat) AlignmentInfo
CalculateAlignment calculates alignment for a single transaction's postings. For consistent file-wide alignment, use CalculateAlignmentWithGlobal with a pre-calculated global column from CalculateGlobalAlignmentColumn.
func CalculateAlignmentWithGlobal ¶
func CalculateAlignmentWithGlobal(postings []ast.Posting, commodityFormats map[string]CommodityFormat, accountCol int) AlignmentInfo
CalculateAlignmentWithGlobal calculates alignment using a provided account column. Use this with CalculateGlobalAlignmentColumn for file-wide consistent alignment.
type CommodityFormat ¶ added in v0.2.8
type CommodityFormat struct {
NumberFormat
Position ast.CommodityPosition
SpaceBetween bool
}
func ParseCommodityFormat ¶ added in v0.2.8
func ParseCommodityFormat(formatStr string, symbol string) CommodityFormat
type NumberFormat ¶
func ParseNumberFormat ¶
func ParseNumberFormat(formatStr string) NumberFormat
Click to show internal directories.
Click to hide internal directories.