Code cleanup in Text.Pandoc.Blocks to eliminate -Wall warnings.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1309 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
b973bc9e3e
commit
e9dc5aa02e
1 changed files with 5 additions and 4 deletions
|
@ -57,7 +57,7 @@ instance Show TextBlock where
|
||||||
breakLines :: Int -- ^ Maximum length of lines.
|
breakLines :: Int -- ^ Maximum length of lines.
|
||||||
-> [String] -- ^ List of lines.
|
-> [String] -- ^ List of lines.
|
||||||
-> [String]
|
-> [String]
|
||||||
breakLines width [] = []
|
breakLines _ [] = []
|
||||||
breakLines width (l:ls) =
|
breakLines width (l:ls) =
|
||||||
if length l > width
|
if length l > width
|
||||||
then (take width l):(breakLines width ((drop width l):ls))
|
then (take width l):(breakLines width ((drop width l):ls))
|
||||||
|
@ -93,9 +93,9 @@ hPad :: Int -- ^ Desired width.
|
||||||
-> String -- ^ String to pad.
|
-> String -- ^ String to pad.
|
||||||
-> String
|
-> String
|
||||||
hPad width line =
|
hPad width line =
|
||||||
let lineLength = length line
|
let linelen = length line
|
||||||
in if lineLength <= width
|
in if linelen <= width
|
||||||
then line ++ replicate (width - lineLength) ' '
|
then line ++ replicate (width - linelen) ' '
|
||||||
else take width line
|
else take width line
|
||||||
|
|
||||||
-- | Concatenates a list of @TextBlock@s into a new @TextBlock@ in
|
-- | Concatenates a list of @TextBlock@s into a new @TextBlock@ in
|
||||||
|
@ -116,6 +116,7 @@ hcatBlocks ((TextBlock width1 height1 lns1):xs) =
|
||||||
hsepBlocks :: [TextBlock] -> TextBlock
|
hsepBlocks :: [TextBlock] -> TextBlock
|
||||||
hsepBlocks = hcatBlocks . (intersperse (TextBlock 1 1 [" "]))
|
hsepBlocks = hcatBlocks . (intersperse (TextBlock 1 1 [" "]))
|
||||||
|
|
||||||
|
isWhitespace :: Char -> Bool
|
||||||
isWhitespace x = x `elem` " \t"
|
isWhitespace x = x `elem` " \t"
|
||||||
|
|
||||||
-- | Left-aligns the contents of a @TextBlock@ within the block.
|
-- | Left-aligns the contents of a @TextBlock@ within the block.
|
||||||
|
|
Loading…
Add table
Reference in a new issue