hatex-guide 1.0.1.6 → 1.1.0.0
raw patch · 9 files changed
+90/−26 lines, 9 filesdep ~HaTeXsetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: HaTeX
API changes (from Hackage documentation)
+ Text.LaTeX.Guide: otherResources :: [String]
+ Text.LaTeX.Guide: updateGuide :: FilePath -> IO ()
Files
- Setup.hs +3/−8
- Text/LaTeX/Guide.hs +4/−0
- Text/LaTeX/Guide/Auto.hs +10/−10
- Text/LaTeX/Guide/Backend/LaTeX.hs +18/−2
- Text/LaTeX/Guide/Info.hs +3/−1
- Text/LaTeX/Guide/Update.hs +38/−0
- hatex-guide.cabal +3/−2
- src/basics.htxg +5/−2
- src/epilogue.htxg +6/−1
Setup.hs view
@@ -4,7 +4,7 @@ , getAppUserDataDirectory , createDirectoryIfMissing )-import Text.LaTeX.Guide.Info (sectionList,otherResources)+import Text.LaTeX.Guide.Update import System.FilePath ((</>),(<.>)) import Control.Applicative ((<$>)) -- Cabal@@ -17,13 +17,8 @@ main :: IO () main = do- d <- getAppUserDataDirectory "hatex-guide"- createDirectoryIfMissing True $ d </> "src"- createDirectoryIfMissing True $ d </> "res"- mapM_ (\s -> let fp = "src" </> s <.> "htxg"- in copyFile fp $ d </> fp) sectionList- mapM_ (\r -> let fp = "res" </> r- in copyFile fp $ d </> fp) otherResources+ -- Update (create if missing) guide files+ updateGuide "." -- Write aux module let dg = "Text" </> "LaTeX" </> "Guide" createDirectoryIfMissing True dg
Text/LaTeX/Guide.hs view
@@ -17,12 +17,16 @@ , writeGuide -- * Info , sectionList+ , otherResources , contributors , guideVersion+ -- * Editing+ , updateGuide ) where import Text.LaTeX.Guide.Info import Text.LaTeX.Guide.Auto (guideVersion)+import Text.LaTeX.Guide.Update import qualified Text.LaTeX.Guide.Backend.LaTeX as LaTeX import qualified Text.LaTeX.Guide.Backend.Wiki as Wiki
Text/LaTeX/Guide/Auto.hs view
@@ -1,10 +1,10 @@--- | Automatically generated module. -module Text.LaTeX.Guide.Auto ( - guideVersion - ) where - -import Data.Version - --- | The version of the guide. Based on the version of the package. -guideVersion :: Version -guideVersion = Version [1,0,1,6] [] +-- | Automatically generated module.+module Text.LaTeX.Guide.Auto (+ guideVersion+ ) where++import Data.Version++-- | The version of the guide. Based on the version of the package.+guideVersion :: Version+guideVersion = Version [1,1,0,0] []
Text/LaTeX/Guide/Backend/LaTeX.hs view
@@ -16,6 +16,8 @@ import Text.LaTeX.Packages.Inputenc import Text.LaTeX.Packages.AMSMath import Text.LaTeX.Packages.Babel+import Text.LaTeX.Packages.Fontenc+import Text.LaTeX.Packages.Fancyhdr import Data.Version (showVersion,versionBranch) import Data.Text (unpack) import Data.Text.IO@@ -38,7 +40,7 @@ hatexSyntax fp (Italic s) = textit $ hatexSyntax fp s hatexSyntax _ (Code b t) = let f = if b then texttt . raw . protectText else quote . verbatim- c = ModColor $ RGB255 50 50 255+ c = ModColor $ RGB255 156 62 0 in color c <> f t <> normalcolor hatexSyntax _ (URL t) = let u = createURL $ unpack t in url u@@ -53,6 +55,10 @@ forwardSlashes :: String -> String forwardSlashes = fmap $ \c -> if c == '\\' then '/' else c +-- Space between paragraphs+parSpace :: Measure+parSpace = In 0.15+ thePreamble :: LaTeX thePreamble = documentclass [a4paper] article@@ -61,9 +67,19 @@ <> usepackage [] hyperref <> usepackage [] graphicx <> usepackage [] pcolor+ <> usepackage ["textwidth=6in"] "geometry" <> title ("The " <> hatex <> " User's Guide") <> author (raw "Daniel D\\'iaz")- <> linespread 1.4+ <> linespread 1.2+ <> usepackage [] "mathptmx"+ -- <> raw "\\renewcommand{\\rmdefault}{pbk}"+ <> raw ("\\setlength{\\parskip}{" <> render parSpace <> "}")+ <> applyHdrSettings hdrSettings++hdrSettings :: HdrSettings+hdrSettings = defaultHdrSettings+ { centerHeader = "The " <> hatex <> " User's Guide"+ } theTitle :: LaTeX theTitle = let xs = versionBranch version in flushright (
Text/LaTeX/Guide/Info.hs view
@@ -39,6 +39,8 @@ outputName :: String -> FilePath outputName = mappend "hatex-guide" --- |+-- | Other resources (images).+--+-- Files stored under the /res/ directory. otherResources :: [String] otherResources = [ "machine.png" ]
+ Text/LaTeX/Guide/Update.hs view
@@ -0,0 +1,38 @@++module Text.LaTeX.Guide.Update (+ updateGuide+ ) where++import System.Directory (+ getCurrentDirectory+ , setCurrentDirectory+ , createDirectoryIfMissing+ , getAppUserDataDirectory+ , copyFile+ )+import System.FilePath ((</>),(<.>))+import Text.LaTeX.Guide.Info (sectionList,otherResources)++-- | Update files in the user /hatex-guide/ directory, using+-- the files contained in a given 'FilePath'.+--+-- More in detail, @updateGuide fp@ sets the current directory+-- to @fp@, then it looks in the @src@ and @res@ directories+-- for the files specified by 'sectionList' and 'otherResources'+-- respectively. Then, it copies these files overwriting those+-- in the user /hatex-guide/ directory. This way, the next time+-- that 'writeGuide' is called it will use the updated files.+updateGuide :: FilePath -> IO ()+updateGuide fp = do+ d0 <- getCurrentDirectory+ setCurrentDirectory fp+ appd <- getAppUserDataDirectory "hatex-guide"+ putStrLn "Updating 'src'..."+ createDirectoryIfMissing True $ appd </> "src"+ mapM_ (\s -> let d = "src" </> s <.> "htxg"+ in copyFile d $ appd </> d) sectionList+ putStrLn "Updating 'res'..."+ createDirectoryIfMissing True $ appd </> "res"+ mapM_ (\r -> let d = "res" </> r+ in copyFile d $ appd </> d) otherResources+ setCurrentDirectory d0
hatex-guide.cabal view
@@ -1,5 +1,5 @@ Name: hatex-guide-Version: 1.0.1.6+Version: 1.1.0.0 Author: Daniel Díaz Build-type: Custom Category: LaTeX@@ -35,7 +35,7 @@ Library Build-depends: base == 4.*- , HaTeX == 3.6.*+ , HaTeX >= 3.7.0.0 && < 3.8.0.0 , text == 0.11.* , filepath , parsec >= 3.1.2 && < 3.2@@ -46,5 +46,6 @@ Text.LaTeX.Guide.Auto Text.LaTeX.Guide.Syntax Text.LaTeX.Guide.Info+ Text.LaTeX.Guide.Update Text.LaTeX.Guide.Backend.LaTeX Text.LaTeX.Guide.Backend.Wiki
src/basics.htxg view
@@ -141,8 +141,8 @@ <> author "John Short" <> document (maketitle <> "This is all.") \]-Then, after call \{renderFile "short.tex" short\} it appears the following file-in the current working directory (line formatting added for easier visualization):+Then, after calling \{renderFile "short.tex" short\}, the following file appears+in the current working directory (line breaks added for easier visualization): \[ \documentclass{article} \title{A short message}@@ -152,6 +152,9 @@ This is all \end{document} \]+Finally, you may use commands like \{latex\} or \{pdflatex\} to compile the \latex+output to dvi or pdf.+ The function \{renderFile\} is not only for \{LaTeX\} values. Let's see its type: \[ renderFile :: Render a => FilePath -> a -> IO ()
src/epilogue.htxg view
@@ -2,7 +2,12 @@ ##Notes about this guide## -*This guide is not static*. It will be changed, extended and improved with the time.+*This guide is not static*. It will certainly be changed with the time.+Any reader can participate as a writer since the guide is itself open source (and+written in Haskell!). The source repository can be reached at:+<https://github.com/Daniel-Diaz/hatex-guide>. Read more detailed instructions in the+README file.+ If you think there is something unclear, something hard to understand, please, report it. ##Notes from the author##