mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
parent
725bee02f2
commit
e4add6df83
@ -709,10 +709,10 @@ transactionFromCsvRecord sourcepos rules record = t
|
||||
["error: could not parse \""++str++"\" as a cleared status (should be *, ! or empty)"
|
||||
,"the parse error is: "++customErrorBundlePretty err
|
||||
]
|
||||
code = maybe "" render $ mfieldtemplate "code"
|
||||
description = maybe "" render $ mfieldtemplate "description"
|
||||
comment = maybe "" render $ mfieldtemplate "comment"
|
||||
precomment = maybe "" render $ mfieldtemplate "precomment"
|
||||
code = singleline $ maybe "" render $ mfieldtemplate "code"
|
||||
description = singleline $ maybe "" render $ mfieldtemplate "description"
|
||||
comment = singleline $ maybe "" render $ mfieldtemplate "comment"
|
||||
precomment = singleline $ maybe "" render $ mfieldtemplate "precomment"
|
||||
|
||||
s `or` def = if null s then def else s
|
||||
parsebalance currency n str
|
||||
|
@ -21,6 +21,7 @@ module Hledger.Utils.String (
|
||||
lstrip,
|
||||
rstrip,
|
||||
chomp,
|
||||
singleline,
|
||||
elideLeft,
|
||||
elideRight,
|
||||
formatString,
|
||||
@ -76,6 +77,10 @@ rstrip = reverse . lstrip . reverse
|
||||
chomp :: String -> String
|
||||
chomp = reverse . dropWhile (`elem` "\r\n") . reverse
|
||||
|
||||
-- | Remove line breaks
|
||||
singleline :: String -> String
|
||||
singleline = map (\c -> if c `elem` "\r\n" then ' ' else c)
|
||||
|
||||
stripbrackets :: String -> String
|
||||
stripbrackets = dropWhile (`elem` "([") . reverse . dropWhile (`elem` "])") . reverse :: String -> String
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user