3 -- Copyright (C) 2012 by Werner Lemberg.
5 -- This file is part of the ttfautohint library, and may only be used,
6 -- modified, and distributed under the terms given in `COPYING'. By
7 -- continuing to use, modify, or distribute this file you indicate
8 -- that you have read `COPYING' and understand and accept it fully.
10 -- The file `COPYING' mentioned in the previous paragraph is
11 -- distributed with the ttfautohint library.
14 -- This is a simple pandoc filter to support different image formats
15 -- for different backends. It simply appends the suffix given as a
16 -- command line option to all pandoc images and checks whether the
17 -- image files actually exist. For non-existent files the file name
18 -- doesn't get altered.
20 -- Command line examples:
22 -- % pandoc -t json foo \
23 -- | ./handle-images ".svg" \
24 -- | pandoc -f json -t html \
27 -- % pandoc -t json foo \
28 -- | ./handle-images ".pdf" \
29 -- | pandoc --latex-engine=pdflatex -f json -t latex \
34 import System
.Environment
(getArgs)
35 import System
.Directory
(doesFileExist)
42 (Image description
(basename
, title
)) = do
44 filename
= basename
++ format
46 fileExists
<- doesFileExist filename
49 return $ Image description
(filename
, title
)
51 return $ Image description
(basename
, title
)
52 handleImage _ x
= return x
65 -- end of handle-images.hs