aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Templates.hs
AgeCommit message (Collapse)AuthorFilesLines
2016-10-02Moved template compiling/rendering code to a separate library.John MacFarlane1-259/+8
jgm/doctemplates. This allows the pandoc templating system to be used independently.
2016-09-03Remove blaze-html CPP conditional.Jesse Rosenthal1-5/+1
This tests for a min value >= 0.5. But we have a lower bound of 0.5 in pandoc.cabal, so the test will always pass. (If we bump the lower bound to 0.5.1, we can remove a conditional in the HTML writer as well.)
2016-09-02Remove Compat.MonoidJesse Rosenthal1-1/+1
This was only necessary for GHC versions with base below 4.5 (i.e., ghc < 7.4).
2016-03-22Updated copyright dates to include 2016.John MacFarlane1-2/+2
2015-11-09Restored Text.Pandoc.Compat.Monoid.John MacFarlane1-0/+1
Don't use custom prelude for latest ghc. This is a better approach to making 'stack ghci' and 'cabal repl' work. Instead of using NoImplicitPrelude, we only use the custom prelude for older ghc versions. The custom prelude presents a uniform API that matches the current base version's prelude. So, when developing (presumably with latest ghc), we don't use a custom prelude at all and hence have no trouble with ghci. The custom prelude no longer exports (<>): we now want to match the base 4.8 prelude behavior.
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-2/+1
- The (non-exported) prelude is in prelude/Prelude.hs. - It exports Monoid and Applicative, like base 4.8 prelude, but works with older base versions. - It exports (<>) for mappend. - It hides 'catch' on older base versions. This allows us to remove many imports of Data.Monoid and Control.Applicative, and remove Text.Pandoc.Compat.Monoid. It should allow us to use -Wall again for ghc 7.10.
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-01-05ghc 7.10.1 RC1 requires specifying the type of String literals ↵Mark Wright1-2/+2
https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10#GHCsaysNoinstanceforFoldable...arisingfromtheuseof...
2014-12-15getDefaultTemplate: don't fail when called with "fb2".John MacFarlane1-0/+1
Closes #1660.
2014-06-03Templates: use ordNum instead of ord.John MacFarlane1-3/+3
Closes #1022.
2014-06-01Templates: Fail informatively on template syntax errors.John MacFarlane1-32/+38
With the move from parsec to attoparsec, we lost good error reporting. In fact, since we weren't testing for end of input, malformed templates would fail silently. Here we revert back to Parsec for better error messages.
2014-05-09Update copyright notices for 2014, add missing noticesAlbert Krewinkel1-2/+2
2014-03-05Templates: YAML objects resolve to "true" in conditionals.John MacFarlane1-0/+1
Closes #1133. Note: If address is a YAML object and you just have $address$ in your template, the word "true" will appear, which may be unexpected. (Previously nothing would appear.)
2013-10-21Templates: Changed how array variables are resolved.John MacFarlane1-1/+2
Previously if `foo` is an array (which might be because multiple values were set on the command line), `$foo$` would resolve to the concatenation of the elements of foo. This is rarely useful behavior. It has been changed so that the first value is rendered. Of course, you can still iterate over the values using `$for(foo)$`. This has the result that you can override earlier settings using -V by putting new values later on the command line. That's useful for many purposes.
2013-09-08Templates: more consistent behavior of `$for$`.John MacFarlane1-1/+1
When `foo` is not a list, `$for(foo)$...$endfor$` should behave like $if(foo)$...$endif$. So if `foo` resolves to "", no output should be produced. See pandoc-templates#39.
2013-08-08Added Text.Pandoc.Compat.Monoid.John MacFarlane1-1/+1
This allows pandoc to compile with base < 4.5, where Data.Monoid doesn't export `<>`. Thanks to Dirk Ullirch for the patch.
2013-07-02Fixed bug retrieving default template for markdown variants.John MacFarlane1-3/+5
2013-06-24Use new flexible metadata type.John MacFarlane1-3/+8
* Depend on pandoc 1.12. * Added yaml dependency. * `Text.Pandoc.XML`: Removed `stripTags`. (API change.) * `Text.Pandoc.Shared`: Added `metaToJSON`. This will be used in writers to create a JSON object for use in the templates from the pandoc metadata. * Revised readers and writers to use the new Meta type. * `Text.Pandoc.Options`: Added `Ext_yaml_title_block`. * Markdown reader: Added support for YAML metadata block. Note that it must come at the beginning of the document. * `Text.Pandoc.Parsing.ParserState`: Replace `stateTitle`, `stateAuthors`, `stateDate` with `stateMeta`. * RST reader: Improved metadata. Treat initial field list as metadata when standalone specified. Previously ALL fields "title", "author", "date" in field lists were treated as metadata, even if not at the beginning. Use `subtitle` metadata field for subtitle. * `Text.Pandoc.Templates`: Export `renderTemplate'` that takes a string instead of a compiled template.. * OPML template: Use 'for' loop for authors. * Org template: '#+TITLE:' is inserted before the title. Previously the writer did this.
2013-06-24Revised Text.Pandoc.Templates to accept JSON contexts.John MacFarlane1-132/+227
Currently the library is set up with a shim for association lists, for compatibility, but this can change when the writers are changed. New export: `varListToJSON`. Removed `Empty`. Simplified template type to a newtype.
2012-12-29Data files changes.John MacFarlane1-2/+2
* Added `embed_data_files` flag. (not yet used) * Shared no longer exports `findDataFile`. * `readDataFile` now returns a strict bytestring. * Shared now exports `readDataFileUTF8` which returns a string like the old `readDataFile`. * Rewrote modules to use new data file functions and to avoid using functions from Paths_pandoc directly.
2012-11-04EPUB writer: Rationalized templates.John MacFarlane1-2/+0
* Previously there were three different templates involved in epub production. There is now just one template, default.epub or default.epub3. * It can now be overridden using `--template`, just like other templates.
2012-11-02Preliminary changes for epub3 format.John MacFarlane1-0/+1
* EPUB writer now exports writeEPUB2 and writeEPUB3. * 'epub' output format is epub v2, while 'epub3' is v3.
2012-09-25Removed need for utf8-string package.John MacFarlane1-2/+3
* Depend on text. * Expose Text.Pandoc.UTF8. * Text.Pandoc.UTF8 now exports toString, fromString, toStringLazy, fromStringLazy. * These are used instead of the old utf8-string functions.
2012-08-09Changed strict to markdown_strict.John MacFarlane1-1/+4
2012-08-09Removed `--strict`, added extensions to writer/reader names.John MacFarlane1-8/+9
* The `--strict` option has been removed. * Instead of using `--strict`, one can now use `strict` instead of `markdown` as an input or output format name. * The `--enable` and `--disable` optinos have been removed. * It is now possible to enable or disable specific extensions by appending them (with '+' or '-') to the writer or reader name. For example `pandoc -f markdown-footnotes+hard_line_breaks`. * The lhs extensions are now implemented this way, too; you can use either `+lhs` or `+literate_haskell`.
2012-07-26Fixed whitespace errors.John MacFarlane1-8/+8
2012-07-20Use Parsec directly in Biblio and Templates.John MacFarlane1-10/+10
2012-07-20Use Parser as type synonym for Parsec.John MacFarlane1-9/+9
2012-07-20Text.Pandoc.Parsing: Export all Parsec functions used in pandoc code.John MacFarlane1-1/+1
No other module directly imports Parsec. This will make it easier to change the parsing backend in the future, if we want to.
2012-07-20Use Text.Parsec instead of Text.ParserCombinators.Parsec.John MacFarlane1-12/+12
2012-05-10Revert "Removed blaze_html_05 flag -- require blaze >= 0.5 by default."John MacFarlane1-1/+5
This reverts commit f67a80cea27286ba17b3696198602a6bbdae014d.
2012-04-24Removed blaze_html_05 flag -- require blaze >= 0.5 by default.John MacFarlane1-5/+1
2012-04-23changes for blaze-html 0.5Mark Wright1-1/+6
2012-01-30Added default.beamer template (separate from default.latex).John MacFarlane1-1/+0
2012-01-28Made `beamer` an output format, removed `pdf` as output format.John MacFarlane1-1/+1
Removed `--beamer` option; instead, use `beamer` as output format. There is no longer a `pdf` output format; instead, pandoc tries to produce a pdf if the output file has a `.pdf` extension. (The output format can be latex -- the default for pdf output, latex+lhs, or beamer.) This seems more consistent with the way pandoc currently works (e.g. we have an `html5` output format, not an `--html5` option).
2012-01-21Removed `beamer` output format; added `--beamer` option.John MacFarlane1-1/+0
2012-01-20pandoc: Output to pdf now works.John MacFarlane1-0/+1
2012-01-19Templates: Removed vestigial remnant of openxml template.John MacFarlane1-1/+1
Closes #381 (I think).
2012-01-19Added Docx writer.John MacFarlane1-0/+1
* New module `Text.Pandoc.Docx`. * New output format `docx`. * Added reference.docx. * New option `--reference-docx`. The writer includes support for highlighted code blocks and math (which is converted from TeX to OMML using texmath's new OMML module).
2012-01-11Split html template into html, html5 templates.John MacFarlane1-1/+0
2012-01-08Templates: Tell pandoc where to find default "html5" template.John MacFarlane1-0/+1
2011-12-29Added 'beamer' as an output format.John MacFarlane1-0/+1
Beamer output uses the default LaTeX template, with some customizations via variables. Added `writerBeamer` to `WriterOptions`. Added `--beamer` option to `markdown2pdf`.
2011-12-17Use blaze-html instead of xhtml for HTML generation.John MacFarlane1-2/+2
* This is a breaking API change for `writeHtml`. * It introduces a new dependency on blaze-html. * Pandoc now depends on highlighting-kate >= 0.4, which also uses blaze-html. * The --ascii option has been removed, because of differences in blaze-html's and xhtml's escaping. * Pandoc will no longer transform leading newlines in code blocks to `<br/>` tags.
2011-08-18Templates: Return empty string for json template.John MacFarlane1-0/+1
Thanks to Dirk Laurie for pointing out the bug.
2011-07-28Fix template problem for epub.John MacFarlane1-0/+1
2011-07-22Changed default template naming scheme.John MacFarlane1-1/+1
Instead of latex.template, we now have default.latex. An appropriate extension is added automatically if the value of `--template` has no extension. So, `pandoc --template=special -t latex` looks for `special.latex`, while `pandoc --template=special -t man` looks for `special.man`.
2011-03-19Added FlexibleInstances pragma.John MacFarlane1-1/+1
Thanks to Sivaram Gowkana for the patch.
2010-12-22Removed all dependencies on 'pretty' package.John MacFarlane1-4/+0