put lántas svgs in a directory named after the page
This commit is contained in:
parent
bb903be015
commit
c493595407
2 changed files with 10 additions and 5 deletions
|
@ -92,12 +92,15 @@ toTitle = Text.filter \c -> c /= '\\' && c /= '#'
|
|||
|
||||
makeImage :: Image -> IO Inline
|
||||
makeImage (Image {..}) = do
|
||||
exe <- getEnv "LAANTAS_SCRIPT"
|
||||
dir <- getEnv "DIRNAME"
|
||||
exe <- getEnv "LAANTAS_SCRIPT"
|
||||
parent <- dropFileName <$> getEnv "FILENAME"
|
||||
dir <- getEnv "DIRNAME"
|
||||
let fullFile = dir </> file
|
||||
let relFile = Text.pack $ makeRelative parent fullFile
|
||||
callProcess exe
|
||||
["-S", show size, "-K", show stroke, "-W", show width,
|
||||
"-C", Text.unpack color, "-t", Text.unpack text, "-o", dir </> file]
|
||||
pure $ Pandoc.Image ("", ["scr","laantas"], []) [] (Text.pack file, title)
|
||||
"-C", Text.unpack color, "-t", Text.unpack text, "-o", fullFile]
|
||||
pure $ Pandoc.Image ("", ["scr","laantas"], []) [] (relFile, title)
|
||||
|
||||
weirdUrl :: Char -> Bool
|
||||
weirdUrl c = c `elem` ("#\\?&_/.·,{} " :: String)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue