module Text.LaTeX.LambdaTeX.Selection where
import Control.Monad (when)
import qualified Data.Text as T
import Text.LaTeX.LambdaTeX.Selection.Internal
import Text.LaTeX.LambdaTeX.Selection.Types
import Text.LaTeX.LambdaTeX.Types
constructSelection :: String -> Selection
constructSelection = map constructSelector . words
constructSelector :: String -> Selector
constructSelector "all" = All
constructSelector ('+':s) = Match $ map T.pack $ split s
constructSelector ('-':s) = Ignore $ map T.pack $ split s
constructSelector s = Match $ map T.pack $ split s
note :: Monad m => Text -> ΛTeXT m () -> ΛTeXT m ()
note partname func =
inPart partname $ do
s <- isSelected
when s func