From 18e994081f0919013b51e3d73cf58022fed3ee6c Mon Sep 17 00:00:00 2001 From: Jaro Date: Wed, 8 Mar 2023 02:35:26 +0100 Subject: [PATCH] Expose ParagraphConstruction. --- balkon.cabal | 3 ++- .../ParagraphLayout/ParagraphConstruction.hs | 17 +++++++++++++++++ .../Internal}/ParagraphConstruction.hs | 13 +++---------- 3 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 lib/Data/Text/ParagraphLayout/ParagraphConstruction.hs rename {test/Data/Text/ParagraphLayout => src/Data/Text/ParagraphLayout/Internal}/ParagraphConstruction.hs (82%) diff --git a/balkon.cabal b/balkon.cabal index 9e6b383..6de73a3 100644 --- a/balkon.cabal +++ b/balkon.cabal @@ -98,6 +98,7 @@ library balkon-internal Data.Text.ParagraphLayout.Internal.Break, Data.Text.ParagraphLayout.Internal.Fragment, Data.Text.ParagraphLayout.Internal.LineHeight, + Data.Text.ParagraphLayout.Internal.ParagraphConstruction, Data.Text.ParagraphLayout.Internal.Plain, Data.Text.ParagraphLayout.Internal.Rect, Data.Text.ParagraphLayout.Internal.ResolvedSpan, @@ -127,6 +128,7 @@ library -- Modules exported by the library. exposed-modules: Data.Text.ParagraphLayout, + Data.Text.ParagraphLayout.ParagraphConstruction, Data.Text.ParagraphLayout.Rect -- Other library packages from which modules are imported. @@ -153,7 +155,6 @@ test-suite balkon-test Data.Text.ParagraphLayout.Internal.RunSpec, Data.Text.ParagraphLayout.Internal.TextContainerSpec, Data.Text.ParagraphLayout.Internal.ZipperSpec, - Data.Text.ParagraphLayout.ParagraphConstruction, Data.Text.ParagraphLayout.ParagraphData, Data.Text.ParagraphLayout.RectSpec, Data.Text.ParagraphLayout.SpanData diff --git a/lib/Data/Text/ParagraphLayout/ParagraphConstruction.hs b/lib/Data/Text/ParagraphLayout/ParagraphConstruction.hs new file mode 100644 index 0000000..d755dca --- /dev/null +++ b/lib/Data/Text/ParagraphLayout/ParagraphConstruction.hs @@ -0,0 +1,17 @@ +-- | Infix operators for construction of paragraphs with readable code. +-- +-- Example construction: +-- @"ignored prefix" |\< "en"~"one two " \>|\< "ja"~"三四" \>| "ignored suffix"@ +-- +-- Special syntax for paragraphs with no contents: +-- @"ignored prefix" |<>| "ignored suffix"@ +module Data.Text.ParagraphLayout.ParagraphConstruction + ((>|) + ,(>|<) + ,(|<) + ,(|<>|) + ,(~) + ) +where + +import Data.Text.ParagraphLayout.Internal.ParagraphConstruction diff --git a/test/Data/Text/ParagraphLayout/ParagraphConstruction.hs b/src/Data/Text/ParagraphLayout/Internal/ParagraphConstruction.hs similarity index 82% rename from test/Data/Text/ParagraphLayout/ParagraphConstruction.hs rename to src/Data/Text/ParagraphLayout/Internal/ParagraphConstruction.hs index 6530265..f586f0a 100644 --- a/test/Data/Text/ParagraphLayout/ParagraphConstruction.hs +++ b/src/Data/Text/ParagraphLayout/Internal/ParagraphConstruction.hs @@ -1,11 +1,4 @@ --- | Infix operators for construction of paragraphs with readable code. --- --- Example construction: --- @"ignored prefix" |< "en"~"one two " >|< "ja"~"三四" >| "ignored suffix"@ --- --- Special syntax for paragraphs with no contents: --- @"ignored prefix" |<>| "ignored suffix"@ -module Data.Text.ParagraphLayout.ParagraphConstruction +module Data.Text.ParagraphLayout.Internal.ParagraphConstruction ((>|) ,(>|<) ,(|<) @@ -20,11 +13,11 @@ import Data.Text.Internal (Text(Text)) import Data.Text.Internal.Lazy (chunk, empty) import qualified Data.Text.Internal.Lazy as Lazy import Data.Text.Lazy (toStrict) -import Data.Text.ParagraphLayout +import Data.Text.ParagraphLayout.Internal.Plain (Paragraph(Paragraph) ,ParagraphOptions - ,Span(Span) ) +import Data.Text.ParagraphLayout.Internal.Span (Span(Span)) -- | Create first span with optional ignored suffix. infixr 5 >| -- 2.30.2