From 9a0a0be01c137fe5cc03b00b67075300d3f6d7b4 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 23 Sep 2011 14:27:26 +0000 Subject: [PATCH] docs: whitespace --- MANUAL.md | 44 ++++++++++++------------- hledger-lib/Hledger/Data/Transaction.hs | 18 ++++------ hledger/Hledger/Cli/Print.hs | 2 +- 3 files changed, 30 insertions(+), 34 deletions(-) diff --git a/MANUAL.md b/MANUAL.md index 69e6eda14..cf2fca835 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -1182,38 +1182,38 @@ entries, and the following c++ ledger options and commands: #### Other differences -- hledger recognises description and negative patterns by "desc:" - and "not:" prefixes, unlike ledger 3's free-form parser +- hledger recognises description and negative patterns by "desc:" + and "not:" prefixes, unlike ledger 3's free-form parser -- hledger doesn't require a space before command-line option - values, eg either `-f-` or `-f -` is fine +- hledger doesn't require a space before command-line option + values, eg either `-f-` or `-f -` is fine -- hledger's weekly reporting intervals always start on mondays +- hledger's weekly reporting intervals always start on mondays -- hledger shows start and end dates of the intervals requested, - not just the span containing data +- hledger shows start and end dates of the intervals requested, + not just the span containing data -- hledger always shows timelog balances in hours +- hledger always shows timelog balances in hours -- hledger splits multi-day timelog sessions at midnight +- hledger splits multi-day timelog sessions at midnight -- hledger doesn't track the value of commodities with varying - price; prices are fixed as of the transaction date +- hledger doesn't track the value of commodities with varying + price; prices are fixed as of the transaction date -- hledger's output follows the decimal point character, digit grouping, - and digit group separator character used in the journal. +- hledger's output follows the decimal point character, digit grouping, + and digit group separator character used in the journal. -- hledger print shows amounts for all postings, and shows unit - prices for amounts which have them. (This currently means that - it does not print multi-commodity transactions in valid journal format.) +- hledger print shows amounts for all postings, and shows unit + prices for amounts which have them. (This currently means that + it does not print multi-commodity transactions in valid journal format.) - - hledger's default commodity directive (D) sets the commodity for - subsequent commodityless amounts, and contributes to that commodity's - display settings. ledger uses D only for commodity display settings - and for the entry command. +- hledger's default commodity directive (D) sets the commodity for + subsequent commodityless amounts, and contributes to that commodity's + display settings. ledger uses D only for commodity display settings + and for the entry command. -- hledger generates a description for timelog sessions, instead of - taking it from the clock-out entry +- hledger generates a description for timelog sessions, instead of + taking it from the clock-out entry ### Troubleshooting diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index 17844bbff..03488844a 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -59,27 +59,23 @@ pcommentwidth = no limit -- 22 @ -} showTransaction :: Transaction -> String -showTransaction = showTransaction' True False +showTransaction = showTransaction' True showTransactionUnelided :: Transaction -> String -showTransactionUnelided = showTransaction' False False +showTransactionUnelided = showTransaction' False -showTransactionForPrint :: Bool -> Transaction -> String -showTransactionForPrint effective = showTransaction' False effective - -showTransaction' :: Bool -> Bool -> Transaction -> String -showTransaction' elide effective t = +showTransaction' :: Bool -> Transaction -> String +showTransaction' elide t = unlines $ [description] ++ showpostings (tpostings t) ++ [""] where description = concat [date, status, code, desc, comment] - date | effective = showdate $ fromMaybe (tdate t) $ teffectivedate t - | otherwise = showdate (tdate t) ++ maybe "" showedate (teffectivedate t) + date = showdate (tdate t) ++ maybe "" showedate (teffectivedate t) + showdate = printf "%-10s" . showDate + showedate = printf "=%s" . showdate status = if tstatus t then " *" else "" code = if length (tcode t) > 0 then printf " (%s)" $ tcode t else "" desc = if null d then "" else " " ++ d where d = tdescription t comment = if null c then "" else " ; " ++ c where c = tcomment t - showdate = printf "%-10s" . showDate - showedate = printf "=%s" . showdate showpostings ps | elide && length ps > 1 && isTransactionBalanced Nothing t -- imprecise balanced check = map showposting (init ps) ++ [showpostingnoamt (last ps)] diff --git a/hledger/Hledger/Cli/Print.hs b/hledger/Hledger/Cli/Print.hs index 9a18b40f6..d2294e472 100644 --- a/hledger/Hledger/Cli/Print.hs +++ b/hledger/Hledger/Cli/Print.hs @@ -25,5 +25,5 @@ showTransactions :: ReportOpts -> FilterSpec -> Journal -> String showTransactions opts fspec j = entriesReportAsText opts fspec $ entriesReport opts fspec j entriesReportAsText :: ReportOpts -> FilterSpec -> EntriesReport -> String -entriesReportAsText opts _ items = concatMap (showTransactionForPrint (effective_ opts)) items +entriesReportAsText _ _ items = concatMap showTransactionUnelided items