more cleanup, fix duplicate tag display

This commit is contained in:
Simon Michael 2012-12-06 02:09:53 +00:00
parent 27621515ea
commit ccbc071289
2 changed files with 1 additions and 11 deletions

View File

@ -40,8 +40,6 @@ module Hledger.Data.Posting (
showPosting,
showPostingForRegister,
-- * misc.
postingTagsAsLines,
tagsAsLines,
showComment,
tests_Hledger_Data_Posting
)
@ -81,7 +79,7 @@ post acct amt = posting {paccount=acct, pamount=mixed amt}
showPosting :: Posting -> String
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
ledger3ishlayout = False
acctnamewidth = if ledger3ishlayout then 25 else 22
@ -93,12 +91,6 @@ showPosting p@Posting{paccount=a,pamount=amt,ptype=t} =
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 s = if null s then "" else " ;" ++ s

View File

@ -131,7 +131,6 @@ showTransaction' :: Bool -> Transaction -> String
showTransaction' elide t =
unlines $ [descriptionline]
++ multilinecomment
-- ++ (tagsAsLines $ ttags t)
++ (postingsAsLines elide t (tpostings t))
++ [""]
where
@ -165,7 +164,6 @@ postingAsLines :: Bool -> [Posting] -> Posting -> [String]
postingAsLines elideamount ps p =
postinglines
++ multilinecomment
-- ++ tagsAsLines (ptags p)
where
postinglines = map rstrip $ lines $ concatTopPadded [showacct p, " ", amount, inlinecomment]
amount = if elideamount then "" else showamt (pamount p)