more cleanup, fix duplicate tag display
This commit is contained in:
parent
27621515ea
commit
ccbc071289
@ -40,8 +40,6 @@ module Hledger.Data.Posting (
|
|||||||
showPosting,
|
showPosting,
|
||||||
showPostingForRegister,
|
showPostingForRegister,
|
||||||
-- * misc.
|
-- * misc.
|
||||||
postingTagsAsLines,
|
|
||||||
tagsAsLines,
|
|
||||||
showComment,
|
showComment,
|
||||||
tests_Hledger_Data_Posting
|
tests_Hledger_Data_Posting
|
||||||
)
|
)
|
||||||
@ -81,7 +79,7 @@ post acct amt = posting {paccount=acct, pamount=mixed amt}
|
|||||||
|
|
||||||
showPosting :: Posting -> String
|
showPosting :: Posting -> String
|
||||||
showPosting p@Posting{paccount=a,pamount=amt,ptype=t} =
|
showPosting p@Posting{paccount=a,pamount=amt,ptype=t} =
|
||||||
unlines $ [concatTopPadded [showaccountname a ++ " ", showamount amt, showComment (pcomment p)]] ++ postingTagsAsLines p
|
unlines $ [concatTopPadded [showaccountname a ++ " ", showamount amt, showComment (pcomment p)]]
|
||||||
where
|
where
|
||||||
ledger3ishlayout = False
|
ledger3ishlayout = False
|
||||||
acctnamewidth = if ledger3ishlayout then 25 else 22
|
acctnamewidth = if ledger3ishlayout then 25 else 22
|
||||||
@ -93,12 +91,6 @@ showPosting p@Posting{paccount=a,pamount=amt,ptype=t} =
|
|||||||
showamount = padleft 12 . showMixedAmount
|
showamount = padleft 12 . showMixedAmount
|
||||||
|
|
||||||
|
|
||||||
postingTagsAsLines :: Posting -> [String]
|
|
||||||
postingTagsAsLines = tagsAsLines . ptags
|
|
||||||
|
|
||||||
tagsAsLines :: [(String, String)] -> [String]
|
|
||||||
tagsAsLines mds = map (\(k,v) -> " ; " ++ k++": "++v) mds
|
|
||||||
|
|
||||||
showComment :: String -> String
|
showComment :: String -> String
|
||||||
showComment s = if null s then "" else " ;" ++ s
|
showComment s = if null s then "" else " ;" ++ s
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,6 @@ showTransaction' :: Bool -> Transaction -> String
|
|||||||
showTransaction' elide t =
|
showTransaction' elide t =
|
||||||
unlines $ [descriptionline]
|
unlines $ [descriptionline]
|
||||||
++ multilinecomment
|
++ multilinecomment
|
||||||
-- ++ (tagsAsLines $ ttags t)
|
|
||||||
++ (postingsAsLines elide t (tpostings t))
|
++ (postingsAsLines elide t (tpostings t))
|
||||||
++ [""]
|
++ [""]
|
||||||
where
|
where
|
||||||
@ -165,7 +164,6 @@ postingAsLines :: Bool -> [Posting] -> Posting -> [String]
|
|||||||
postingAsLines elideamount ps p =
|
postingAsLines elideamount ps p =
|
||||||
postinglines
|
postinglines
|
||||||
++ multilinecomment
|
++ multilinecomment
|
||||||
-- ++ tagsAsLines (ptags p)
|
|
||||||
where
|
where
|
||||||
postinglines = map rstrip $ lines $ concatTopPadded [showacct p, " ", amount, inlinecomment]
|
postinglines = map rstrip $ lines $ concatTopPadded [showacct p, " ", amount, inlinecomment]
|
||||||
amount = if elideamount then "" else showamt (pamount p)
|
amount = if elideamount then "" else showamt (pamount p)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user