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
4
Makefile
4
Makefile
|
@ -37,8 +37,10 @@ build: $(OUTPUT)
|
|||
$(BUILDDIR)/%.html: $(PAGESDIR)/%.md $(TEMPLATE) $(LANGFILTER) $(LAANTAS_SCRIPT)
|
||||
@echo "[pandoc] $<"
|
||||
mkdir -p $(dir $@)
|
||||
mkdir -p $(basename $@)
|
||||
LAANTAS_SCRIPT="$(LAANTAS_SCRIPT)" \
|
||||
DIRNAME="$(subst $(PAGESDIR),$(BUILDDIR),$(dir $<))" \
|
||||
DIRNAME="$(basename $@)" \
|
||||
FILENAME="$@" \
|
||||
pandoc -s --toc --template $(TEMPLATE) -o $@ $< \
|
||||
--filter $(LANGFILTER)
|
||||
|
||||
|
|
|
@ -93,11 +93,14 @@ toTitle = Text.filter \c -> c /= '\\' && c /= '#'
|
|||
makeImage :: Image -> IO Inline
|
||||
makeImage (Image {..}) = do
|
||||
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…
Reference in a new issue