HaTeX-qq 0.0.1.0 → 0.0.1.1
raw patch · 3 files changed
+18/−22 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Changelog.md +9/−0
- HaTeX-qq.cabal +1/−1
- src/Text/LaTeX/QQ.hs +8/−21
Changelog.md view
@@ -1,6 +1,15 @@ Changelog ========= +0.0.1.1+-------+Stopped triming spaces deeply.++0.0.1.0+--------+* Added `Text.LaTeX.Utils` module.+ * providing `stripTeX`, `stripTeXL` and `strinpTeXR`.+ 0.0.0.0 -------- Initial release.
HaTeX-qq.cabal view
@@ -1,5 +1,5 @@ name: HaTeX-qq-version: 0.0.1.0+version: 0.0.1.1 synopsis: Quasiquoters for HaTeX description: Quasiquoters for HaTeX license: BSD3
src/Text/LaTeX/QQ.hs view
@@ -3,10 +3,10 @@ {-# LANGUAGE OverloadedStrings, StandaloneDeriving, TemplateHaskell #-} module Text.LaTeX.QQ (hat, hat', mkHaTeXQQ) where import Text.LaTeX.QQ.Orphans ()+import Text.LaTeX.Utils (stripTeX) import Control.Monad ((<=<)) import Data.Data (Typeable)-import Data.Generics.Uniplate.Direct (transform) import qualified Data.Text as T import Language.Haskell.AntiQuoter (AntiQuoterPass, (<>>)) import Language.Haskell.Meta.Parse.Careful (parseExp, parsePat)@@ -30,27 +30,29 @@ hat = mkHaTeXQQ "hask" False -- | Whitespace-insensitive version of 'hat'.--- Pattern quote requires @ViewPatterns@ in addition.+-- This ignores whtiespace at both sides,+-- but not deeper inside because this might break+-- Math spacing.+-- Pattern quote requires @ViewPatterns@ in addition. -- -- Since 0.0.0.0 hat' :: QuasiQuoter hat' = mkHaTeXQQ "hask" True -- | General macro to generate quasiquoter for HaTeX.--- You need @OverloadedStrings@ for pattern quotes,--- and if the second argument is @True@, you also need @ViewPatterns@.+-- If the second argument is @True@, you also need @ViewPatterns@. -- -- NOTE: Due to TH's stage restriction, you have to use this function -- in an other module than you call the resulting quasiquotes. -- -- Since 0.0.0.0 mkHaTeXQQ :: String -- ^ Name for antiquoting latex command.- -> Bool -- ^ Ignore whitespaces?+ -> Bool -- ^ Ignore whitespaces at both sides? (see 'hat'') -> QuasiQuoter mkHaTeXQQ cmd triming = let trimer | triming = trim | otherwise = id- texTrimer | triming = viewP [| trimTeX |]+ texTrimer | triming = viewP [| stripTeX |] | otherwise = id in QuasiQuoter { quoteType = const $ error "Type quoter not defined" , quoteDec = const $ error "Dec quoter not defined"@@ -86,21 +88,6 @@ antiTextP :: T.Text -> Maybe PatQ antiTextP = Just . litP . stringL . T.unpack--trimTeX :: LaTeX -> LaTeX-trimTeX = transform trimTeX0--trimTeX0 :: LaTeX -> LaTeX-trimTeX0 (TeXComment _) = TeXEmpty-trimTeX0 (TeXRaw t) =- let t' = T.strip t- in if T.null t'- then TeXEmpty- else TeXRaw t'-trimTeX0 TeXEmpty = TeXEmpty-trimTeX0 (TeXSeq TeXEmpty r) = r-trimTeX0 (TeXSeq l TeXEmpty) = l-trimTeX0 t = t antiP0 :: String -> LaTeX -> Maybe PatQ antiP0 cmd (TeXComm name [FixArg src]) | cmd == name =