blaze-html-truncate 0.2.0.0 → 0.2.0.1
raw patch · 2 files changed
+2/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Text/Blaze/Truncate.hs +1/−3
- blaze-html-truncate.cabal +1/−1
Text/Blaze/Truncate.hs view
@@ -1,6 +1,5 @@ module Text.Blaze.Truncate(truncateHtml) where --- from Blaze 0.4 to 0.5: Html -> Markup; HtmlM -> MarkupM; AddCustomAttribute has an additional first argument import Text.Blaze(Markup) import Text.Blaze.Internal(MarkupM(..),ChoiceString(..),StaticString(..)) import Data.Char@@ -73,7 +72,7 @@ truncateHtml :: Int -- ^ The amount of characters (not counting tags) which the truncated text should have at most -> Markup -- ^ The HTML to truncate -> Maybe Markup -- ^ `Just` the truncated HTML or `Nothing` if no truncation occured-truncateHtml n html = case go n html of Tagged n' html' -> if n' /= n then Just html' else Nothing+truncateHtml n html = case go n html of Tagged n' html' -> if n' <= 0 then Just html' else Nothing where go :: Int -> MarkupM b -> Tagged (MarkupM b) go i (Parent t open close content) = fmap (Parent t open close) (go i content)@@ -172,6 +171,5 @@ truncateChoiceString i str = case splitAt' i str of (str',rst) -> if (empty' rst) || (isSpace $ head' rst) then Tagged (i - (length' str')) str'--- else Tagged (i - (length' str')) str' else case dropWhileEnd' (not. isSpace) (dropWhileEnd' isSpace str') of str'' -> Tagged (i - length' str'') str''
blaze-html-truncate.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: blaze-html-truncate-version: 0.2.0.0+version: 0.2.0.1 synopsis: A truncator for blaze-html description: This package provides a simple function to truncate HTML, preserving tags and preventing cut-off words. homepage: http://github.com/mruegenberg/blaze-html-truncate