Commit graph

245 commits

Author SHA1 Message Date
John MacFarlane
a5efd2af11 Improved default template lookup for custom lua scripts.
Previously, if you tried to do `pandoc -s -t /path/to/lua/script.lua`,
pandoc would look for the template in
`~/.pandoc/templates/default./path/to/lua/script.lua`.
With this change it will look in the more reasonable
`~/.pandoc/templates/default.script.lua`.

This makes it possible to store default templates for custom
writers.

Closes #2625.
2016-01-06 15:47:09 -08:00
John MacFarlane
197f301795 Revert "Make file globbing work on windows."
This reverts commit 363ecfebc3.
2016-01-06 11:11:59 -08:00
John MacFarlane
363ecfebc3 Make file globbing work on windows.
Windows cmd doesn't expand wildcards; the application has to
do this.  So on windows we use 'glob' to expand.
2016-01-06 10:44:56 -08:00
John MacFarlane
0a768f1cc5 Added preliminary support for PDF creation via wkhtmltopdf.
To use this:

    pandoc -t html5 -o result.pdf

(and add `--mathjax` if you have math.)
2015-12-21 17:22:12 -08:00
John MacFarlane
a6d810af15 Factored out convertWithOpts 2015-12-14 11:21:54 -08:00
John MacFarlane
c16efea983 Removed "compatibility mode" when called as hsmarkdown. 2015-12-14 11:21:54 -08:00
John MacFarlane
678e7da709 Removed deprecated --strict option entirely. 2015-12-14 11:21:54 -08:00
John MacFarlane
b747243e8d Removed deprecated options --offline and --html5.
These have been deprecated forever.
2015-12-11 23:57:36 -08:00
John MacFarlane
536b6bf538 Implemented SoftBreak and new --wrap option.
Added threefold wrapping option.

* Command line option: deprecated `--no-wrap`, added
  `--wrap=[auto|none|preserve]`
* Added WrapOption, exported from Text.Pandoc.Options
* Changed type of writerWrapText in WriterOptions from
  Bool to WrapOption.
* Modified Text.Pandoc.Shared functions for SoftBreak.
* Supported SoftBreak in writers.
* Updated tests.
* Updated README.

Closes #1701.
2015-12-11 23:55:08 -08:00
John MacFarlane
f0670cccbb hlint refactorings. 2015-11-22 07:27:35 -08:00
John MacFarlane
244cd5644b Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into mb21-new-image-attributes
* Bumped version to 1.16.
* Added Attr field to Link and Image.
* Added `common_link_attributes` extension.
* Updated readers for link attributes.
* Updated writers for link attributes.
* Updated tests
* Updated stack.yaml to build against unreleased versions of
  pandoc-types and texmath.
* Fixed various compiler warnings.

Closes #261.

TODO:

* Relative (percentage) image widths in docx writer.
* ODT/OpenDocument writer (untested, same issue about percentage widths).
* Update pandoc-citeproc.
2015-11-19 23:14:23 -08:00
John MacFarlane
ed1173ace6 Rationalized behavior of --no-tex-ligatures and --smart.
This change makes `--no-tex-ligatures` affect the LaTeX reader
as well as the LaTeX and ConTeXt writers.  If it is used,
the LaTeX reader will parse characters `` ` ``, `'`, and `-`
literally, rather than parsing ligatures for quotation marks
and dashes.  And the LaTeX writer will print unicode quotation
mark and dash characters literally, rather than converting
them to the standard ASCII ligatures.

Note that `--smart` has no affect on the LaTeX reader.

`--smart` is still the default for all input formats when
LaTeX or ConTeXt is the output format, *unless* `--no-tex-ligatures`
is used.

Some examples to illustrate the logic:

```
% echo "'hi'" | pandoc -t latex
`hi'
% echo "'hi'" | pandoc -t latex --no-tex-ligatures
'hi'
% echo "'hi'" | pandoc -t latex --no-tex-ligatures --smart
‘hi’
% echo "'hi'" | pandoc -f latex --no-tex-ligatures
<p>'hi'</p>
% echo "'hi'" | pandoc -f latex
<p>’hi’</p>
```

Closes #2541.
2015-11-19 20:30:41 -08:00
Andrew Dunning
ec0a22746b Allow .adoc file extension for AsciiDoc.
`.adoc` is the extension recommended at <http://asciidoctor.org/docs/asciidoc-writers-guide/>.
2015-11-16 13:37:13 -05:00
John MacFarlane
e44149931e Improved implicit pandoc-citeproc inclusion.
The filter pandoc-citeproc is automatically used when
`--bibliography` is specified on the command line, unless
`--natbib` or `--biblatex` is used.

However, previously this only worked if `--bibliography`
was spelled out in full, and not if `--biblio` was used.
This patch fixes that problem.
2015-11-16 09:46:11 -08:00
John MacFarlane
23b693c029 Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."
This reverts commit c423dbb5a3.
2015-11-09 10:08:22 -08:00
John MacFarlane
c423dbb5a3 Use -XNoImplicitPrelude and 'import Prelude' explicitly.
This is needed for ghci to work with pandoc, given that we
now use a custom prelude.

Closes #2503.
2015-11-08 16:56:59 -08:00
John MacFarlane
8193ebcd99 Allow use of ConTeXt to generate PDFs.
pandoc my.md -t context -o my.pdf

will now create a PDF using ConTeXt rather than LaTeX.

Closes #2463.
2015-10-20 08:16:17 -07:00
John MacFarlane
82b3e0ab97 Use custom Prelude to avoid compiler warnings.
- 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-10-14 09:09:10 -07:00
John MacFarlane
169cdf3fa2 Removed unneeded import. 2015-10-10 14:35:26 -07:00
Alex Vong
d7a19c22be Move the variable pandocVersion from src/Text/Pandoc.hs to
`src/Text/Pandoc/Shared.hs`, so that all Writers can access this variable
without importing `src/Text/Pandoc.hs`, preventing circular import.

* pandoc.hs: Import pandocVersion from `Text.Pandoc.Shared`.
* src/Text/Pandoc.hs: Remove the definition of pandocVersion
 and relevant import.
* src/Text/Pandoc/Shared.hs: Add the definition of pandocVersion
 and relevant import.
2015-10-01 02:24:34 +08:00
Emily Eisenberg
149f0f6a4b Update KaTeX JS and CSS versions.
Update the default KaTeX JS/CSS links to the current version. KaTeX v0.5.1 has far more functions and symbols than v0.1.0, so it seems like a better default. I think technically this might break compatibility because we released a breaking change due to the greediness of the `\color` function, but this probably has very little impact.
2015-09-26 21:15:13 -07:00
John MacFarlane
73824908aa Added --bash-completion option.
This generates a bash completion script.

To use:

     eval "$(pandoc --bash-completion)"
2015-08-13 15:27:47 -07:00
John MacFarlane
5df099957e Text.Pandoc.Options: modifications for image attributes.
* Added `Ext_common_link_attributes` constructor to `Extension`
  (for link and image attributes).
* Added this to `pandocExtensions` and `phpMarkdownExtraExtensions`.
* Added `writerDpi` to `WriterOptions`.
* pandoc.hs:  Added `--dpi` option.
* Updated README for `--dpi` and `common_link_attributes` extension.

Patch due to mb21, with some modifications: `writerDpi` is now an
`Int` rather than a `Double`.
2015-07-27 21:52:43 +02:00
MarLinn
f068093555 Added odt reader
Fully implemented features:

* Paragraphs
* Headers
* Basic styling
* Unordered lists
* Ordered lists
* External Links
* Internal Links
* Footnotes, Endnotes
* Blockquotes

Partly implemented features:

* Citations
  Very basic, but pandoc can't do much more
* Tables
  No headers, no sizing, limited styling
2015-07-23 15:37:01 -07:00
John MacFarlane
5f0b875565 Better error messages for filters:
- Inform user if filter requires an interpreter that isn't
  found in the path.
- Inform user if filter returns an error status.
2015-07-02 12:28:46 -07:00
John MacFarlane
a04c15a422 New method for building man pages.
+ Removed `--man1`, `--man5` options (breaking change).
+ Removed `Text.Pandoc.ManPages` module (breaking API change).
+ Version bump to 1.15 because of the breaking changes, even
  though they involve features that have only been in pandoc
  for a day.
+ Makefile target for `man/man1/pandoc.1`.  This uses pandoc to
  create the man page from README using a custom template and filters.
+ Added `man/` directory with template and filters needed to build
  man page.
+ We no longer have two man pages: pandoc.1 and pandoc_markdown.5.
  Now there is just pandoc.1, which has all the content from README.
  This change was needed because of the extensive cross-references
  between parts of the README.
+ Removed old `data/pandoc.1.template` and
  `data/pandoc_markdown.5.template`.
2015-07-01 11:27:15 -07:00
John MacFarlane
fe625e053d New method for producing man pages.
This change adds `--man1` and `--man5` options to pandoc, so
pandoc can generate its own man pages.

It removes the old overly complex method of building a separate
executable (but not installing it) just to create the man pages.

The man pages are no longer automatically created in the build
process.

The man/ directory has been removed.  The man page templates
have been moved to data/.

New unexported module:  Text.Pandoc.ManPages.

Text.Pandoc.Data now exports readmeFile, and `readDataFile`
knows how to find README.

Closes #2190.
2015-06-28 14:39:17 -07:00
Pablo Rodríguez
c18e93ca6e replace old url with pandoc.org 2015-06-09 22:22:58 +02:00
John MacFarlane
dc0e5c34b7 Amends last commit: don't use https for google charts.
They don't have a certificate.
2015-06-09 12:37:35 -07:00
John MacFarlane
8c47bd63e8 Use https: for mathjax/katex/google-charts CDNs.
Closes #1920.
2015-06-09 12:19:06 -07:00
John MacFarlane
a131441da4 Only make implicit -F pandoc-citeproc when --bibliography option used.
Not when `bibliography` field in metadata is specified.

Closes #1849.
2015-05-11 21:31:03 -07:00
John MacFarlane
c6debff1f8 Removed references to biblio-files in pandoc.hs and README. 2015-05-11 21:19:15 -07:00
John MacFarlane
7920a1a469 Revert "EPUB writer: stylesheet changes. Closes #2040."
This reverts commit 1c2951dfd9.

See #2040.

The semantics was too squishy.  `--css` takes a URL, but
for EPUB we need files that we can read.  I prefer keeping
the old system for now, with `--epub-stylesheet`.
2015-05-09 00:07:27 -07:00
John MacFarlane
1c2951dfd9 EPUB writer: stylesheet changes. Closes #2040.
* Allow `--css` to be used to specify stylesheets.
* Deprecated `--epub-stylesheet` and made it a synoynym of
  `--css`.
* If a code block with class "css" is given as contents of the
  `stylesheet` metadata field, use its literal code as contents of
  the epub stylesheet.  Otherwise, treat it as a filename and
  read the file.
* Note: `--css` and `stylesheet` in metadata are not compatible.
  `stylesheet` takes precedence.
2015-05-08 23:47:50 -07:00
John MacFarlane
1868cb5e42 Updated copyright notices to -2015. Closes #2111. 2015-04-26 10:18:29 -07:00
John MacFarlane
6a3a04c428 Merge branch 'errortype' of https://github.com/mpickering/pandoc into mpickering-errortype
Conflicts:
	benchmark/benchmark-pandoc.hs
	src/Text/Pandoc/Readers/Markdown.hs
	src/Text/Pandoc/Readers/Org.hs
	src/Text/Pandoc/Readers/RST.hs
	tests/Tests/Readers/LaTeX.hs
2015-03-28 12:12:48 -07:00
John MacFarlane
62e802ae1e Merge pull request #1976 from wcaleb/json-help-message
Clarify JSON input and output in usage message
2015-03-07 10:08:13 -08:00
Sumit Sahrawat
ad9e4cde9d Fix issue #969, #1779 by providing --latex-engine-opt 2015-03-04 15:25:56 +05:30
Caleb McDaniel
6b6c9e8c66 Clarify JSON input and output in usage message 2015-02-27 11:29:33 -06:00
Matthew Pickering
70e0c4d41b Update executable file 2015-02-18 21:09:07 +00:00
Matthew Pickering
da93181d06 Better warning when trying to read multiple binary files 2015-01-19 02:44:04 +00:00
John MacFarlane
e3422dc438 Added --verbose flag for debugging output in PDF production.
Closes #1840.
Closes #1653.
2014-12-26 11:19:55 -07:00
John MacFarlane
88812c41ce Recognize .icml extension and use icml writer. See #1707. 2014-10-20 15:01:13 -07:00
John MacFarlane
6eda32871f Give better error messages when someone tries to convert pdf, doc, odt.
Closes #1683.
2014-10-19 16:59:59 -07:00
mpickering
515a120d04 Add support for KaTeX HTML math
Closes #1626
2014-09-25 18:32:42 +01:00
John MacFarlane
b9d524c703 Use protocol-relative URL for mathjax.
See jgm/pandoc-templates#67.
2014-08-31 11:18:43 -07:00
John MacFarlane
b36600092c Removed extra blank line after version. 2014-08-30 08:16:00 -07:00
John MacFarlane
58cbd20b1f Removed check for PATH variable in running filters.
This cause problems on Windows 8, where the variable is called
`Path`.

Instead, simply trap the exception that will be raised by
`findExecutable` if path is not set.

This should fix #1542.
2014-08-17 10:33:18 -07:00
John MacFarlane
482f7f8e15 pandoc: Don't strip path off of sourceURL.
We need this information for relative URLs!

This should resolve the continuing problem noted in #750.
2014-08-06 14:36:46 -07:00
John MacFarlane
2de2842bdd Merge pull request #1486 from Aelve/minor
Very minor cleanup and readability changes
2014-08-04 22:07:02 -07:00
Artyom Kazak
675b15458a Slightly fix readability of main program file. 2014-08-04 19:58:25 +04:00
John MacFarlane
4630cff2a6 Merge branch 'epubend' of https://github.com/mpickering/pandoc into mpickering-epubend
Conflicts:
	pandoc.cabal
2014-08-04 07:36:18 -07:00
John MacFarlane
ce8922437d Text.Pandoc.SelfContained changes.
* mkSelfContained now takes just two arguments, WriterOptions and
  the string.
* It no longer looks in data files.  This only made sense when we
  had copies of slidy and S5 code there.
* Shared.fetchItem' is used instead of the nearly duplicate getItem.
2014-08-02 16:07:19 -07:00
John MacFarlane
f075b0e5d9 pandoc.hs: More code reorganization. 2014-07-31 16:27:06 -07:00
Matthew Pickering
8460ea417f EPUB Reader: Integrated into program 2014-07-31 21:39:50 +01:00
John MacFarlane
0565a81676 pandoc.hs: Rewrote some of the logic for clarity. 2014-07-31 12:51:01 -07:00
John MacFarlane
6dd2418476 New module, Text.Pandoc.MediaBag.
Moved `MediaBag` definition and functions from Shared:
`lookupMedia`, `mediaDirectory`, `insertMedia`, `extractMediaBag`.
Removed `emptyMediaBag`; use `mempty` instead, since `MediaBag`
is a Monoid.
2014-07-31 12:00:21 -07:00
John MacFarlane
00662faefb Made MediaBag a newtype, and added mime type information to media.
Shared now exports functions for interacting with a MediaBag:

- `emptyMediaBag`
- `lookuMedia`
- `insertMedia`
- `mediaDirectory`
- `extractMediaBag`
2014-07-31 11:05:35 -07:00
John MacFarlane
71e76175be getT2TMeta: Take list of source files instead of single.
Get latest modification time.
2014-07-30 17:25:00 -07:00
John MacFarlane
e4913d6dba Allow --self-contained to get content from MediaBag.
Added a parameter to makeSelfContained (API change).
2014-07-30 15:26:40 -07:00
John MacFarlane
234652a4b8 PDF, Docx, EPUB, and ODT writers now automatically use MediaBag.
The MediaBag is thread through from the reader, with no need
to extract to files.
2014-07-30 14:07:31 -07:00
John MacFarlane
77aa72ec24 pandoc: Thread media bag into WriterOptions.
This will make it available to docx and epub readers, etc.,
so we don't have to extract media to a directory when going
from docx -> epub.
2014-07-30 13:20:44 -07:00
John MacFarlane
b5210bc175 Added --extract-media option.
This has been documented to affect the epub and docx readers, so
we should either add the epub reader before the next release or
change the documentation.
2014-07-30 11:44:25 -07:00
Jesse Rosenthal
f733b50150 Make toplevel pandoc bin make use of mediabag.
Note that at the moment the mediabag is discarded. This will have to be
changed to make use of it.
2014-07-30 12:48:07 -04:00
Matthew Pickering
43304d6bd6 Txt2Tags Reader: Added recognition of macros 2014-07-27 00:12:56 +01:00
Matthew Pickering
ab3589ff0b Txt2Tags Reader: Integrated into pandoc 2014-07-27 00:12:56 +01:00
Clare Macrae
3cb76d9560 Merge branch 'master' of git://github.com/jgm/pandoc into dokuwiki 2014-07-01 22:10:08 +01:00
John MacFarlane
264e366f1a Filters: respect shebang if filter is executable.
Closes #1389.
2014-06-30 14:03:47 -07:00
Clare Macrae
717e16660d Merge remote-tracking branch 'jgm/master' into dokuwiki 2014-06-29 19:22:31 +01:00
John MacFarlane
b1a8f1fa1a Fixed --filter so it doesn't search PATH for a filter with a path.
This fixed a bug wherein `--filter ./caps.py` would run `caps.py` from
the system path, even if there was a `caps.py` in the working directory.
2014-06-27 18:30:57 -07:00
Jesse Rosenthal
aa194d387c Add track changes option to command line. 2014-06-25 14:09:01 -04:00
John MacFarlane
08fe16e972 Fixed compiler warnings. 2014-06-21 11:26:43 -07:00
John MacFarlane
f5c8b05a1a Filters: don't print misleading error message.
Previously pandoc would say that a filter was not found,
even in a case where the filter had a syntax error.
2014-06-20 23:08:00 -07:00
mpickering
3bc818d2d3 Integrated the docx reader into the main pandoc program.
Changes also include generalising the types of reader allowed. The
mechanism now mimics the more general output mechanism.
2014-06-16 07:18:40 -04:00
Albert Krewinkel
8fdbef841d Update copyright notices for 2014, add missing notices 2014-05-09 00:46:08 +02:00
John MacFarlane
5dfeb5d52f Allow html4 as synonym of html as reader.
It already worked for writer.
2014-04-27 21:01:30 -07:00
John MacFarlane
c8f97d3d41 Fix #1267.
We now check the writerName for a lua script in pandoc.hs, so that
lowercasing and format parsing aren't done.  Note this behavior
change: getWriter in Text.Pandoc no longer returns a custom writer on
input "foo.lua".
2014-04-27 20:56:50 -07:00
John MacFarlane
f80678df7f A bit of refactoring that shouldn't change any semantics.
In preparation for a fix to #1267.
2014-04-27 20:38:15 -07:00
John MacFarlane
11120d619b Give more useful error message if '-t pdf' is specified.
Closes #1155.
2014-04-05 23:44:57 -07:00
John MacFarlane
3fe6b57b60 Make it possible to run filters that aren't executable.
Pandoc first tries to find the executable (searching the path
if path isn't given).  If it fails, but the file exists and has
a .py, .pl, .rb, .hs, or .php extension, pandoc runs the filter
using the appropriate interpreter.

This should make it easier to use filters on Windows, and make
it more convenient for everyone.

Closes #1096.
2014-04-05 15:51:04 -07:00
John MacFarlane
3df75bc160 PDF: Changes to error reporting, to handle non-UTF8 error output. 2014-03-19 11:09:36 -07:00
Albert Krewinkel
24b2ac43b0 Add a simple Emacs Org-mode reader
The basic structure of org-mode documents is recognized; however,
org-mode features like todo markers, tags etc. are not supported yet.
2014-03-04 10:40:40 +01:00
John MacFarlane
69f7b1dbf3 Added readerTrace to ReaderOptions, --trace command line opt.
This is to debug backtracking-related parsing bugs.
So far it is only implemented for markdown, but it would
be good to extend it to latex and html readers.
2014-02-25 22:43:58 -08:00
John MacFarlane
9ae10b4352 The --bibliography option now sets the biblio-files variable.
So, if you're using `--natbib` or `--biblatex`, you can just use
`--bibliography=foo.bib` instead of `-V bibliofiles=foo`.
2014-01-03 10:11:21 -08:00
John MacFarlane
36cda45d70 Merge pull request #1005 from nougad/consistent_bibliography
Don't add pandoc-citeproc filter if natbib or biblatex is used
2014-01-02 21:15:41 -08:00
Henry de Valence
f6d151889c HLint: redundant parens
Remove parens enclosing a single element.
2013-12-19 20:43:25 -05:00
Henry de Valence
0c5e7cf8cb HLint: use elem and notElem
Replaces long conditional chains with calls to `elem` and `notElem`.
2013-12-19 20:19:24 -05:00
John MacFarlane
9b6f1fc495 Allow https: to work in pandoc command line arguments.
(Use openURL from Shared instead of simpleHTTP.)
2013-12-05 11:28:22 -08:00
John MacFarlane
bc6bb3be5c Allow "epub2" as synonym for "epub", "html4" for "html". 2013-11-30 15:36:18 -08:00
John MacFarlane
f2f8ddabc8 Don't look for slidy files in data files w/ --self-contained. 2013-10-21 11:24:25 -07:00
Florian Eitel
e24963ade6 Fixed stupid copy&paste error
How could this happend? sry
2013-09-30 16:56:31 +02:00
Florian Eitel
a26d25a80b Don't add pandoc-citeproc filter if natbib or biblatex is used
See https://github.com/jgm/pandoc-templates/issues/42
2013-09-30 15:55:59 +02:00
John MacFarlane
652f9a88f4 Handle Boolean values in --metadata.
Note that anything not parseable as a YAML boolean or string
is treated as a literal string.

Note that you can still get a string value with "yes" or any
of the strings interpretable as booleans:

    -M boolvalue=yes -M stringvalue='"yes"'
2013-09-19 20:21:35 -07:00
John MacFarlane
3397af30e4 More informative error when a filter is not found in path.
No more "resource vanished (broken pipe)"!
2013-09-17 21:38:34 -07:00
John MacFarlane
32afe85754 Allow --metadata to be repeated for the same key to form a list.
This also has the effect that `--bibliography` can be repeated,
as before.
2013-09-17 21:04:27 -07:00
John MacFarlane
479cefa4c2 More robust check for '-F pandoc-filters', allowing pathnames. 2013-09-14 16:01:41 -07:00
John MacFarlane
d47eadaf56 --bibliography again implies -F pandoc-citeproc.
But only if pandoc-citeproc isn't already specified as a filter.
2013-09-10 20:23:03 -07:00
John MacFarlane
4381c37b10 --bibliography no longer implies -F pandoc-citeproc.
This could lead to double filtering if the user specifies `-F`
too.
2013-09-08 22:46:30 -07:00
John MacFarlane
8977b2aaed Changed --metadata to return Boolean True if no value.
Also documented in README.
2013-09-01 16:22:40 -07:00
John MacFarlane
1240edbc3b Change for latest pandoc-citeproc. 2013-09-01 16:09:00 -07:00
John MacFarlane
39cdafd505 Restore --bibliography, --csl, --citation-abbreviations.
These are now implemented as:

--bibliography FILE => --metadata bibliography=FILE --filter pandoc-citeproc
--csl FILE          => --metadata csl=FILE
--citation-abbreviations FILE => --metadata csl-abbreviations=FILE
2013-09-01 15:54:48 -07:00
John MacFarlane
53f61019e2 Added --metadata/-M option.
This is like `--variable/-V`, but actually adds to metadata, not
just variables.
2013-09-01 15:40:28 -07:00
John MacFarlane
a68805bebd Added -F as shortcut for --filter. 2013-08-25 07:47:22 -07:00
John MacFarlane
deb59b6235 Removed dependency on citeproc-hs.
Going forward we'll use pandoc-citeproc, as an external filter.

The `--bibliography`, `--csl`, and `--citation-abbreviation` fields
have been removed.  Instead one must include `bibliography`, `csl`,
or `csl-abbrevs` fields in the document's YAML metadata.  The filter
can then be used as follows:

    pandoc --filter pandoc-citeproc

The `Text.Pandoc.Biblio` module has been removed.  Henceforth,
`Text.CSL.Pandoc` from pandoc-citations can be used by library users.

The Markdown and LaTeX readers now longer format bibliographies and
citations.  That must be done using `processCites` or `processCites'`
from Text.CSL.Pandoc.

All bibliography-related fields have been removed from `ReaderOptions`
and `WriterOptions`: `writerBiblioFiles`, `readerReferences`,
`readerCitationStyle`.

API change.
2013-08-24 22:33:01 -07:00
John MacFarlane
6e222ce225 Improved error reporting on filters.
Avoid showing spurious output and avoid double error messages.
2013-08-24 12:54:39 -07:00
John MacFarlane
8926230175 Print stderr output of filters to stderr. 2013-08-14 13:02:54 -07:00
John MacFarlane
f6b5735d09 Added module for writing python scripts, with several examples.
See scripts subdirectory.
2013-08-13 23:11:33 -07:00
John MacFarlane
bd73d73a28 Removed --print-sample-lua-writer, added --print-default-data-file.
Closes #943.
2013-08-13 18:29:57 -07:00
John MacFarlane
e279175ea5 Options: Changed writerSourceDir to writerSourceURL (now a Maybe).
Previously we used to store the directory of the first input file,
even if it was local, and used this as a base directory for
finding images in ODT, EPUB, Docx, and PDF.

This has been confusing to many users.  It seems better to look for
images relative to the current working directory, even if the first
file argument is in another directory.

writerSourceURL is set to 'Just url' when the first command-line
argument is an absolute URL.  (So, relative links will be resolved
in relation to the first page.)  Otherwise, 'Nothing'.

The ODT, EPUB, Docx, and PDF writers have been modified accordingly.

Note that this change may break some existing workflows.  If you
have been assuming that relative links will be interpreted relative
to the directory of the first file argument, you'll need to
make that the current directory before running pandoc.

Closes #942.
2013-08-11 15:58:09 -07:00
John MacFarlane
99bb066bb9 Pass writename as argument to filters.
This way filters can figure out what the target format is
and react appropriately.

Example:

    #!/usr/bin/env runghc
    import Text.Pandoc.JSON
    import Data.Char

    main = toJSONFilter cap
      where cap (Just "html") (Str xs) = Str $ map toUpper xs
            cap _ x = x

This capitalizes text only for html output.
2013-08-08 15:15:58 -07:00
John MacFarlane
2677e84663 Revert "Revert "Added --filter option.""
This reverts commit 2e5edbb278.
2013-08-08 11:09:00 -07:00
John MacFarlane
2e5edbb278 Revert "Added --filter option."
This reverts commit 85dacbb282.
2013-07-23 23:17:07 -07:00
John MacFarlane
85dacbb282 Added --filter option.
This makes it easier to use JSON filters.  Instead of
doing

    pandoc -t json | ./filter | pandoc -f json

you can just do

    pandoc --filter ./filter
2013-07-23 23:02:47 -07:00
John MacFarlane
7102254e24 PDF generation improvements.
* `Text.Pandoc.PDF` exports `makePDF` instead of `tex2pdf`.
  (API change.)
* `makePDF` walks the pandoc AST and checks for the existence of
  images in the local directory.  If they are not found, it attempts
  to find them, either in the directory containing the first source
  file, or at an absolute URL, or at a URL relative to the base URL
  of the first command line argument.
* Closes #917.
2013-07-20 12:14:43 -07:00
Clare Macrae
7eded47bcd Initial work to create dokuwiki writer (#386)
In this first version, all dokuwiki files are straight copies of the
media wiki counterparts.
2013-07-14 13:40:27 +01:00
John MacFarlane
1de55ecbbd --toc-level no longer implies --toc.
Reason: EPUB users who don't want a visible TOC may still want
to set the TOC level for in the book navigation.
2013-07-03 12:47:35 -07:00
John MacFarlane
4edc97a921 pandoc --help now says something about pdf output.
Closes #720.
2013-04-26 21:13:42 -07:00
John MacFarlane
4fa2a94759 Added Text.Pandoc.Writers.Custom, --print-custom-lua-writer.
pandoc -t data/sample.lua

will load the script sample.lua and use it as a custom writer.
data/sample.lua is provided as an example.

Added `--print-custom-lua-writer` option to print the sample
script.
2013-04-14 00:31:39 -05:00
John MacFarlane
333deac26b Have --help print in and out formats in alphabetical order. 2013-04-08 09:44:23 -07:00
John MacFarlane
da1e38893a Reveal.js improvements.
Changed name to revealjs (from reveal_js).
Set revealjs-url template variable to 'reveal.js' by default.
2013-03-23 21:48:34 -04:00
Jamie F. Olson
6b53a905c4 Added basic support for reveal.js.
Support unordered and ordered lists with "fragment" elements.

Modified by JGM to remove the --reveal_js-url command-line option.
Instead use -V reveal_js-url=... as with slidy and the other slide
formats.  Also cleaned up the list code in the HTML writer.
2013-03-21 14:54:17 -07:00
John MacFarlane
69acb47a34 Added Text.Pandoc.Writers.OPML.
TODO:

* Document in README
* Add tests
* Add template (and add template to cabal file)
2013-03-19 22:49:44 -07:00
John MacFarlane
74d53f4347 Added Text.Pandoc.Readers.OPML, exporting readOPML.
The _note attribute is supported.  This is unofficial, but
used e.g. in OmniOutliner and supported by multimarkdown.
We treat the contents as markdown blocks under a section
header.

Added to documentation and tests.
2013-03-19 20:22:14 -07:00
John MacFarlane
f8fec87f09 Fixed numbering mismatch between TOC and sections in HTML.
Also made `--number-offset` affect TOC numbering as well
as section numbering, as it should have all along.

Closes #789.
2013-03-16 14:48:37 -07:00
John MacFarlane
3b63cb0903 Hide Text.Pandoc.Highlighting.
* Moved code for translating listings language names to
  highlighting-kate names and back from LaTeX reader to Highlighting.
* Text.Pandoc.Highlighting no longer exposed (API change)
* Text.Pandoc.Highlighting exports toListingsLang, fromListingsLang
2013-03-05 22:09:42 -08:00
John MacFarlane
756c8d492a --number-from -> --number-offset
Also `writerNumberFrom` -> `writeNumberOffset`.
The offset is a list of numbers (0 by default).
These are added to the section, subsection, etc.
numbers that would have been generated automatically.
2013-02-23 18:11:05 -08:00
John MacFarlane
91f507d393 --number-from implies --number-sections. 2013-02-22 19:42:11 -08:00
John MacFarlane
8df380486c Added --number-from option and writerNumberFrom.
These still aren't hooked up to anything in the writers.
2013-02-21 21:40:06 -08:00
John MacFarlane
ec5dc431de Changes to --version.
Print default user data directory.
Put language names in lowercase and omit 'alert' and 'alert_indent'.
2013-02-07 20:06:30 -08:00
John MacFarlane
7f4e1075be Changes to --version.
Print default user data directory.
Put language names in lowercase and omit 'alert' and 'alert_indent'.
2013-02-07 19:58:28 -08:00
John MacFarlane
c5f1a8ad2d Added --default-image-extension and readerDefaultImageExtension.
Note: Currently this only affects the markdown reader.
2013-02-05 20:08:00 -08:00
John MacFarlane
ce3d60d98e Updated copyright dates. 2013-01-19 11:11:45 -08:00
John MacFarlane
8eab759a9c RTF writer: Added writeRTFWithEmbeddedImages.
* RTF writer:  Export writeRTFWithEmbeddedImages instead of
  rtfEmbedImage.
* Text.Pandoc: Use writeRTFWithEmbeddedImages for RTF.
* Moved code for embedding images in RTF out of pandoc.hs.
2013-01-18 10:33:37 -08:00
John MacFarlane
eebed6bc48 Added writerHtmlQTags and --html-q-tags option.
The previous default was to use `<q>` tags in HTML5.
But `<q>` tags are also valid HTML4, and they are not very
robust in HTML5.  Some user agents don't support them,
and some CSS resets prevent pandoc's quotes CSS from working
properly (e.g. bootstrap).  It seems a better default just
to insert quote characters, but the option is provided  for
those who have gotten used to using `<q>` tags.
2013-01-15 18:50:36 -08:00
John MacFarlane
acfe1d96ee pandoc.hs: Fix writerSourceDirectory when a URL is provided.
It should be the URL up to the path.
2013-01-11 15:44:50 -08:00
John MacFarlane
f8db21fa16 Options: Added phpMarkdownExtraExtensions.
And added markdown_phpextra input/output format.
2013-01-10 22:39:47 -08:00
John MacFarlane
c45ae571cc Changed --toc-level to --toc-depth. 2013-01-05 12:03:05 -08:00
John MacFarlane
7c10e57997 Changed --epub-toc-level to --toc-level.
Also writerEpubTOCLevel -> writerTOCLevel.
So far this is only implemented in the EPUB writer.
2013-01-05 11:36:55 -08:00
John MacFarlane
f4111ac827 Renamed local variable for consistency (EPUB->Epub). 2013-01-04 22:44:18 -08:00
John MacFarlane
e91bae4f5b Renamed writerEPUBMetadata -> writerEpubMetadata.
API change for consistency.
2013-01-04 22:41:27 -08:00
John MacFarlane
30361308e7 Added --epub-chapter-level and --epub-toc-level options.
Also added writerEpubChapterLevel and writerEpubTOCLevel fields
to WriterOptions.
2013-01-04 22:29:41 -08:00
John MacFarlane
3bea3635d6 Changed type of 'readers' in Text.Pandoc, so all readers are in IO.
Users who want pure readers can still get them; this just affects
the function getReader that looks up a reader based on the format
name.

The point of this change is to make it possible to print warnings
from the parser.
2013-01-03 22:55:55 -08:00
John MacFarlane
2014e2b4ea Fixed paths for LaTeXMathML and MathMLinHTML scripts. 2013-01-03 11:19:59 -08:00
John MacFarlane
1864bb0994 Data files changes.
* 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-12-29 17:54:07 -08:00
John MacFarlane
32c5a8e2dc Cabal file changes.
* Remove executable and library flags.
* Expose `Text.Pandoc.XML` and `Text.Pandoc.Biblio`.
* Depend on pandoc library in executable, so we don't recompile
  everything.
* Move pandoc.hs from src/ to .
2012-12-29 16:43:22 -08:00
Renamed from src/pandoc.hs (Browse further)