Commit graph

206 commits

Author SHA1 Message Date
John MacFarlane
49502b9a02 Added a type signature 2017-01-25 17:07:41 +01:00
John MacFarlane
1bdf23c697 More refactoring of pandoc.hs for clarity. 2017-01-25 17:07:41 +01:00
John MacFarlane
8beba65977 Slight code rearrangement in preparation for...
...passing mediabag in the PandocIO monad.
2017-01-25 17:07:41 +01:00
John MacFarlane
87170e2af4 Removed deprecated --no-wrap option. 2017-01-25 17:07:41 +01:00
John MacFarlane
767638a54e Removed deprecated --chapters option. 2017-01-25 17:07:41 +01:00
John MacFarlane
ce1664cf2b Simplified reference-docx/reference-odt to reference-doc.
* Text.Pandoc.Options.WriterOptions: removed writerReferenceDocx
  and writerReferenceODT, replaced them with writerReferenceDoc.
  This can hold either an ODT or a Docx. In this way, writerReferenceDoc
  is like writerTemplate, which can hold templates of different
  formats. [API change]

* Removed `--reference-docx` and `--reference-odt` options.

* Added `--reference-doc` option.
2017-01-25 17:07:41 +01:00
John MacFarlane
9570f59066 Process.pipeProcess: stream stderr rather than capturing.
Signature of pipeProcess has changed: the return value is
now IO (ExitCode, ByteString) -- with only stdout. Stderr
is just inherited from the parent.

This means that stderr from filters will now be streamed
as the filters are run.

Closes #2729.
2017-01-25 17:07:41 +01:00
John MacFarlane
70aa7b0485 Added --fail-if-warnings option. 2017-01-25 17:07:40 +01:00
John MacFarlane
1a0d93a1d3 LaTeX reader: Proper include file processing.
* Removed handleIncludes from LaTeX reader [API change].
* Now the ordinary LaTeX reader handles includes in a way
  that is appropriate to the monad it is run in.
2017-01-25 17:07:40 +01:00
John MacFarlane
63dc6bd025 Added a --quiet option to suppress warnings.
Use this also in Tests.Old.
2017-01-25 17:07:40 +01:00
John MacFarlane
5ab8909661 New withWarningsToStderr exported from Text.Pandoc.Class.
And use this in pandoc.hs so that messages actually get printed.
2017-01-25 17:07:40 +01:00
Jesse Rosenthal
3cda737dbd Remove redundant import. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
52859b9863 Finish converting readers over. 2017-01-25 17:07:40 +01:00
Jesse Rosenthal
5a02a81b43 Have to do some work to get the mediabag out. 2017-01-25 17:07:40 +01:00
John MacFarlane
300d94ac24 Deleted whitespace at end of source lines. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
04545c92c8 Clean up Text.Pandoc
We had primed versions of all the Writer types and getWriter
functions, as we transitioned. Now that we're using the new ones
exclusively, we'll get rid of the old ones, and get rid of the primes in
the names.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
04487779b2 Convert all writers to use PandocMonad.
Since PandocMonad is an instance of MonadError, this will allow us, in a
future commit, to change all invocations of `error` to `throwError`,
which will be preferable for the pure versions. At the moment, we're
disabling the lua custom writers (this is temporary).

This requires changing the type of the Writer in Text.Pandoc. Right now,
we run `runIOorExplode` in pandoc.hs, to make the conversion easier. We
can switch it to the safer `runIO` in the future.

Note that this required a change to Text.Pandoc.PDF as well. Since
running an external program is necessarily IO, we can be clearer about
using PandocIO.
2017-01-25 17:07:39 +01:00
John MacFarlane
b596d20605 Some fixes to permit breezeDark style. 2017-01-19 16:32:35 +01:00
John MacFarlane
46b1c31925 Add breezeDark to the list of highlighting styles. 2017-01-19 15:59:57 +01:00
John MacFarlane
9d781b1454 Updates to use skylighting rather than highlighting-kate.
So far this just reproduces capacity.

Later we'll be able to add features like warning
messages, dynamic loading of xml syntax definitions,
and dynamic loading of themes.
2016-12-23 18:07:49 -07:00
John MacFarlane
9b9ec99ee8 We no longer need the MathMLInHTML.js shim from 2004! 2016-12-09 21:18:02 +01:00
John MacFarlane
1fde7a340b Set PANDOC_VERSION environment variable for filters.
Closes #2640.
2016-12-08 11:09:40 +01:00
John MacFarlane
b0733190b0 Fixed bash completion for filenames with spaces.
Closes #2749.
2016-12-07 17:37:27 +01:00
John MacFarlane
fb8a2540bd Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless
a template was provided in writerTemplate.  Now a fragment
will be generated if writerTemplate is Nothing; otherwise,
the specified template will be used and standalone output
generated.  [API change]
2016-11-30 15:34:58 +01:00
Albert Krewinkel
1fc07ff4da Refactor top-level division selection (#3261)
The "default" option is no longer represented as `Nothing` but via a new
type constructor, making the `Maybe` wrapper superfluous.

The default behavior of using heuristics can now be enabled explicitly
by setting `--top-level-division=default`.

API change (`Text.Pandoc.Options`): The `Division` type was renamed to
`TopLevelDivision`. The `Section`, `Chapter`, and `Part` constructors
were renamed to `TopLevelSection`, `TopLevelChapter`, and
`TopLevelPart`, respectively. An additional `TopLevelDefault`
constructor was added, which is now also the new default value of the
`writerTopLevelDivision` field in `WriterOptions`.
2016-11-27 20:31:04 +01:00
Albert Krewinkel
baa25362a4 Allow to overwrite top-level division type heuristics (#3258)
Pandoc uses heuristics to determine the most resonable top-level
division type when emitting LaTeX or Docbook markup.  It is now possible
to overwrite this implicitly set top-level division via the
`top-level-division` command line parameter.

API change (`Text.Pandoc.Options`): the type of the
`writerTopLevelDivision` field in of the `WriterOptions` data type is
altered from `Division` to `Maybe Division`. The field's default value
is changed from `Section` to `Nothing`.

Closes: #3197
2016-11-26 21:43:46 +01:00
John MacFarlane
77753747d1 Cleaned up filter-finding.
* Removed a hardcoded '/' that may have caused problems with Windows
  paths.
* Cleaned up the logic.
2016-11-21 22:18:05 +01:00
John MacFarlane
ac6dfe0b4e Changed resolution of filter paths.
- We now first treat the argument of `--filter` as a full (absolute
  or relative) path, looking for a program there.  If it's found,
  we run it.
- If not, and if it is a simple program name or a relative path,
  we try resolving it relative to `$DATADIR/filters`.
- If this fails, then we treat it as a program name and look in
  the user's PATH.

Previously if you did `--filter foo` and you had `foo` in your
path and also an executable `foo` in your working directory,
the one in the path would be used. Now the one in the working
directory is used.

In addition, when you do `--filter foo/bar.hs`, pandoc will now
find a filter `$DATADIR/filters/foo/bar.hs` -- assuming there
isn't a `foo/bar.hs` relative to the working directory.

@jkr note the slight revision of what we had before.
This was motivated by the idea that one might clone filter
repositories into the filters subdirectory; it is nice to
be able to run them as `reponame/filtername`.
2016-11-21 15:32:27 +01:00
John MacFarlane
20b2269fb7 In --version, trap error in getAppUserDataDirectory.
This fixes a crash with `pandoc --version` on unusual systems with
no real user (e.g. SQL Server 2016).  Closes #3241.
2016-11-18 11:25:13 +01:00
John MacFarlane
7db4dd46dc Allow file:// URIs as arguments.
Also improved default reader format detection.  Previously
with a URI ending in .md or .markdown, pandoc would assume HTML input.
Now it treats these as markdown.

Closes #3196.
2016-11-05 20:24:29 +01:00
John MacFarlane
e6422b1deb Improved error if they give wrong arg to --top-level-division. 2016-11-03 11:17:10 +01:00
John MacFarlane
626d0b7193 Print highlighting-kate version in --version. 2016-10-26 21:57:29 +02:00
John MacFarlane
d51e475bad Export Text.Pandoc.Error in Text.Pandoc.
[API change]
2016-10-24 22:31:36 +02:00
John MacFarlane
10bd57ecb6 Fixed typo in deprecation warning. 2016-10-24 16:05:26 +02:00
John MacFarlane
738806112b Allow binary formats to be written to stdout unless tty output.
Only works on posix.  On Windows, pandoc works as before and
requires an output file parameter for binary formats.

Closes #2677.
2016-10-23 22:16:00 +02:00
John MacFarlane
273d90bc19 Added --list-* options.
Added `--list-input-formats`, `--list-output-formats`,
`--list-extensions`, `--list-highlight-languages`,
`--list-highlight-styles`.

Removed list of highlighting languages from `--version`
output.

Removed list of input and output formats from default
`--help` output.

Closes #3173.
2016-10-23 21:35:54 +02:00
Albert Krewinkel
595a171407
Add option for top-level division type
The `--chapters` option is replaced with `--top-level-division` which allows
users to specify the type as which top-level headers should be output. Possible
values are `section` (the default), `chapter`, or `part`.

The formats LaTeX, ConTeXt, and Docbook allow `part` as top-level division, TEI
only allows to set the `type` attribute on `div` containers.  The writers are
altered to respect this option in a sensible way.
2016-10-19 13:12:57 +02:00
Oliver Matthews
23fb52ef7d
Add --parts command line option to LaTeX writer.
Add --parts command line argument.
This only effects LaTeX writer, and only for non-beamer output formats.
It changes the output levels so the top level is 'part', the next
'chapter' and then into sections.
2016-09-06 21:43:45 +02:00
Jesse Rosenthal
14209b2ba0 Add reference-location options to executable. 2016-10-11 15:17:07 -04:00
KolenCheung
4d621f43d9 Replace Google Chart API by CodeCogs 2016-10-06 11:04:37 +02:00
KolenCheung
f7d92b5765 Update KaTeX to v0.6.0 2016-10-03 23:53:16 -07:00
Jakob Voß
06fa6986d1 Execute .js filters with node 2016-09-30 07:20:43 +02:00
Jesse Rosenthal
ec6d0638be Check $DATADIR/filters for filters
If the `$DATADIR/filters` is present, pandoc will look in it for filters
specified without a path, before looking in the $PATH. Note that unlike
executables in $PATH, the `filters` dir may contain scripts that are not
executable (pandoc will try to execute them using an associated
interpreter, if possible).

Note: the `filters` dir has priority over the user path. In order of
preference, pandoc will look in:

  1. a specified full or relative path (executable or non-executable)
  2. `$DATADIR/filters` (executable or non-executable)
  3. `$PATH` (executable only)

This closes #3127.
2016-09-27 11:56:39 -04:00
Waldir Pimenta
35e1d6d9f7 synchronize spacing of footnotes in help output
- remove a space between `[` and `*` in the list of input formats, to match the list of output formats
- add space after the `*`s, for improved readability
2016-08-16 15:54:24 +01:00
John MacFarlane
58d60b1c85 Changed email-obfuscation default to no obfuscation.
- `writerEmailObfuscation` in `defaultWriterOptions` is now
  `NoObfuscation`
- the default for the command-line `--email-obfuscation` option is
  now `none`.

Closes #2988.
2016-06-20 10:37:23 -07:00
John MacFarlane
054e6abd0d Revert "New method for checking for presence of tex program."
This reverts commit 285bbf61cf.
2016-05-12 21:01:30 -07:00
John MacFarlane
5d8d8b0de1 Revert "Use shell instead of proc to check for latex program."
This reverts commit ee45be5723.
2016-05-12 21:00:33 -07:00
John MacFarlane
1b8d006ac8 Revert "Require process >= 1.2.1."
This reverts commit 07a4320ba9.
2016-05-12 20:59:08 -07:00
John MacFarlane
07a4320ba9 Require process >= 1.2.1.
We need `createProcess_` to be exported.
2016-05-12 11:08:56 -07:00
John MacFarlane
1ddc71e01e Added some CSS to handle older versions of process.
`createProcess_` is in Internals until process 1.2.1.
2016-05-11 17:43:47 -07:00