From 9fee514bd1828bdb3534e238417a15748f7b10b6 Mon Sep 17 00:00:00 2001 From: Maxim Zimaliev Date: Thu, 7 Dec 2017 20:35:07 +0300 Subject: [PATCH] backslash-r replacements --- src/Text/Markdown/SlamDown/Parser.purs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Text/Markdown/SlamDown/Parser.purs b/src/Text/Markdown/SlamDown/Parser.purs index 0f80cf4..a66241f 100644 --- a/src/Text/Markdown/SlamDown/Parser.purs +++ b/src/Text/Markdown/SlamDown/Parser.purs @@ -13,6 +13,9 @@ import Data.List as L import Data.Maybe as M import Data.Monoid (mempty) import Data.String as S +import Data.String.Regex as RGX +import Data.String.Regex.Unsafe as URX +import Data.String.Regex.Flags as RXF import Data.Traversable (traverse) import Data.Validation.Semigroup as V @@ -372,6 +375,7 @@ tabsToSpaces = S.replace (S.Pattern "\t") (S.Replacement " ") parseMd ∷ ∀ a. (SD.Value a) ⇒ String → Either String (SD.SlamDownP a) parseMd s = map SD.SlamDown bs where - lines = L.fromFoldable $ S.split (S.Pattern "\n") $ S.replace (S.Pattern "\r") (S.Replacement "") $ tabsToSpaces s + slashR = URX.unsafeRegex "\\r" RXF.global + lines = L.fromFoldable $ S.split (S.Pattern "\n") $ RGX.replace slashR "" $ tabsToSpaces s ctrs = parseContainers mempty lines bs = parseBlocks ctrs