HaTeX-qq 0.0.0.0 → 0.0.1.0
raw patch · 2 files changed
+44/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.LaTeX.Utils: stripTeX :: LaTeX -> LaTeX
+ Text.LaTeX.Utils: stripTeXL :: LaTeX -> LaTeX
+ Text.LaTeX.Utils: stripTeXR :: LaTeX -> LaTeX
Files
- HaTeX-qq.cabal +2/−2
- src/Text/LaTeX/Utils.hs +42/−0
HaTeX-qq.cabal view
@@ -1,5 +1,5 @@ name: HaTeX-qq-version: 0.0.0.0+version: 0.0.1.0 synopsis: Quasiquoters for HaTeX description: Quasiquoters for HaTeX license: BSD3@@ -17,7 +17,7 @@ location: git://github.com/konn/HaTeX-qq.git library- exposed-modules: Text.LaTeX.QQ+ exposed-modules: Text.LaTeX.QQ Text.LaTeX.Utils other-modules: Text.LaTeX.QQ.Orphans other-extensions: TemplateHaskell OverloadedStrings build-depends: base >= 4 && <5,
+ src/Text/LaTeX/Utils.hs view
@@ -0,0 +1,42 @@+-- | Since 0.0.1.0+module Text.LaTeX.Utils (stripTeX, stripTeXR, stripTeXL) where+import Data.Monoid ((<>))+import qualified Data.Text as T+import Text.LaTeX.Base.Syntax (LaTeX (..))++-- | Strip whitespaces on both sides of LaTeX.+--+-- Since 0.0.1.0+stripTeX :: LaTeX -> LaTeX+stripTeX = stripTeXL . stripTeXR++-- | Strip whitespaces on the left side of LaTeX.+--+-- Since 0.0.1.0+stripTeXL :: LaTeX -> LaTeX+stripTeXL (TeXRaw str) =+ let str' = T.stripStart str+ in if T.null str'+ then TeXEmpty+ else TeXRaw str'+stripTeXL (TeXSeq l r) =+ case stripTeXL l of+ TeXEmpty -> stripTeXL r+ l' -> l' <> r+stripTeXL l = l++-- | Strip whitespaces on the right side of LaTeX.+--+-- Since 0.0.1.0+stripTeXR :: LaTeX -> LaTeX+stripTeXR (TeXRaw str) =+ let str' = T.stripEnd str+ in if T.null str'+ then TeXEmpty+ else TeXRaw str'+stripTeXR (TeXSeq l r) =+ case stripTeXR r of+ TeXEmpty -> stripTeXR l+ r' -> l <> r'+stripTeXR l = l+