packages feed

markdown 0.1.5 → 0.1.6

raw patch · 4 files changed

+26/−2 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Text/Markdown.hs view
@@ -161,3 +161,11 @@     go (InlineImage url Nothing content) = H.img H.! HA.src (H.toValue url) H.! HA.alt (H.toValue content)     go (InlineImage url (Just title) content) = H.img H.! HA.src (H.toValue url) H.! HA.alt (H.toValue content) H.! HA.title (H.toValue title)     go (InlineHtml t) = escape t+    go (InlineFootnoteRef x) = let ishown = TL.pack (show x)+                                   (<>) = mappend+                                in H.a H.! HA.href (H.toValue $ "#footnote-" <> ishown)+                                       H.! HA.id (H.toValue $ "ref-" <> ishown) $ H.toHtml $ "[" <> ishown <> "]"+    go (InlineFootnote x) = let ishown = TL.pack (show x)+                                (<>) = mappend+                             in H.a H.! HA.href (H.toValue $ "#ref-" <> ishown)+                                    H.! HA.id (H.toValue $ "footnote-" <> ishown) $ H.toHtml $ "[" <> ishown <> "]"
Text/Markdown/Inline.hs view
@@ -32,6 +32,8 @@             | InlineHtml Text             | InlineLink Text (Maybe Text) [Inline] -- ^ URL, title, content             | InlineImage Text (Maybe Text) Text -- ^ URL, title, content+            | InlineFootnoteRef Integer -- ^ The footnote reference in the body+            | InlineFootnote Integer     deriving (Show, Eq)  inlineParser :: RefMap -> Parser [Inline]@@ -50,9 +52,11 @@ combine (InlineLink u t c:rest) = InlineLink u t (combine c) : combine rest combine (InlineImage u t c:rest) = InlineImage u t c : combine rest combine (InlineHtml t:rest) = InlineHtml t : combine rest+combine (InlineFootnote x:rest) = InlineFootnote x : combine rest+combine (InlineFootnoteRef x:rest) = InlineFootnoteRef x : combine rest  specials :: [Char]-specials = "*_`\\[]!<&"+specials = "*_`\\[]!<&{}"  inlineAny :: RefMap -> Parser Inline inlineAny refs =@@ -64,6 +68,8 @@ inline refs =     text     <|> escape+    <|> footnote+    <|> footnoteRef     <|> paired "**" InlineBold <|> paired "__" InlineBold     <|> paired "*" InlineItalic <|> paired "_" InlineItalic     <|> doubleCode <|> code@@ -92,6 +98,9 @@      doubleCode = InlineCode . T.pack <$> (string "`` " *> manyTill anyChar (string " ``"))     code = InlineCode <$> (char '`' *> takeWhile1 (/= '`') <* char '`')++    footnoteRef = InlineFootnoteRef <$> (char '{' *> decimal <* char '}')+    footnote = InlineFootnote <$> (string "{^" *> decimal <* char '}')      escape = InlineText . T.singleton <$> (char '\\' *> satisfy (`elem` "\\`*_{}[]()#+-.!>")) 
markdown.cabal view
@@ -1,5 +1,5 @@ Name:                markdown-Version:             0.1.5+Version:             0.1.6 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/main.hs view
@@ -212,6 +212,13 @@                 }             "<article class=\"someclass\"><p>foo</p><blockquote><p>bar</p></blockquote></article>"             "@@@ someclass\nfoo\n\n> bar\n@@@"+    describe "footnotes" $ do+        it "inline" $+            check "<p><a href=\"#footnote-1\" id=\"ref-1\">[1]</a>hello</p>"+                  "{1}hello"+        it "references" $+            check "<p><a href=\"#ref-1\" id=\"footnote-1\">[1]</a>hello</p>"+                  "{^1}hello"     describe "examples" $ sequence_ examples     describe "John Gruber's test suite" $ sequence_ gruber