Commit graph

12639 commits

Author SHA1 Message Date
John MacFarlane
d0bddaf7b9 Use latest pandoc-citeproc. 2019-09-02 21:26:20 -07:00
John MacFarlane
6b286a1d74 LaTeX reader: don't try to parse includes if raw_tex is set.
When the `raw_tex` extension is set, we just carry through
`\usepackage`, `\input`, etc. verbatim as raw LaTeX.

Closes #5673.
2019-09-02 21:03:05 -07:00
John MacFarlane
d79242796b HTML writer: use numeric character references with --ascii.
Previously we used named character references with html5 output.
But these aren't valid XML, and we aim to produce html5 that is
also valid XHTML (polyglot markup).  (This is also needed for
epub3.)

Closes #5718.
2019-09-02 20:36:57 -07:00
John MacFarlane
5e708eb8ce LaTeX reader: properly handle optional arguments for macros.
Closes #5682.
2019-09-02 18:48:37 -07:00
John MacFarlane
3fac27b26b LaTeX writer: strip off {} around locator for biblatex/natbib output.
Closes #5722.
2019-09-02 17:07:35 -07:00
John MacFarlane
e9ba29e57f Use doctemplates 0.6. 2019-09-02 11:14:14 -07:00
John MacFarlane
716483e03a html2pdf: ensure temp file is deleted...
even if the pdf program is not found.

Closes #5720.
2019-08-31 09:18:21 -07:00
John MacFarlane
fba1296fd1 LaTeX reader: fix \\ in \parbox inside a table cell.
Closes #5711.
2019-08-27 10:48:02 -07:00
John MacFarlane
167fc4bc87 Markdown reader: Headers: don't parse content over newline boundary.
Closes #5714.
2019-08-27 10:15:00 -07:00
John MacFarlane
7c03c26d58 Add stateAllowLineBreaks to ParserState. [API change] 2019-08-27 10:04:02 -07:00
Jesse Rosenthal
4a7dad18b1 PowerPoint writer: Start numbering at appopriate numbers.
Starting numbers for ordered lists were previously ignored. Now we
specify the number if it is something other than 1.

Closes: #5709
2019-08-27 01:24:41 -04:00
John MacFarlane
62dc2f893e Comment out ghc 8.8.1 build for now. 2019-08-26 18:12:59 -07:00
John MacFarlane
ffbd690cbc Simplify stack.yaml after cabal file changes.
We don't need so many local ghc options now that they're
specified in pandoc.cabal.

I've kept `-fhide-source-paths` (in case we move this out
of pandoc.cabal) and `-Wno-missing-home-modules` (which seems
to be needed for `stack ghci` to work).
2019-08-26 17:37:06 -07:00
Albert Krewinkel
cd4b8f66bb Cabal cleanup (#5693)
* pandoc.cabal: remove conditionals for ghc < 8.0. Support for GHC 7.10 has been dropped.
* pandoc.cabal: compile with `-Wcpp-undef` when possible
* pandoc.cabal: compile with `-fhide-source-paths` if possible
2019-08-26 17:04:30 -07:00
John MacFarlane
b446c6c448 parseFromString': reset stateLastStrPos to Nothing before parse. 2019-08-26 15:52:25 -07:00
John MacFarlane
1dec5bacaa Use parseFromString' in Muse reader.
Now that it is polymorphic, this is possible, and it's a
better choice because it resets last string pos.
2019-08-26 15:30:58 -07:00
John MacFarlane
21c44da17a Fix inline parsing in grid table cells.
* T.P.Parsing: Change type of `setLastStrPos` so it takes a
  `Maybe SourcePos` rather than a `SourcePos`. [API change]
* T.P.Parsing: Make `parseFromString'` and `gridTableWith` and
  `gridTableWith'` polymorphic in the parser state, constraining it with
  `HasLastStrPosition`.  [API change]

Closes #5708.
2019-08-26 15:25:39 -07:00
John MacFarlane
180f534d21 Add test for issue #5708. 2019-08-26 15:20:22 -07:00
John MacFarlane
faae6f16c7 Add ghc 8.8.1 to CI. 2019-08-26 13:06:04 -07:00
John MacFarlane
8a26422bfc Use dev version of doctemplates. 2019-08-25 23:49:40 -07:00
John MacFarlane
2143d4d2a0 Better message for PandocTemplateError. 2019-08-25 23:49:25 -07:00
John MacFarlane
e2c4d1ccfc Makefile: add ghcid target. 2019-08-25 15:38:17 -07:00
John MacFarlane
188bd5e1e9 Update cabal.project to use released doctemplates. 2019-08-25 14:30:19 -07:00
John MacFarlane
1ee6e0e087 Use new doctemplates, doclayout.
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change]
+ Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON'
  [API change].
+ Text.Pandoc.Writers.Shared: modify `addVariablesToContext`,
  `defField`, `setField`, `getField`, `resetField` to work with
  Context rather than JSON values. [API change]
+ Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API
  change].
+ Use new templates and doclayout in writers.
+ Use Doc-based templates in all writers.
+ Adjust three tests for minor template rendering differences.
+ Added indentation to body in docbook4, docbook5 templates.

The main impact of this change is better reflowing of content
interpolated into templates.  Previously, interpolated variables
were rendered independently and intepolated as strings, which could lead
to overly long lines.  Now the templates interpolated as Doc values
which may include breaking spaces, and reflowing occurs
after template interpolation rather than before.
2019-08-25 14:24:31 -07:00
John MacFarlane
8959c44e6a Got benchmarks working with ipynb. 2019-08-25 14:24:31 -07:00
John MacFarlane
fdb7a5b79f Don't add a newline if there's already one. 2019-08-25 14:24:31 -07:00
Owen McGrath
92debe4b9e Change optMetadataFile type from Maybe to List (#5702)
Changed optMetadataFile from `Maybe FilePath` to `[FilePath]`. This allows
for multiple YAML metadata files to be added. The new default value has
been changed from `Nothing` to `[]`.

To account for this change in `Text.Pandoc.App`, `metaDataFromFile` now
operates on two `mapM` calls (for `readFileLazy` and `yamlToMeta`) and a fold.

Added a test (command/5700.md) which tests this functionality and
updated MANUAL.txt, as per the contributing guidelines.

With the current behavior, using `foldr1 (<>)`, values within files
specified first will be used over those in later files. (If the reverse
of this behavior would be preferred, it should be fixed by changing
foldr1 to foldl1.)
2019-08-24 09:41:25 -07:00
John MacFarlane
5b11ca03e1 Use released pandoc-types. 2019-08-23 12:50:58 -07:00
John MacFarlane
cbccf17375 Require pandoc-types 1.17.6. 2019-08-23 11:05:55 -07:00
John MacFarlane
9d581428f9 Add test for #5690. 2019-08-23 10:15:42 -07:00
John MacFarlane
d6fdfe6f2b Asciidoc writer: handle admonitions.
Closes #5690.
2019-08-23 10:00:10 -07:00
John MacFarlane
8e01ccb41d RST reader: use title, not admonition-title, for admonition title.
This puts RST reader into alignment with docbook reader.
2019-08-23 09:23:15 -07:00
John MacFarlane
1c71bd1ff5 Ensure proper nesting when we have long ordered list markers.
Closes #5705.
2019-08-23 09:16:54 -07:00
Michael Peyton Jones
9b5082b086 docbook: richer parse for admonitions (#5593)
Fixes #1234.

This parses admonitions not as a blockquote, but rather as a div with an
appropriate class. We also handle titles for admonitions as a nested div
with the "title" class.

(I followed the behaviour of other docbook-to-html converters in this -
there are clearly other ways you could encode it.)

In general, the handling of elements with nested title elements is very
inconsistent. I think we should make it consistent, but I'm leaivng that
for later to make this a small change.

Example:
```docbook
<warning xml:id="someId">
<title>My title</title>
<simpara>An admonition block</simpara>
</warning>
```

goes to

```html
<div id="someId" class="warning">
<div class="title">My title</div>
<p>An admonition block</p>
</div>
```
2019-08-23 09:13:31 -07:00
Krystof Beuermann
3344f861c4 add proofState to settingsList (#5703) 2019-08-23 08:45:37 -07:00
Albert Krewinkel
a5094dda61
Circle CI: use fpco/stack-build:lts-13 as base image 2019-08-16 20:52:15 +02:00
Albert Krewinkel
6166f9499f
cabal.project: remove options unsupported by GHC 8.0 2019-08-16 20:52:15 +02:00
Albert Krewinkel
1f9384542e
Lua: improve function documentations 2019-08-16 20:52:15 +02:00
Albert Krewinkel
2712d3e869
Lua: traverse nested blocks and inlines in correct order
Traversal methods are updated to use the new Walk module such that
sequences with nested Inline (or Block) elements are traversed in the
order in which they appear in the linearized document.

Fixes: #5667
2019-08-16 20:52:15 +02:00
Albert Krewinkel
813e1fc7e0
Lua: add module for AST element sequence traversal
Lua filters must be able to traverse sequences of AST elements and to
replace elements by splicing sequences back in their place. Special
`Walkable` instances can be used for this; those are provided in a new
module `Text.Pandoc.Lua.Walk`.
2019-08-16 20:52:15 +02:00
Albert Krewinkel
903d2f98c6
pandoc.cabal: add cabal.project to extra-source-files. 2019-08-15 19:28:17 +02:00
John MacFarlane
79a3449eeb LaTeX reader: improve withRaw so it can handle cases where...
the token string is modified by a parser (e.g. accent when
it only takes part of a Word token).

Closes #5686.  Still not ideal, because we get the whole
`\t0BAR` and not just `\t0` as a raw latex inline command.
But I'm willing to let this be an edge case, since you
can easily work around this by inserting a space, braces,
or raw attribute.  The important thing is that we no longer
drop the rest of the document after a raw latex inline
command that gobbles only part of a Word token!
2019-08-14 14:34:44 -07:00
John MacFarlane
e85178c32a Removed some needless lookaheads in Markdown reader. 2019-08-14 11:43:08 -07:00
John MacFarlane
eb23527121 Rename test for 5685 -> 5684 (typo in last commit).
Closes #5684. (Note that #5685 is NOT closed by previous commit.)
2019-08-14 11:13:18 -07:00
John MacFarlane
0b2fb9b8f9 Add thin space when needed in LaTeX quote ligatures.
Closes #5685.
2019-08-14 11:07:02 -07:00
Mauro Bieg
ace4cdfc23 MANUAL: link to YAML spec (#5687) 2019-08-14 10:09:19 -07:00
Zihang Chen
d4fa38a0a5 Fix multiline table for XWiki writer (#5683)
Details at https://groups.google.com/forum/#!topic/pandoc-discuss/c861tTdCFTg

Fix XWiki output for

```
+----------+----------+
| Col A    | Col B    |
+==========+==========+
| Row A    | * Item A |
|          | * Item B |
+----------+----------+
```

from (notice that the following XWiki code renders as a table followed by a singleton list)

```
|=Col A|=Col B
|Row A|*. Item A
*. Item B
```

to

```
|=Col A|=Col B
|Row A|(((*. Item A
*. Item B
)))
```
2019-08-13 16:37:41 -07:00
Jan-Otto Kröpke
a0a41c7a8e JIRA writer: Remove escapeStringForJira for code blocks 2019-08-11 21:57:12 +02:00
Leif Metcalf
e53c952997 Remove blank line (#5679) 2019-08-08 16:02:14 -07:00
John MacFarlane
6dd689ad97 Revert "Avoid a pointless Text -> String conversion on output."
This reverts commit 87ce1ffbd9.

This change caused a problem on Windows that we didn't have
before; this needs looking into.

https://ci.appveyor.com/project/jgm/pandoc/build/job/fxq96log042df8dk

    .\pandoc.exe -s --toc ..\MANUAL.txt -o MANUAL.html
    pandoc.exe: MANUAL.html: commitAndReleaseBuffer: invalid argument (invalid character)
    Command exited with code 1
2019-08-08 13:39:12 -07:00