Age | Commit message (Collapse) | Author | Files | Lines |
|
Previously, when multiple file arguments were provided, pandoc
simply concatenated them and passed the contents to the readers,
which took a Text argument.
As a result, the readers had no way of knowing which file
was the source of any particular bit of text. This meant that
we couldn't report accurate source positions on errors or
include accurate source positions as attributes in the AST.
More seriously, it meant that we couldn't resolve resource
paths relative to the files containing them
(see e.g. #5501, #6632, #6384, #3752).
Add Text.Pandoc.Sources (exported module), with a `Sources` type
and a `ToSources` class. A `Sources` wraps a list of `(SourcePos,
Text)` pairs. [API change] A parsec `Stream` instance is provided for
`Sources`. The module also exports versions of parsec's `satisfy` and
other Char parsers that track source positions accurately from a
`Sources` stream (or any instance of the new `UpdateSourcePos` class).
Text.Pandoc.Parsing now exports these modified Char parsers instead of
the ones parsec provides. Modified parsers to use a `Sources` as stream
[API change].
The readers that previously took a `Text` argument have been
modified to take any instance of `ToSources`. So, they may still
be used with a `Text`, but they can also be used with a `Sources`
object.
In Text.Pandoc.Error, modified the constructor PandocParsecError
to take a `Sources` rather than a `Text` as first argument,
so parse error locations can be accurately reported.
T.P.Error: showPos, do not print "-" as source name.
|
|
Muse and Org were defining their own F anyway, with their
own state. We therefore move this definition to the Markdown
reader.
|
|
|
|
|
|
Previously, if `--resource-path` were used multiple times, the last
resource path would replace the others.
With this change, each time `--resource-path` is used, it prepends
the specified path components to the existing resource path.
Similarly, when `resource-path` is specified in a defaults file,
the paths provided will be prepended to the existing resource
path.
This change also allows one to avoid using the OS-specific path
separator; instead, one can simply use `--resource-path`
a number of times with single paths. This form of command
will not have an OS-dependent behavior.
This change facilitates the use of multiple, small defaults
files: each can specify a directory containing its own
resources without clobbering the resource paths set by
the others.
Closes #6152.
|
|
to refer to the directory where the default file is.
This will make it possible to create moveable
"packages" of resources in a directory.
Closes #5871.
|
|
This allows the syntax `${HOME}` to be used, in fields that expect
file paths only. Any environment variable may be interpolated
in this way. A warning will be raised for undefined variables.
The special variable `USERDATA` is automatically set to the
user data directory in force when the defaults file is parsed.
(Note: it may be different from the eventual user data directory,
if the defaults file or further command line options change that.)
Closes #5982.
Closes #5977.
Closes #6108 (path not taken).
|
|
* Add `optCSL`, `optBibliography`, `optCitationAbbreviations` to
`Opt` [API change].
* Move `addMeta` from T.P.App.Opt to T.P.App.CommandLineOptions.
|
|
[API change] This affects `readFile`, `getContents`, `writeFileWith`,
`writeFile`, `putStrWith`, `putStr`, `putStrLnWith`, `putStrLn`.
`hPutStrWith`, `hPutStr`, `hPutStrLnWith`, `hPutStrLn`, `hGetContents`.
This avoids the need to uselessly create a linked list of characters
when emiting output.
|
|
Exported by Text.Pandoc.App.
|
|
`mkdn`, `mkd`, `mdwn`, `mdown`, `Rmd`.
Closes #7034.
|
|
|
|
Allow defaults files to inherit options from other defaults files by
specifying them with the following syntax:
`defaults: [list of defaults files or single defaults file]`.
|
|
|
|
|
|
Previously we used Setext (underlined) headings by default.
The default is now ATX (`##` style).
* Add the `--markdown-headings=atx|setext` option.
* Deprecate `--atx-headers`.
* Add constructor 'ATXHeadingInLHS` constructor to `LogMessage` [API change].
* Support `markdown-headings` in defaults files.
* Document new options in MANUAL.
Closes #6662.
|
|
|
|
Add ipynb version. Put user data directory on same line as
heading "User data directory" (dropping "default").
|
|
Use space more efficiently and report the citeproc version along
with skylighting, texmath, and pandoc-types.
|
|
Languages appear to be sorted by their long name, which leads to
unexpected results: e.g., the long name of *m4* is *GNU m4*, so it is
listed between *gnuassembler* and *go*.
|
|
This deprecates the use of the external pandoc-citeproc
filter; citation processing is now built in to pandoc.
* Add dependency on citeproc library.
* Add Text.Pandoc.Citeproc module (and some associated unexported
modules under Text.Pandoc.Citeproc). Exports `processCitations`.
[API change]
* Add data files needed for Text.Pandoc.Citeproc: default.csl
in the data directory, and a citeproc directory that is just
used at compile-time. Note that we've added file-embed as a mandatory
rather than a conditional depedency, because of the biblatex
localization files. We might eventually want to use readDataFile
for this, but it would take some code reorganization.
* Text.Pandoc.Loging: Add `CiteprocWarning` to `LogMessage` and use it
in `processCitations`. [API change]
* Add tests from the pandoc-citeproc package as command tests (including
some tests pandoc-citeproc did not pass).
* Remove instructions for building pandoc-citeproc from CI and
release binary build instructions. We will no longer distribute
pandoc-citeproc.
* Markdown reader: tweak abbreviation support. Don't insert a
nonbreaking space after a potential abbreviation if it comes right before
a note or citation. This messes up several things, including citeproc's
moving of note citations.
* Add `csljson` as and input and output format. This allows pandoc
to convert between `csljson` and other bibliography formats,
and to generate formatted versions of CSL JSON bibliographies.
* Add module Text.Pandoc.Writers.CslJson, exporting `writeCslJson`. [API
change]
* Add module Text.Pandoc.Readers.CslJson, exporting `readCslJson`. [API
change]
* Added `bibtex`, `biblatex` as input formats. This allows pandoc
to convert between BibLaTeX and BibTeX and other bibliography formats,
and to generated formatted versions of BibTeX/BibLaTeX bibliographies.
* Add module Text.Pandoc.Readers.BibTeX, exporting `readBibTeX` and
`readBibLaTeX`. [API change]
* Make "standalone" implicit if output format is a bibliography format.
This is needed because pandoc readers for bibliography formats put
the bibliographic information in the `references` field of metadata;
and unless standalone is specified, metadata gets ignored.
(TODO: This needs improvement. We should trigger standalone for the
reader when the input format is bibliographic, and for the writer
when the output format is markdown.)
* Carry over `citationNoteNum` to `citationNoteNumber`. This was just
ignored in pandoc-citeproc.
* Text.Pandoc.Filter: Add `CiteprocFilter` constructor to Filter.
[API change] This runs the processCitations transformation.
We need to treat it like a filter so it can be placed
in the sequence of filter runs (after some, before others).
In FromYAML, this is parsed from `citeproc` or `{type: citeproc}`,
so this special filter may be specified either way in a defaults file
(or by `citeproc: true`, though this gives no control of positioning
relative to other filters). TODO: we need to add something to the
manual section on defaults files for this.
* Add deprecation warning if `upandoc-citeproc` filter is used.
* Add `--citeproc/-C` option to trigger citation processing.
This behaves like a filter and will be positioned
relative to filters as they appear on the command line.
* Rewrote the manual on citatations, adding a dedicated Citations
section which also includes some information formerly found in
the pandoc-citeproc man page.
* Look for CSL styles in the `csl` subdirectory of the pandoc user data
directory. This changes the old pandoc-citeproc behavior, which looked
in `~/.csl`. Users can simply symlink `~/.csl` to the `csl`
subdirectory of their pandoc user data directory if they want
the old behavior.
* Add support for CSL bibliography entry formatting to LaTeX, HTML,
Ms writers. Added CSL-related CSS to styles.html.
|
|
See #5127. It is now used everywhere a file argument can be used.
Closes #5127.
|
|
* Fix hlint suggestions, update hlint.yaml
Most suggestions were redundant brackets. Some required
LambdaCase.
The .hlint.yaml file had a small typo, and didn't ignore camelCase
suggestions in certain modules.
|
|
Previously we added this in processing command line options,
but not in processing defaults files, which was inconsistent.
Cloess #6593.
|
|
|
|
|
|
which hasn't been updated for ghc 8.10.
See discussion at #6187.
|
|
This commit adds the option `--no-check-certificate`, which disables certificate
checking when resources are fetched by HTTP.
Co-authored-by: Cécile Chemin <cecile.chemin@insee.fr>
Co-authored-by: Juliette Fourcot <juliette.fourcot@insee.fr>
|
|
* Use implicit Prelude
The previous behavior was introduced as a fix for #4464. It seems that
this change alone did not fix the issue, and `stack ghci` and `cabal
repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded
for these versions. Given this, it seems cleaner to revert to the
implicit Prelude.
* PandocMonad: remove outdated check for base version
Only base versions 4.9 and later are supported, the check for
`MIN_VERSION_base(4,8,0)` is therefore unnecessary.
* Always use custom prelude
Previously, the custom prelude was used only with older GHC versions, as
a workaround for problems with ghci. The ghci problems are resolved by
replacing package `base` with `base-noprelude`, allowing for consistent
use of the custom prelude across all GHC versions.
|
|
* Update copyright year
* Copyright: add notes for Lua and Jira modules
|
|
This adds a new function to the API: Text.Pandoc.Shared.findM.
|
|
|
|
All warnings are either fixed or, if more appropriate, HLint is
configured to ignore them. HLint suggestions remain.
* Ignore "Use camelCase" warnings in Lua and legacy code
* Fix or ignore remaining HLint warnings
* Remove redundant brackets
* Remove redundant `return`s
* Remove redundant as-pattern
* Fuse mapM_/map
* Use `.` to shorten code
* Remove redundant `fmap`
* Remove unused LANGUAGE pragmas
* Hoist `not` in Text.Pandoc.App
* Use fewer imports for `Text.DocTemplates`
* Remove redundant `do`s
* Remove redundant `$`s
* Jira reader: remove unnecessary parentheses
|
|
* Avoid duplicating the dash case
* Pull common functions out of case branches
* Make sure list lengths are only calculated once
* Use unless
* Simplify parseURIReference' and avoid an unnecessary call to length
* Use <$> instead of reimplementing it
* Use swap instead of reimplementing it
* Remove eta-expansion that's been unnecessary since 90f5dd8
* Use tailDef instead of reimplementing it
* Use second instead of fmap, per @tarleb
|
|
|
|
Move addMeta from T.P.App.CommandLineOptions to T.P.App.Opt.
(not an api change because modules not exported)
|
|
This adds csv as an input format.
The CSV table is converted into a pandoc simple table.
Closes #6100.
|
|
This avoids some unnecessary unpacking.
(This is only an internal module so it's not an API change.)
|
|
Since the website now redirect to https automatically, it would be nice to just use https in the help text.
|
|
The semigroup instance for doctemplates Context does a left-biased
union on the underlying Map. That means that if you union
`{a: 1}` and `{a: 2}`, you get `{a: 1}`. This commit causes
pandoc to do the operation in the opposite order, so that later
default files take precedence in the values they assign to
keys.
See #5988.
|
|
* Text.Pandoc.Templates [API change]
+ Add Monad wrappers `WithDefaultPartials` and `WithPartials`.
Wrapping these around an instance of `PandocMonad` gives
us different instances of `TemplateMonad`, with different
search behavior in retrieving partials.
To compile a template and limit partial search to pandoc's
data files, use `runWithDefaultPartials (compileTemplate ...)`.
To compile a template and allow partials to be found locally
(either on the file system or via HTTP, in the event that
the main template has an absolute URL), ue
`runWithPartials (compileTemplate ...)`.
+ Export `getTemplate`, which seeks a template locally,
or via HTTP if the template has an absolute URL, falling
back to the data files if not found.
+ Export `compileDefaultTemplate` -- does `getDefaultTemplate`
and compiles the result, raising an error on failure.
* Text.Pandoc.Class [API change]
+ Remove `TemplateMonad` instances for `PandocIO` and `PandocPure`.
These were too limiting and caused a bug whereby a local
partial could be used even when the default template was requested.
We now rely on instances provided in the Templates module.
Text.Pandoc.App.OutputSettings
+ Simplify template retrieval code.
|
|
Previously -Vfoo=1 -Vfoo=2 would produce a list value for foo;
with 2.8 it produced just '2'. This commit restores the earlier
beahvior.
Closes #5962.
|
|
Closes #5938.
|
|
It now implies `--standalone` again, as before.
|
|
Certain options (`--self-contained`, `--include-in-header`, etc.)
imply `--standalone`. We now handle this after option parsing
so that it affects options specified in defaults files too.
Behavior change: `--title-prefix` no longer implies `--standalone`.
|
|
Leaving it blank yields a Nothing value (interpreted as stdin).
Providing an empty list is intepreted as no input.
This resolves one part of #5888.
|
|
`Nothing` means: nothing specified.
`Just []` means: an empty list specified (e.g. in defaults).
Potentially these could lead to different behavior: see #5888.
|
|
Closes #5904.
|
|
See #5904.
|
|
Certain command-line arguments can be repeated:
`--metadata-file`, `--css`, `--include-in-header`,
`--include-before-body`, `--include-after-body`, `--variable`,
`--metadata`, `--syntax-definition`. In these cases, values
specified in default files should be added to the list rather
than replacing values specified earlier on the command line
(perhaps in other default files).
So, for example, if one does
pandoc --variable foo=3 --defaults d1 --defaults d2
and `d1` sets the variable `bar` and `d2` sets `baz`,
all three variables will be set.
Closes #5894.
|