Closed GoogleCodeExporter closed 9 years ago
AS of 1.4, pandoc uses a template system for standalone rendering. The default
template is blank, so you get a blank. You need to set writerTemplate.
The default HTML template can be found in the templates/ subdirectory.
You can also use getDefaultTemplate, but be warned that the API will change
slightly
in the next release, so you'll need to change the code again if you use it.
Let me know if this isn't enough information to solve your problem.
Original comment by fiddloso...@gmail.com
on 16 Feb 2010 at 5:44
Thanks for the quick response. It is enough to solve my problem.
I would like for pandoc to fall back to the most appropriate template when
writerTemplate is empty but writerStandalone is True.
If an issue is the inconvenience of compiling in the constants, it can be done
relatively easily as:
> getFile :: FilePath -> ExpQ -- litteral string
> getFile path = do
> conts <- runIO $ readFile path
> return $ LitE $ StringL conts
> fallbackTemplate = $(getFile "path/to/template") :: String
Should I send a patch finishing up this idea, or is this not a good idea?
Original comment by vogt.a...@gmail.com
on 16 Feb 2010 at 5:28
Well, I've finally succeeded in getting all the template haskell OUT of pandoc.
It
isn't so portable -- it kept pandoc from compiling on several architectures
supported
by debian, for example. So I'd rather not reintroduce it.
I do agree that it would be nice to avoid this "gotcha," but I don't see a
clean way
to do it w/o using TH.
Perhaps a cleaner setup would replace the writerStandalone flag with a
writerTemplate
:: Maybe String; if Nothing, a fragment would be generated. THat would keep
users
from thinking that setting writerStandalone to True is sufficient. (But of
course
this would be a major API change.)
Original comment by fiddloso...@gmail.com
on 16 Feb 2010 at 6:00
Original issue reported on code.google.com by
vogt.a...@gmail.com
on 16 Feb 2010 at 5:06