don't show trailing spaces on amountless postings
This commit is contained in:
parent
18e9f826d6
commit
3e6943e5f6
@ -71,14 +71,13 @@ showLedgerTransaction' elide t =
|
||||
| otherwise = map showposting ps
|
||||
where
|
||||
showposting p = showacct p ++ " " ++ (showamount $ pamount p) ++ (showcomment $ pcomment p)
|
||||
showpostingnoamt p = showacct p ++ " " ++ (showcomment $ pcomment p)
|
||||
showpostingnoamt p = rstrip $ showacct p ++ " " ++ (showcomment $ pcomment p)
|
||||
showacct p = " " ++ showstatus p ++ (showaccountname $ paccount p)
|
||||
showamount = printf "%12s" . showMixedAmount
|
||||
showaccountname s = printf "%-34s" s
|
||||
showcomment s = if (length s) > 0 then " ; "++s else ""
|
||||
showstatus p = case pstatus p of
|
||||
True -> "* "
|
||||
False -> ""
|
||||
showstatus p = if pstatus p then "* " else ""
|
||||
rstrip = reverse . dropWhile (== ' ') . reverse
|
||||
|
||||
isLedgerTransactionBalanced :: LedgerTransaction -> Bool
|
||||
isLedgerTransactionBalanced (LedgerTransaction {ltpostings=ps}) =
|
||||
|
||||
7
Tests.hs
7
Tests.hs
@ -748,6 +748,9 @@ tests = [
|
||||
|
||||
,"show hours" ~: show (hours 1) ~?= "1.0h"
|
||||
|
||||
,"showLedgerTransaction" ~: do
|
||||
showLedgerTransaction entry1 `is` entry1_str
|
||||
|
||||
,"smart dates" ~: do
|
||||
let str `gives` datestr = fixSmartDateStr (parsedate "2008/11/26") str `is` datestr
|
||||
"1999-12-02" `gives` "1999/12/02"
|
||||
@ -915,8 +918,8 @@ rawposting1 = Posting False "expenses:food:dining" (Mixed [dollars 10]) "" Regul
|
||||
|
||||
entry1_str = unlines
|
||||
["2007/01/28 coopportunity"
|
||||
," expenses:food:groceries $47.18"
|
||||
," assets:checking"
|
||||
," expenses:food:groceries $47.18"
|
||||
," assets:checking"
|
||||
,""
|
||||
]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user