linebreak 1.1.0.1 → 1.1.0.2
raw patch · 4 files changed
+13/−6 lines, 4 files
Files
- CHANGES +3/−0
- linebreak.cabal +4/−4
- src/Text/LineBreak.hs +2/−1
- test/hspec.hs +4/−1
CHANGES view
@@ -1,3 +1,6 @@+next:+- bump hspec+ 1.1.0.1: - Bump hspec
linebreak.cabal view
@@ -1,5 +1,5 @@ name: linebreak-version: 1.1.0.1+version: 1.1.0.2 synopsis: breaks strings to fit width description: Simple functions to break a String to fit a maximum text width, using Knuth-Liang hyphenation algorhitm.@@ -15,8 +15,8 @@ extra-source-files: CHANGES source-repository head- type: darcs- location: http://www.ariis.it/link/repos/linebreak/+ type: git+ location: https://gitlab.com/fffaaa/linebreak library -- Modules exported by the library.@@ -36,6 +36,6 @@ build-depends: base == 4.*, hyphenation >= 0.8 && < 1 -- same as above, plus hspec- , hspec >= 2.5 && < 2.10+ , hspec >= 2.5 && < 2.11 type: exitcode-stdio-1.0 ghc-options: -Wall
src/Text/LineBreak.hs view
@@ -77,7 +77,7 @@ bfHyphenSymbol :: Char, bfHyphenator :: Maybe Hyphenator } -data BrState = BrState { bsCurrCol :: Int, -- current column+data BrState = BrState { _bsCurrCol :: Int, -- current column bsBroken :: String } -- output string data Element = ElWord String -- things we need to place@@ -125,6 +125,7 @@ parseWS ws = case span (/= '\n') ws of (a, "") -> [elspace a False] -- no newlines (a, '\n':rs) -> elspace a True : parseWS rs+ _ -> error "parseWS: non-exhaustive pattern" where elspace cs b = ElSpace (length cs) b parseWord :: String -> Element
test/hspec.hs view
@@ -9,7 +9,7 @@ bf = BreakFormat 25 4 '-' hyp testBr :: String -> String-testBr = breakString bf+testBr s = breakString bf s myUnlines :: [String]-> [Char] myUnlines = init . unlines -- unlines adds an extra "\n" ad end-of-string@@ -87,6 +87,9 @@ it "should wrap (but not hyphenate long words)" $ tinyBr tinywd `shouldBe` tinywdout + let bf10 = bf { bfMaxCol = 8 }+ xit "should respect non-breaking space" $+ breakStringLn bf10 "ada la\x00a0mamma" `shouldBe` ["ada", "la mamma"] describe "Text.Linebreak.breakStringLn" $ do