@@ -239,7 +239,7 @@ referenceKey = try $ do
239 src <- try betweenAngles <|> sourceURL
239 src <- try betweenAngles <|> sourceURL
240 tit <- option "" referenceTitle
240 tit <- option "" referenceTitle
241 blanklines
241 blanklines
242− let target = (escapeURI $ removeTrailingSpace src, tit)
242+ let target = (escapeURI $ trimr src, tit)
243 st <- getState
243 st <- getState
244 let oldkeys = stateKeys st
244 let oldkeys = stateKeys st
245 updateState $ \s -> s { stateKeys = M.insert (toKey raw) target oldkeys }
245 updateState $ \s -> s { stateKeys = M.insert (toKey raw) target oldkeys }
@@ -848,7 +848,7 @@ simpleTableHeader headless = try $ do
848 else rawHeads
848 else rawHeads
849 heads <- fmap sequence
849 heads <- fmap sequence
850 $ mapM (parseFromString (mconcat <$> many plain))
850 $ mapM (parseFromString (mconcat <$> many plain))
851− $ map removeLeadingTrailingSpace rawHeads'
851+ $ map trim rawHeads'
852 return (heads, aligns, indices)
852 return (heads, aligns, indices)
854-- Returns an alignment type for a table, based on a list of strings
854-- Returns an alignment type for a table, based on a list of strings
@@ -859,7 +859,7 @@ alignType :: [String]
859 -> Alignment
859 -> Alignment
860alignType [] _ = AlignDefault
860alignType [] _ = AlignDefault
861alignType strLst len =
861alignType strLst len =
862− let nonempties = filter (not . null) $ map removeTrailingSpace strLst
862+ let nonempties = filter (not . null) $ map trimr strLst
863 (leftSpace, rightSpace) =
863 (leftSpace, rightSpace) =
864 case sortBy (comparing length) nonempties of
864 case sortBy (comparing length) nonempties of
865 (x:_) -> (head x `elem` " \t", length x < len)
865 (x:_) -> (head x `elem` " \t", length x < len)
@@ -884,7 +884,7 @@ rawTableLine :: [Int]
884rawTableLine indices = do
884rawTableLine indices = do
885 notFollowedBy' (blanklines <|> tableFooter)
885 notFollowedBy' (blanklines <|> tableFooter)
886 line <- many1Till anyChar newline
886 line <- many1Till anyChar newline
887− return $ map removeLeadingTrailingSpace $ tail $
887+ return $ map trim $ tail $
888 splitStringByIndices (init indices) line
888 splitStringByIndices (init indices) line
890-- Parse a table line and return a list of lists of blocks (columns).
890-- Parse a table line and return a list of lists of blocks (columns).
@@ -957,7 +957,7 @@ multilineTableHeader headless = try $ do
957 else map (intercalate " ") rawHeadsList
957 else map (intercalate " ") rawHeadsList
958 heads <- fmap sequence $
958 heads <- fmap sequence $
959 mapM (parseFromString (mconcat <$> many plain)) $
959 mapM (parseFromString (mconcat <$> many plain)) $
960− map removeLeadingTrailingSpace rawHeads
960+ map trim rawHeads
961 return (heads, aligns, indices)
961 return (heads, aligns, indices)
963-- Parse a grid table: starts with row of '-' on top, then header
963-- Parse a grid table: starts with row of '-' on top, then header
@@ -972,7 +972,7 @@ gridTable headless =
973gridTableSplitLine :: [Int] -> String -> [String]
973gridTableSplitLine :: [Int] -> String -> [String]
974gridTableSplitLine indices line = map removeFinalBar $ tail $
974gridTableSplitLine indices line = map removeFinalBar $ tail $
975− splitStringByIndices (init indices) $ removeTrailingSpace line
975+ splitStringByIndices (init indices) $ trimr line
977gridPart :: Char -> Parser [Char] st (Int, Int)
977gridPart :: Char -> Parser [Char] st (Int, Int)
978gridPart ch = do
978gridPart ch = do
@@ -1014,7 +1014,7 @@ gridTableHeader headless = try $ do
1014 else map (intercalate " ") $ transpose
1014 else map (intercalate " ") $ transpose
1015 $ map (gridTableSplitLine indices) rawContent
1015 $ map (gridTableSplitLine indices) rawContent
1016 heads <- fmap sequence $ mapM (parseFromString block) $
1016 heads <- fmap sequence $ mapM (parseFromString block) $
1017− map removeLeadingTrailingSpace rawHeads
1017+ map trim rawHeads
1018 return (heads, aligns, indices)
1018 return (heads, aligns, indices)
1020gridTableRawLine :: [Int] -> Parser [Char] ParserState [String]
1020gridTableRawLine :: [Int] -> Parser [Char] ParserState [String]
@@ -1228,7 +1228,7 @@ code = try $ do
1228 notFollowedBy (char '`')))
1228 notFollowedBy (char '`')))
1229 attr <- option ([],[],[]) (try $ guardEnabled Ext_inline_code_attributes >>
1229 attr <- option ([],[],[]) (try $ guardEnabled Ext_inline_code_attributes >>
1230 optional whitespace >> attributes)
1230 optional whitespace >> attributes)
1231− return $ return $ B.codeWith attr $ removeLeadingTrailingSpace $ concat result
1231+ return $ return $ B.codeWith attr $ trim $ concat result
1233math :: Parser [Char] ParserState (F Inlines)
1233math :: Parser [Char] ParserState (F Inlines)
1234math = (return . B.displayMath <$> (mathDisplay >>= applyMacros'))
1234math = (return . B.displayMath <$> (mathDisplay >>= applyMacros'))
@@ -1416,7 +1416,7 @@ source' = do
1416 tit <- option "" linkTitle
1416 tit <- option "" linkTitle
1417 skipSpaces
1417 skipSpaces
1419− return (escapeURI $ removeTrailingSpace src, tit)
1419+ return (escapeURI $ trimr src, tit)
1421linkTitle :: Parser [Char] ParserState String
1421linkTitle :: Parser [Char] ParserState String
1422linkTitle = try $ do
1422linkTitle = try $ do