packages feed

blatex 0.1.0.1 → 0.1.0.2

raw patch · 3 files changed

+25/−31 lines, 3 filesdep +process

Dependencies added: process

Files

− LICENSE
@@ -1,21 +0,0 @@-The MIT License (MIT)--Copyright (c) [year] [fullname]--Permission is hereby granted, free of charge, to any person obtaining a copy-of this software and associated documentation files (the "Software"), to deal-in the Software without restriction, including without limitation the rights-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell-copies of the Software, and to permit persons to whom the Software is-furnished to do so, subject to the following conditions:--The above copyright notice and this permission notice shall be included in all-copies or substantial portions of the Software.--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE-SOFTWARE.
Main.hs view
@@ -10,28 +10,30 @@ import Text.Blaze.Html.Renderer.String  --Stuff for HaTeX-import Text.LaTeX+import Text.LaTeX hiding (unlines) import Text.LaTeX.Base.Parser import Text.LaTeX.Base.Syntax-import Data.Text (unlines, pack, unpack)+import Data.Text (pack, unpack) import qualified Data.Text.IO as T  --Stuff for TagSoup import Text.HTML.TagSoup  --Other stuff I'm using-import System.Directory (getDirectoryContents) +import System.Directory  import Data.List.Split import Data.Maybe import Control.Applicative import System.Environment (getArgs)+import System.Process (readProcess)+import Files  instance Show Html where   show = renderHtml  postsToHtml :: [Post] -> Html postsToHtml xs = do-  ul ! class_ "blog-posts" $+  ul ! A.id "blog-posts" $     forM_ xs h   where     h s = li ! class_ "blog-post" $@@ -47,7 +49,7 @@     }  instance Show Post where-  show (Post fn t a d _) = t ++ " written by " ++ (a) ++ " on " ++ (d)+  show (Post fn t a d _) = fn ++ " is a post called " ++ t ++ " written by " ++ (a) ++ " on " ++ (d)  getPDF :: FilePath -> Maybe String getPDF xs = if splitUp !! 1 == "pdf" then Just (splitUp !! 0) else Nothing@@ -79,7 +81,7 @@ fileNameToPost :: String -> IO (Maybe Post)  fileNameToPost fn = do   latexFile <- fmap (parseLaTeX . pack) (readFile ("posts/"++fn++".tex"))-  return (createPost "post1" latexFile)+  return (createPost fn latexFile)  injectPosts :: String -> Html -> String  injectPosts layout ul = renderTags (beginning ++ parseTags (show ul) ++ end)@@ -95,14 +97,17 @@       --get all pdf files from directory       putStrLn "Getting directory contents"       fileNames <- fmap (catMaybes . map getPDF) (getDirectoryContents "posts")+      print fileNames        --turn the list of files into a list of posts       putStrLn "Turning directory contents into posts"       posts <- fmap (catMaybes) (mapM fileNameToPost fileNames)+      print posts        --generate a ul from the list of posts       putStrLn "Turning posts into an HTML element"       let generatedHtml = postsToHtml posts+      print generatedHtml        --read the layout file       putStrLn "Reading the layout file"@@ -116,6 +121,16 @@       putStrLn "Writing resulting file into index.html"       writeFile "index.html" outputFile -      putStrLn "Success!"-    ["init"] -> print "Not implemented yet..."+      putStrLn "Success building!"+    ["init"] -> do+      --Create the basic layout file+      writeFile "index.html.bltx" exampleBltxFile --Change to layout when testing, index when deploying"+      --Create directory for posts and basic post+      createDirectoryIfMissing True "posts"+      setCurrentDirectory "posts"+      writeFile "example-post.tex" exampleTeXPost+      --Compile the LaTeX file into a PDF+      readProcess "pdflatex" ["example-post.tex"] ""+      print "Success initializing!"+           _ -> print "That's not a valid command"
blatex.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                blatex-version:             0.1.0.1+version:             0.1.0.2 synopsis:            Blog in LaTeX description:         Static site generator that lets you write your blog in LaTeX and publish it to github pages. description:         Markdown and HTML are the standard tools used to write your every day tech blog with. But they have pretty weak support for embedding mathematical formulas, and are not conducive to writing for an extended period of time. Plus, they aren't even Turing complete! So use BlaTeX to start blogging in LaTeX!@@ -12,7 +12,6 @@                      To get started, check out <https://github.com/2016rshah/BlaTeX#how-to> homepage:            https://github.com/2016rshah/BlaTeX license:             MIT-license-file:        LICENSE author:              Rushi Shah maintainer:          2016rshah@gmail.com -- copyright:           @@ -28,6 +27,7 @@                      , base >=4.7 && <4.8                      , blaze-html >= 0.8.1.1                      , directory >=1.2 && <1.3+                     , process >= 1.2.0.0                      , split >=0.2 && <0.3                      , tagsoup >= 0.13.3                      , text >=1.1 && <1.2