aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Templates.hs
AgeCommit message (Collapse)AuthorFilesLines
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
2010-07-22Moved s5 writing from S5 module to HTML.John MacFarlane1-1/+0
Now s5 is handled in more or less the same way as slidy, as a variant of HTML.
2010-07-05Comment change in Templates (thanks to Alexander Hirzel).John MacFarlane1-1/+1
Resolves Issue #245.
2010-03-23Updated copyright notices.John MacFarlane1-2/+2
2010-03-19Depend on extensible-exceptions, remove CPP in Templates module.fiddlosopher1-6/+0
It's safe to depend on extensible-exceptions, since this is shipped with GHC 6.10 and 6.12. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1911 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-03-18Templates: Conditionally import Control.Exception.Extensible if base < 4.fiddlosopher1-3/+7
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1910 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-18Removed unneeded import.fiddlosopher1-5/+0
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1822 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-18Made user directory a Maybe in readFile, s5HeaderIncludes, laTeXMathML.fiddlosopher1-4/+1
This is more uniform, and calling libraries can always disable searching of user directories for overrides. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1821 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-18Rename getTemplate -> getDefaultTemplate.fiddlosopher1-9/+9
(One reason is that getTemplate conflicts with a function in yst.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1820 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-14Added --data-dir option.fiddlosopher1-15/+7
+ This specifies a user data directory. If not specified, will default to ~/.pandoc on unix or Application Data\pandoc on Windows. Files placed in the user data directory will override system default data files. + Added datadir parameter to readDataFile, saveOpenDocumentAsODT, latexMathMLScript, s5HeaderIncludes, and getTemplate. Removed getDefaultTemplate. + Updated documentation. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1809 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-11Added getTemplate to Text.Pandoc.Templates.fiddlosopher1-7/+27
This allows the caller to select whether to allow user overrides from the user data directory (~/.pandoc). git-svn-id: https://pandoc.googlecode.com/svn/trunk@1803 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Fixed bug with $else$ in templates module.fiddlosopher1-11/+11
We need to be sure we parse the else block even if the if condition is satisfied. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1724 788f1e2b-df1e-0410-8736-df70ead52e1b