all repos

clerk @ 4c27ef190f94161a44b4809130990a5c26d69fed

missing tooling for ledger/hledger
6 files changed, 9 insertions(+), 8 deletions(-)
journal/printer: fix inline comments (always insert 2 spaces before)
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-06-09 15:33:31 +0300
Authored at: 2026-06-09 15:18:49 +0300
Change ID: vnvznvpuvnlpvzxmrtrvxkttyppnnluw
Parent: 76c9754
M journal/printer/printer.go
···
        181
        181
         func (p *printer) writeInlineComment(c *ast.Comment) {

      
        182
        182
         	if c != nil && c.Text != "" {

      
        183
        183
         		p.buf.WriteByte(' ')

      
        
        184
        +		p.buf.WriteByte(' ')

      
        184
        185
         		p.buf.WriteByte(c.Marker)

      
        185
        186
         		if !isCommentChar(c.Text[0]) {

      
        186
        187
         			p.buf.WriteByte(' ')

      
M journal/printer/testdata/directives.golden
···
        1
        1
         ; Directives

      
        2
        
        -account Assets:Cash ; cash account

      
        
        2
        +account Assets:Cash  ; cash account

      
        3
        3
         commodity $

      
        4
        4
         include 

      
        5
        5
         alias Assets:Checking = Assets:Cash

      ···
        12
        12
         P 2026-01-15 12:00:00 GOOG 150.00$

      
        13
        13
         

      
        14
        14
         ; Conversion

      
        15
        
        -C 100.00$ = 85.00€ ; test comment

      
        
        15
        +C 100.00$ = 85.00€  ; test comment

      
        16
        16
         

      
        17
        17
         ; Default commodity

      
        18
        18
         D 1,000.00$

      
M journal/printer/testdata/preserve_blanks.golden
···
        26
        26
         

      
        27
        27
         

      
        28
        28
         2026-02-10 * something | 2 months of *income*

      
        29
        
        -  assets:bank  1.50 USD ; jan

      
        30
        
        -  assets:bank  1.00 USD ; feb

      
        
        29
        +  assets:bank  1.50 USD  ; jan

      
        
        30
        +  assets:bank  1.00 USD  ; feb

      
        31
        31
           income:invenstment

      
M journal/printer/testdata/sample.golden
···
        25
        25
           assets:bank

      
        26
        26
         

      
        27
        27
         2026-02-10 * something | 2 months of *income* + idk

      
        28
        
        -  assets:bank  1.50 USD ; jan

      
        29
        
        -  assets:bank  1.00 USD ; feb

      
        
        28
        +  assets:bank  1.50 USD  ; jan

      
        
        29
        +  assets:bank  1.00 USD  ; feb

      
        30
        30
           income:invenstment

      
M journal/printer/transaction.go
···
        107
        107
         

      
        108
        108
         	// comment

      
        109
        109
         	if t.Comment != nil && t.Comment.Text != "" {

      
        110
        
        -		p.buf.WriteString(" ; ")

      
        
        110
        +		p.buf.WriteString("  ; ")

      
        111
        111
         		p.buf.WriteString(t.Comment.Text)

      
        112
        112
         	}

      
        113
        113
         

      
M journal/printer/transaction_postings.go
···
        121
        121
         

      
        122
        122
         	if pt.Comment != nil && pt.Comment.Text != "" {

      
        123
        123
         		if p.cfg.AlignStyle == AlignTwoSpaces {

      
        124
        
        -			p.buf.WriteString(" ")

      
        
        124
        +			p.buf.WriteString("  ")

      
        125
        125
         		} else {

      
        126
        126
         			p.buf.WriteByte('\v')

      
        127
        127
         		}