~jaro/balkon

993ff05dc40abc69c4dbbd1fd3d9890460430323 — Jaro 1 year, 8 months ago 01147c0
Fix style: bullet points in comments.
M src/Data/Text/ParagraphLayout/Internal/LinePagination.hs => src/Data/Text/ParagraphLayout/Internal/LinePagination.hs +2 -2
@@ 7,8 7,8 @@
--
-- Assumptions:
--
-- * Lines are laid out from top to bottom.
-- * Each page has the same size.
-- - Lines are laid out from top to bottom.
-- - Each page has the same size.
--   (Preceding context may limit the space available on the given page, but it
--   is assumed that the space on every following page can be used in full.)
module Data.Text.ParagraphLayout.Internal.LinePagination

M src/Data/Text/ParagraphLayout/Internal/Paginable.hs => src/Data/Text/ParagraphLayout/Internal/Paginable.hs +4 -4
@@ 41,19 41,19 @@ class Paginable pl where
    --
    -- Explanation of return values:
    --
    -- * @(`Continue`, p, `Nothing`)@
    -- - @(`Continue`, p, `Nothing`)@
    --   means that @p@ is the entire layout and fits best on the current page.
    --
    -- * @(`Break`, p, `Nothing`)@
    -- - @(`Break`, p, `Nothing`)@
    --   means that @p@ is the entire layout and fits best on a new page.
    --   In other words, @p@ should be preceded by a page break.
    --
    -- * @(`Continue`, p, `Just` rest)@
    -- - @(`Continue`, p, `Just` rest)@
    --   means that @p@ is a part of the layout that fits best on the current
    --   page, and @rest@ should be passed to this function again.
    --   In other words, @p@ should be followed by a page break.
    --
    -- * @(`Break`, p, `Just` rest)@
    -- - @(`Break`, p, `Just` rest)@
    --   means that @p@ is a part of the layout that fits best on a new page,
    --   and @rest@ should be passed to this function again.
    --   In other words, @p@ should be surrounded by page breaks

M test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs => test/Data/Text/ParagraphLayout/Internal/LinePaginationSpec.hs +16 -16
@@ 52,12 52,12 @@ spec = do
            let ls = tenLines
            let page = bestSplit 3 4
            -- Acceptable page breaks:
            --  *  0 + 10
            --  *  3 +  7
            --  *  4 +  6
            --  *  5 +  5
            --  *  6 +  4
            --  * 10 +  0
            --  -  0 + 10
            --  -  3 +  7
            --  -  4 +  6
            --  -  5 +  5
            --  -  6 +  4
            --  - 10 +  0

            ([0, 10, 15, 25] :: [Int32]) `forM_` \h ->
                it ("maxHeight = " ++ show h ++ " ensures 3 orphans") $


@@ 88,9 88,9 @@ spec = do
            let ls = tenLines
            let page = bestSplit 6 4
            -- Acceptable page breaks:
            --  *  0 + 10
            --  *  6 +  4
            --  * 10 +  0
            --  -  0 + 10
            --  -  6 +  4
            --  - 10 +  0

            ([0, 10, 15, 35, 50, 55] :: [Int32]) `forM_` \h ->
                it ("maxHeight = " ++ show h ++ " ensures 6 orphans") $


@@ 111,8 111,8 @@ spec = do
            let ls = tenLines
            let page = bestSplit 6 5
            -- Acceptable page breaks:
            --  *  0 + 10
            --  * 10 +  0
            --  -  0 + 10
            --  - 10 +  0

            ([0, 10, 60, 65, 85, 95] :: [Int32]) `forM_` \h ->
                it ("maxHeight = " ++ show h ++ " puts all in second list") $


@@ 193,11 193,11 @@ spec = do
            let ls = tenLines
            let page = paginateLines 5 3
            -- Acceptable page breaks:
            --  *  0 + 10
            --  *  5 +  5
            --  *  6 +  4
            --  *  7 +  3
            --  * 10 +  0
            --  -  0 + 10
            --  -  5 +  5
            --  -  6 +  4
            --  -  7 +  3
            --  - 10 +  0

            it "puts all lines on current page if possible" $
                page 200 200 ls `shouldBe`

M test/Data/Text/ParagraphLayout/ParagraphData.hs => test/Data/Text/ParagraphLayout/ParagraphData.hs +5 -5
@@ 100,11 100,11 @@ devanagariPrefixedAccentParagraph = "#" |< zxx "\x954" >| ""

-- | Test hard line breaks with Latin characters:
--
-- * after a short line (no soft line breaks needed),
-- * after a longer line (soft line breaks needed),
-- * after a long word (line break in the middle of a word needed),
-- * after spaces,
-- * after other line breaks.
-- - after a short line (no soft line breaks needed),
-- - after a longer line (soft line breaks needed),
-- - after a long word (line break in the middle of a word needed),
-- - after spaces,
-- - after other line breaks.
hardBreaksLTRParagraph :: ParagraphOptions -> Paragraph
hardBreaksLTRParagraph = "x" |< zxx "jjjjjj\njjjjjj jjjjjj jjjjjj\nmmmmmm \njjjjjj\n\nmm mm mm" >| ""