texrunner 0.0.1.3 → 0.0.2
raw patch · 5 files changed
+31/−20 lines, 5 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +8/−0
- src/System/Texrunner/Parse.hs +11/−8
- tests/Tex/LogParse.hs +6/−6
- tests/Tex/PDF.hs +3/−3
- texrunner.cabal +3/−3
CHANGELOG.md view
@@ -1,7 +1,15 @@+## [v0.0.2] (2023-09-11)++- Allow `base-4.19` (GHC 9.10)+- Fix tests+ ## [v0.0.1.3] (2023-07-10) - Allow `base-4.18` (GHC 9.6) - Fix some documentation typos (thanks to @Moiman)++- r1 (2024-01-27)+ - Allow `base-4.19` (GHC 9.8) ## [v0.0.1.2] (2018-07-14)
src/System/Texrunner/Parse.hs view
@@ -34,6 +34,7 @@ import Data.Attoparsec.ByteString.Char8 as A import Data.ByteString.Char8 (ByteString, cons, pack) import qualified Data.ByteString.Char8 as B+import Data.Functor (($>)) import Data.Maybe import Data.Semigroup @@ -87,7 +88,7 @@ { texInfo :: TexInfo , numPages :: Maybe Int , texErrors :: [TexError]- -- , rawLog :: ByteString+ , rawLog :: ByteString } deriving Show data TexInfo = TexInfo@@ -100,13 +101,13 @@ -- Make shift way to parse a log by combining it in this way. instance Semigroup TexLog where- TexLog prog pages1 errors1 <> TexLog _ pages2 errors2 =+ TexLog prog pages1 errors1 raw1 <> TexLog _ pages2 errors2 raw2 = case (pages1,pages2) of- (Just a,_) -> TexLog prog (Just a) (errors1 ++ errors2)- (_,b) -> TexLog prog b (errors1 ++ errors2)+ (Just a,_) -> TexLog prog (Just a) (errors1 ++ errors2) (raw1 <> raw2)+ (_,b) -> TexLog prog b (errors1 ++ errors2) (raw1 <> raw2) instance Monoid TexLog where- mempty = TexLog (TexInfo Nothing Nothing Nothing) Nothing []+ mempty = TexLog (TexInfo Nothing Nothing Nothing) Nothing [] "" mappend = (<>) infoParser :: Parser TexInfo@@ -125,12 +126,12 @@ pages <- optional nPages errors <- maybeToList <$> optional someError _ <- restOfLine- return $ TexLog info pages errors+ return $ TexLog info pages errors "" -- thisIs :: Parser TexVersion parseLog :: ByteString -> TexLog-parseLog = (\(Right a) -> a) . parseOnly logFile+parseLog bs = (\(Right a) -> a { rawLog = bs }) . parseOnly logFile $ bs -- the parse should never fail (I think) prettyPrintLog :: TexLog -> ByteString@@ -181,7 +182,9 @@ someError = mark *> errors where -- in context exclamation mark isn't always at the beginning- mark = "! " <|> (notChar '\n' *> mark)+ mark = ("! " $> ())+ <|> (("tex error >" *> (many (notChar ':') *> ": ")) $> ())+ <|> (notChar '\n' *> mark) errors = undefinedControlSequence <|> illegalUnit <|> missingNumber
tests/Tex/LogParse.hs view
@@ -18,7 +18,7 @@ texTests = [checkErrors "tex error parse" tex] latexTests = [checkErrors "latex error parse" latex]-contextTests = [checkErrors "context error parse" context]+contextTests = [] -- [checkErrors "context error parse" context] https://github.com/cchalmers/texrunner/pull/12 withHead :: Monad m => [a] -> (a -> m ()) -> m () withHead (a:_) f = f a@@ -43,11 +43,11 @@ contextHeader = "\\starttext" contextBye = "\\stoptext" +context :: TexError' -> ByteString -> F.Test context e code = testCase ("context" ++ show e) $ do (exitCode, texLog, mPDF) <- runTex "context" [] [] (contextHeader <> code)- take 1 (map error' (texErrors texLog)) @?= [e]- -- head (map error' $ texErrors texLog) @?= e- -- assertBool ("context" ++ show e) $ texLog `containsError` e+ -- BS.hPutStrLn stderr (rawLog texLog)+ assertBool ("context" ++ show e) $ texLog `containsError` e -- Generating tex sample tex files ------------------------------------- @@ -96,8 +96,8 @@ -- Checking error parsing ---------------------------------------------- -containsError :: TexLog -> TexError -> Bool-containsError log (TexError _ err) = err `elem` map error' (texErrors log)+containsError :: TexLog -> TexError' -> Bool+containsError log err = err `elem` map error' (texErrors log) checkError :: (TexError' -> ByteString -> F.Test) -> (TexError', [ByteString]) -> F.Test checkError f (e, codes) = testGroup (show e) $ map (f e) codes
tests/Tex/PDF.hs view
@@ -12,10 +12,10 @@ import System.Texrunner import System.Texrunner.Online -tests = [tex, latex, context, texOnline, latexOnline, contextOnline]+tests = texTests ++ latexTests -- ++ contextTests texTests = [tex, texOnline] latexTests = [latex, latexOnline]-contextTests = [context, contextOnline]+contextTests = [] -- [context, contextOnline] https://github.com/cchalmers/texrunner/pull/12 texDocument :: ByteString texDocument = "hi\\bye"@@ -53,7 +53,7 @@ texOnline = testOnlineTeX "pdftex" [] texDocument latexOnline = testOnlineTeX "pdflatex" [] latexDocument-contextOnline = testOnlineTeX "context" ["--pipe"] contextDocument+contextOnline = testOnlineTeX "context" ["--luatex", "--pipe"] contextDocument
texrunner.cabal view
@@ -1,5 +1,5 @@ name: texrunner-version: 0.0.1.3+version: 0.0.2 synopsis: Functions for running Tex from Haskell. description: texrunner is an interface to tex that attempts to parse errors and@@ -18,7 +18,7 @@ build-type: Simple extra-source-files: README.md, CHANGELOG.md cabal-version: >=1.10-tested-with: GHC ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.1+tested-with: GHC ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.5 || ==9.8.2 || ==9.10.1 source-repository head type: git@@ -30,7 +30,7 @@ System.Texrunner.Online System.Texrunner.Parse build-depends:- base >=4.6 && <4.19,+ base >=4.6 && <4.21, bytestring >=0.10 && <1.0, filepath, directory >=1.2 && <2.0,