Commit 52b5adfe authored by Armin Bernstetter's avatar Armin Bernstetter
Browse files

cleanup. Functionality is implemented but I would still like to improve some details

parent ee2ff226
......@@ -50,8 +50,7 @@ main = do
let index = (directories ^. public) </> "index.html"
let cruft = ["index.md.generated", "log", "//.shake", "generated", "code"]
let pdfMsg =
"\n# Make sure you have run 'decker html' first.\n" ++
"# To use 'decker pdf' or 'decker pdf-decks', Google Chrome has to be installed.\n" ++
"\n# To use 'decker pdf' or 'decker pdf-decks', Google Chrome has to be installed.\n" ++
"# Windows: Follow the Google Chrome installer instructions.\n" ++
"# MacOS: Follow the Google Chrome installer instructions.\n" ++
"\tGoogle Chrome.app has to be located in either /Applications/Google Chrome.app or /Users/<username>/Applications/Google Chrome.app\n" ++
......@@ -131,7 +130,6 @@ main = do
need [src]
putNormal $ "Started: " ++ src ++ " -> " ++ out
runHttpServer serverPort directories Nothing
-- decktape [serverUrl </> makeRelative (directories ^. public) src, out]
result <-
liftIO $
launchChrome
......
......@@ -109,6 +109,12 @@ Exchange the `html` at the end of the command with your *decker* command of choi
Builds PDF versions of all slide decks (requires `decktape.sh`).
To use 'decker pdf' or 'decker pdf-decks', Google Chrome has to be installed.
Windows: Follow the Google Chrome installer instructions.
MacOS: Follow the Google Chrome installer instructions. Google Chrome.app has to be located in either /Applications/Google Chrome.app or /Users/<username>/Applications/Google Chrome.app
Alternatively you can add 'chrome' to $PATH.
Linux: 'chrome' has to be on $PATH.
- `decker watch`
Builds HTML versions of all documents and then watches for document changes.
......
......@@ -11,49 +11,17 @@ import System.Exit
import System.IO
import System.Process
{-
TODO:
find chrome/chromium location from inside the System.Decker.OS modules
use decker pdf to make call to headless chrome
chrome --headless --disable-gpu --print-to-pdf="<path>" http://0.0.0.0:8888/example-deck.html?print-pdf#/
- Windows:
windows seems to be able to find chrome with "start chrome"
so all that is needed is
start chrome --headless --disable-gpu ...
replace call to decktape
what about the handout stuff?
windows can't use "proc" and needs a concrete path
so the createProcess call looks like
(_,_,_,ph) <-
createProcess(
shell "start chrome --headless --disable-gpu --print-to-pdf=C:\\Users\\armin\\out.pdf http://0.0.0.0:8888/example-deck.html?print-pdf#/")
- Mac:
user level: getHomeDirectory -> "/Users/<name>/Applications/"
system level: "/Applications/Google Chrome.app/..."
- Linux:
require that chrome or chromium is on path
-}
pdfOption :: FilePath -> [Char]
pdfOption path = "--print-to-pdf=" ++ path
modifySrc :: FilePath -> FilePath
modifySrc path = path ++ "?print-pdf#/"
chromeOptions :: FilePath -> FilePath -> [String]
chromeOptions src out =
["--headless", "--disable-gpu", pdfOption out, modifySrc src]
where
modifySrc path = path ++ "?print-pdf#/"
pdfOption path = "--print-to-pdf=" ++ path
launchChrome :: FilePath -> FilePath -> IO (Either String String)
launchChrome src out = do
command <- chrome
let options = unwords (chromeOptions src out)
-- print options
case command of
Left msg -> return $ Left msg
Right cmd -> do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment