@@ 79,14 79,17 @@ instance Line a => Paginable [a] where
-- | Implementation of paginating a plain text paragraph layout.
-- Breaks the layout on page boundaries and automatically adjusts coordinates.
instance Paginable (Plain.ParagraphLayout d) where
- paginate opts pl = case paginate opts (cutLines pl) of
- (c, p, Nothing) -> (c, mergeLines p, Nothing)
- (c, p, Just rest) -> (c, mergeLines p, Just (mergeLines rest))
+ paginate = paginateLayout
-- | Implementation of paginating a rich text paragraph layout.
-- Breaks the layout on page boundaries and automatically adjusts coordinates.
instance Paginable (Rich.ParagraphLayout d) where
- paginate opts pl = case paginate opts (cutLines pl) of
+ paginate = paginateLayout
+
+paginateLayout :: (Line a, GenericLayout a) =>
+ PageOptions -> a -> (PageContinuity, a, Maybe a)
+paginateLayout opts pl =
+ case paginate opts (cutLines pl) of
(c, p, Nothing) -> (c, mergeLines p, Nothing)
(c, p, Just rest) -> (c, mergeLines p, Just (mergeLines rest))
@@ 1,6 1,7 @@
-- | Splitting paragraph layouts between lines.
module Data.Text.ParagraphLayout.Internal.ParagraphLine
- ( cutLines
+ ( GenericLayout
+ , cutLines
, mergeLines
)
where