packages feed

markdown 0.1.10 → 0.1.11

raw patch · 25 files changed

+118/−5 lines, 25 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Text/Markdown/Block.hs view
@@ -231,22 +231,27 @@                     isNonPara LineBlank = True                     isNonPara LineFenced{} = True                     isNonPara LineBlockQuote{} = not $ msBlankBeforeBlockquote ms+                    isNonPara LineHtml{} = True -- See example 95 in Common Markdown spec                     isNonPara _ = False                 (mfinal, ls) <- takeTillConsume (\x -> isNonPara (lineType ms x) || listStartIndent x)                 maybe (return ()) leftover mfinal                 yield $ Right $ BlockPara $ T.intercalate "\n" $ t' : ls  isHtmlStart :: T.Text -> Bool+-- Allow for up to three spaces before the opening tag.+isHtmlStart t | "    " `T.isPrefixOf` t = False isHtmlStart t =-    case T.stripPrefix "<" t of+    case T.stripPrefix "<" $ T.dropWhile (== ' ') t of         Nothing -> False         Just t' ->             let (name, rest)                     | Just _ <- T.stripPrefix "!--" t' = ("--", t')                     | otherwise = T.break (\c -> c `elem` " >") t'-             in T.all isValidTagName name &&+             in (T.all isValidTagName name &&                 not (T.null name) &&-                (not ("/" `T.isPrefixOf` rest) || ("/>" `T.isPrefixOf` rest))+                (not ("/" `T.isPrefixOf` rest) || ("/>" `T.isPrefixOf` rest)))++                || isPI t' || isCommentCData t'   where     isValidTagName :: Char -> Bool     isValidTagName c =@@ -257,6 +262,9 @@         (c == '_') ||         (c == '/') ||         (c == '!')++    isPI = ("?" `T.isPrefixOf`)+    isCommentCData = ("!" `T.isPrefixOf`)  takeTill :: Monad m => (i -> Bool) -> Conduit i m i takeTill f =
markdown.cabal view
@@ -1,5 +1,5 @@ Name:                markdown-Version:             0.1.10+Version:             0.1.11 Synopsis:            Convert Markdown to HTML, with XSS protection Description:         This library leverages existing high-performance libraries (attoparsec, blaze-html, text, and conduit), and should integrate well with existing codebases. Homepage:            https://github.com/snoyberg/markdown
+ test/examples/html-blocks-spec1.html view
@@ -0,0 +1,7 @@+<table>+  <tr>+    <td>+           hi+    </td>+  </tr>+</table><p>okay.</p>
+ test/examples/html-blocks-spec1.md view
@@ -0,0 +1,9 @@+<table>+  <tr>+    <td>+           hi+    </td>+  </tr>+</table>++okay.
+ test/examples/html-blocks-spec10.html view
@@ -0,0 +1,4 @@+<div>+bar+</div>+*foo*
+ test/examples/html-blocks-spec10.md view
@@ -0,0 +1,4 @@+<div>+bar+</div>+*foo*
+ test/examples/html-blocks-spec11.html view
@@ -0,0 +1,2 @@+<div class+foo
+ test/examples/html-blocks-spec11.md view
@@ -0,0 +1,2 @@+<div class+foo
+ test/examples/html-blocks-spec2.html view
@@ -0,0 +1,3 @@+ <div>+  *hello*+         <foo><a>
+ test/examples/html-blocks-spec2.md view
@@ -0,0 +1,3 @@+ <div>+  *hello*+         <foo><a>
+ test/examples/html-blocks-spec3.html view
@@ -0,0 +1,1 @@+<DIV CLASS="foo"><p><i>Markdown</i></p></DIV>
+ test/examples/html-blocks-spec3.md view
@@ -0,0 +1,5 @@+<DIV CLASS="foo">++*Markdown*++</DIV>
+ test/examples/html-blocks-spec4.html view
@@ -0,0 +1,4 @@+<div></div>+``` c+int x = 33;+```
+ test/examples/html-blocks-spec4.md view
@@ -0,0 +1,4 @@+<div></div>+``` c+int x = 33;+```
+ test/examples/html-blocks-spec5.html view
@@ -0,0 +1,3 @@+<!-- Foo+bar+   baz -->
+ test/examples/html-blocks-spec5.md view
@@ -0,0 +1,3 @@+<!-- Foo+bar+   baz -->
+ test/examples/html-blocks-spec6.html view
@@ -0,0 +1,3 @@+<?php+  echo 'foo'+  ?>
+ test/examples/html-blocks-spec6.md view
@@ -0,0 +1,3 @@+<?php+  echo 'foo'+  ?>
+ test/examples/html-blocks-spec7.html view
@@ -0,0 +1,13 @@+<![CDATA[+function matchwo(a,b)+{+if (a < b && a < 0) then+  {+  return 1;+  }+else+  {+  return 0;+  }+}+]]>
+ test/examples/html-blocks-spec7.md view
@@ -0,0 +1,13 @@+<![CDATA[+function matchwo(a,b)+{+if (a < b && a < 0) then+  {+  return 1;+  }+else+  {+  return 0;+  }+}+]]>
+ test/examples/html-blocks-spec8.html view
@@ -0,0 +1,1 @@+  <!-- foo --><pre><code>&lt;!-- foo --&gt;</code></pre>
+ test/examples/html-blocks-spec8.md view
@@ -0,0 +1,3 @@+  <!-- foo -->++    <!-- foo -->
+ test/examples/html-blocks-spec9.html view
@@ -0,0 +1,3 @@+<p>Foo</p><div>+bar+</div>
+ test/examples/html-blocks-spec9.md view
@@ -0,0 +1,4 @@+Foo+<div>+bar+</div>
test/main.hs view
@@ -10,6 +10,8 @@ import Control.Monad (forM_) import qualified Data.Set as Set import qualified Data.Map as Map+import Data.List (isInfixOf)+import Data.Maybe (fromMaybe)  import qualified Filesystem.Path.CurrentOS as F import qualified Filesystem as F@@ -233,7 +235,13 @@     go fp = do         input <- F.readTextFile fp         output <- F.readTextFile $ F.replaceExtension fp "html"-        return $ it (F.encodeString $ F.basename fp) $ check (fromStrict $ T.strip output) (fromStrict input)+        let (checker, stripper)+                | "-spec" `isInfixOf` F.encodeString fp = (check', dropFinalLF)+                | otherwise = (check, T.strip)++        return $ it (F.encodeString $ F.basename fp) $ checker (fromStrict $ stripper output) (fromStrict input)++    dropFinalLF t = fromMaybe t $ T.stripSuffix "\n" t  getGruber :: IO [Spec] getGruber = do