texbuilder 0.1.2.0 → 0.1.3.0
raw patch · 4 files changed
+26/−8 lines, 4 files
Files
- ChangeLog.md +5/−0
- Main.hs +6/−0
- TexBuilder/TexBuilder.hs +13/−7
- texbuilder.cabal +2/−1
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for tex-builder +0.1.3.0+---+* Add new option to force an initial compile run.+* Enforce threaded runtime in cabal file, fixing problems with e.g. the nix build, which is single threaded by default.+ 0.1.2.0 --- * Avoid calling external executables by hard coded path,
Main.hs view
@@ -26,6 +26,7 @@ <*> fileTypesOpt <*> depthOpt <*> (statefulFlag <|> persistFlag <|> pure Pure)+ <*> forcedFlag -- <*> watchOpt <*> engineOption <*> nolatexmkFlag@@ -70,6 +71,11 @@ <> help "Run in persistent mode, using the main directory\ \ for building. If the state gets messed up, YOU\ \ will have to fix it.")++forcedFlag :: Parser Forced+forcedFlag = Forced <$> switch+ ( long "forced"+ <> help "Run in forced mode, doing an intial compile run, even if a pdf file is already present. ") -- | not yet ready watchOpt :: Parser String
TexBuilder/TexBuilder.hs view
@@ -1,6 +1,7 @@ module TexBuilder.TexBuilder ( texBuilder , StatePolicy(..)+ , Forced(..) , UseEngine(..) , UseLatexMk(..) ) where@@ -37,11 +38,14 @@ data StatePolicy = Pure | Stateful | Persistent +newtype Forced = Forced Bool+ texBuilder :: FilePath -> Maybe FilePath -> Exts -> Natural -> StatePolicy+ -> Forced -> UseEngine -> UseLatexMk -> Natural@@ -49,7 +53,7 @@ -> IO () texBuilder texfile mbPdfFile exts depth statePolicy- useEngine useLatexmk nrecomp extraArgs+ forced useEngine useLatexmk nrecomp extraArgs = do engine <- chooseEngine useEngine useLatexmk let runRaw = compile engine nrecomp texfile pdffile extraArgs@@ -57,7 +61,7 @@ $ \run -> do assertFileEx texfile -- ^ Assert that the tex file exists- initialCompile pdffile run+ initialCompile forced pdffile run -- ^ Do an initial compile run if appropriate sem <- newBinSem -- ^ Signaling semaphore connecting the threads@@ -83,11 +87,13 @@ pdffile = fromMaybe (texfile -<.> "pdf") mbPdfFile -initialCompile :: FilePath -> IO PP.Doc -> IO () -initialCompile pdffile run =- unlessM (doesFileExist pdffile) $ do- putStrLn "No ouput file detected, compiling."- run >>= PP.putDoc+initialCompile :: Forced -> FilePath -> IO PP.Doc -> IO () +initialCompile (Forced f) pdffile run+ | f = comp "Initial compilation forced, compiling."+ | True = unlessM (doesFileExist pdffile)+ $ comp "No ouput file detected, compiling."+ where+ comp msg = putStrLn msg >> run >>= PP.putDoc listSourceFiles :: Natural -> FilePath
texbuilder.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: texbuilder-version: 0.1.2.0+version: 0.1.3.0 synopsis: View your latex output while editing description: This program allows you to view your latex document in your pdf viewer while @@ -61,6 +61,7 @@ -- hs-source-dirs: default-language: Haskell2010+ ghc-options: -threaded source-repository head type: git