Commit graph

13148 commits

Author SHA1 Message Date
Mike Tzou
225e7210f0
Improvements to trypandoc (#6188)
* Use "strict mode" for javascript code

* Fetch resources over https

Otherwise it will depend on the protocol of the webpage served which is
a bad idea.

* Remove unnecessary attributes

Those attributes are not required in HTML5.
2020-03-15 09:46:53 -07:00
Albert Krewinkel
a5fa55969f
Use implicit Prelude (#6187)
* 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.
2020-03-15 09:45:44 -07:00
Albert Krewinkel
76705dfeb0
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.
2020-03-15 09:55:34 +01:00
Albert Krewinkel
ec49643d64
Subdivide Text.Pandoc.Class into small modules (#6106)
* Extract CommonState into submodule

* Extract PandocMonad into submodule

* PandocMonad: ensure all functions have Haddock documentation
2020-03-14 20:49:36 -07:00
Albert Krewinkel
11b5f1e40b
Update copyright year (#6186)
* Update copyright year

* Copyright: add notes for Lua and Jira modules
2020-03-13 09:52:47 -07:00
Albert Krewinkel
9ffa8100d7
tools: delete Lua documentation helper cruft
The tools were useful to generate documentation from the Lua sources.
However, most Lua functions are defined in Haskell, and the even
documentation of functions written in Lua has been updated manually for
quite a while now. The unused helper scripts, which have bit-rot to the
point that they now produce broken links, are therefore removed.
2020-03-13 14:22:23 +01:00
Albert Krewinkel
24da280000
Lua marshalling: Remove unused language extensions 2020-03-13 09:52:28 +01:00
Albert Krewinkel
7eb9914841
Jira reader: support colored inline text, indented lists
* Support for colored inlines has been added.
* Lists are now allowed to be indented; i.e., lists are still recognized
  if list markers are preceded by spaces.

Closes: #6183, #6184
2020-03-13 09:52:28 +01:00
Albert Krewinkel
91f2bcfe73
linux/Dockerfile: upgrade to alpine 3.11
Closes: #6180
2020-03-10 15:18:30 +01:00
John MacFarlane
87875763c8 Ms writer: fix definition lists so indent even when...
paragraph indent is set to 0 (as is the default).

Also ensure indent for display math that falls back
to TeX.
2020-03-07 21:54:29 -08:00
John MacFarlane
2ab83a56e6 Ms writer: use .QS/.QE instead of .RS/.RE for block quotes. 2020-03-06 09:45:46 -08:00
John MacFarlane
aaf296508a Fix man reader test for previous change. 2020-03-05 19:34:17 -08:00
John MacFarlane
4faac2bf9b Fix parsing of \' in man/ms readers.
It was being parsed as a backtick.
Closes #6175.
2020-03-05 19:29:14 -08:00
John MacFarlane
4eb0c1eec1 Fix parsing of \. in man/ms readers.
Previously due to a typo it was being parsed as `` ` ``.

Closes #6175.
2020-03-05 19:22:41 -08:00
John MacFarlane
c78b30bd28 EPUB writer: fix regression on detection of front/back/bodymatter.
This bug caused sections with epub:type "dedication" to be
misplaced in bodymatter instead of frontmatter as specified
in the manual.  The same problem would affect other epub:types.

The pattern matching needed to be changed with the use of
`makeSection`.  Closes #6170.
2020-03-04 08:42:57 -08:00
John MacFarlane
43711ade22 PDF via wkhtmltopdf: put user-specified options last.
Certain options (e.g. "cover") need to come after flags on
the command line.  Closes #6171.
2020-03-02 15:26:11 -08:00
John MacFarlane
2c09b15b8d Fix table alignment when heading begins with t.
Due to a typo (`t` instead of `\t`) we were center
aligning column headings that begin with a lowercase t!
Closes #6153.
2020-02-21 08:06:19 -08:00
John MacFarlane
984a82a9b8 Text.Pandoc.App: set resource path at the beginning...
...so it can affect things like include-in-header.

See #5982.
2020-02-19 16:56:20 -08:00
John MacFarlane
9feefa3931 Revert "stack.yaml - switch to lts-15."
This reverts commit a238128a8e.

This version fails on Windows.  We get the following log output:

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Building all executables for `pandoc' once. After a successful build of all of them, only specified executables will be rebuilt.
pandoc> configure (lib + exe + test)
Configuring pandoc-2.9.2...
pandoc> build (lib + exe + test)
Preprocessing library for pandoc-2.9.2..
Building library for pandoc-2.9.2..
[  1 of 162] Compiling Paths_pandoc
[  2 of 162] Compiling Text.Pandoc.App.FormatHeuristics
[  3 of 162] Compiling Text.Pandoc.Asciify
[  4 of 162] Compiling Text.Pandoc.CSV
[  5 of 162] Compiling Text.Pandoc.Data
C:\Users\runneradmin\AppData\Roaming\stack\snapshots\9b7c3910\lib\x86_64-windows-ghc-8.8.2\texmath-0.12.0.1-LHa5Nt7Y9k12Dq03wVcYbb\HStexmath-0.12.0.1-LHa5Nt7Y9k12Dq03wVcYbb.o: unhandled PEi386 relocation type 0
ghc.exe: unable to load package `texmath-0.12.0.1'
      C:\Users\runneradmin\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.2.exe --builddir=.stack-work\dist\29cc6475 build lib:pandoc exe:pandoc test:test-pandoc --ghc-options " -fdiagnostics-color=always"
2020-02-17 16:52:46 -08:00
John MacFarlane
a238128a8e stack.yaml - switch to lts-15. 2020-02-17 15:59:18 -08:00
John MacFarlane
0edc084c50 Revert "Allow specifying string value in metadata using !!literal tag."
This reverts commit 3493d6afaa.

This might be worth considering in the future, but let's not do
it yet...the additional complexity needs a better justification.
2020-02-17 15:58:21 -08:00
John MacFarlane
3493d6afaa Allow specifying string value in metadata using !!literal tag.
This is experimental.  Normally metadata values are interpreted
as markdown, but if the !!literal tag is used they will be interpreted
as plain strings.

We need to consider whether this can still be implemented if
we switch back from HsYAML to yaml for performance reasons.
2020-02-17 09:53:36 -08:00
Ryan Scott
6a01386cd1
Remove redundant otherwise guard in inlineToAsciiDoc (#6146)
The `RawInline` case in `inlineToAsciiDoc` currenty looks like this:

```hs
inlineToAsciiDoc _ il@(RawInline f s)
  | f == "asciidoc" = return $ literal s
  | otherwise         = do
      report $ InlineNotRendered il
      return empty
  | otherwise       = return empty
```

Notice how there are there are two overlapping `otherwise` guards.
The second `otherwise` guard is completely unreachable, so this patch
removes it.
2020-02-17 08:03:50 -08:00
John MacFarlane
0808c2a03f Fix typo in changelog. 2020-02-16 07:33:06 -08:00
John MacFarlane
a4fb3b036b Small changelog fix. 2020-02-16 07:31:06 -08:00
John MacFarlane
87b9ee87e6 Use pandoc-citeproc 0.17. 2020-02-15 21:51:39 -08:00
John MacFarlane
0010d15bcf Update README.md. 2020-02-15 21:28:53 -08:00
John MacFarlane
cdbb14de5b Update changelog and man page. 2020-02-15 21:26:29 -08:00
John MacFarlane
33fcac40d5 Use latest texmath. 2020-02-15 09:12:56 -08:00
John MacFarlane
4a5e7b2ada make pandoc-templates: copy README and styles.*. 2020-02-14 09:07:10 -08:00
Ethan Riley
daf770c1e9
Fixes: group biblatex citations even with prefix and suffix (#6058)
Closes #5849.  Previously biblatex citations were only grouped if
there was no prefix.  This patch allows them to be grouped in
subgroups split by prefixes and suffixes, which allows better citation
sorting.
2020-02-14 08:44:40 -08:00
Joseph C. Sible
652ed0b82c
A bit more cleanup (#6141)
* Remove unnecessary fmaps and only do toMilliseconds once

* Share the input tuple intead of making a new one

* Lift return out of if

* Simplify case statements

* Lift DottedNum out of the case statements

* Use st instead of mbs

* Use setState instead of updateState now that we have the whole state around
2020-02-13 22:52:51 -08:00
Lucas Escot
29c2670da2
Add highlight directive to the rST reader (#6140) 2020-02-13 10:27:34 -08:00
John MacFarlane
3a181f0a97 Add Text.Pandoc.Image with unexported svgToPng. 2020-02-12 21:57:00 -08:00
Albert Krewinkel
f5ea5f0aad
Introduce new format variants for JATS (#6067)
New formats:

- `jats_archiving` for the "Archiving and Interchange Tag Set",
- `jats_publishing` for the "Journal Publishing Tag Set", and
- `jats_articleauthoring` for the "Article Authoring Tag Set."

The "jats" output format is now an alias for "jats_archiving".

Closes: #6014
2020-02-12 20:36:02 -08:00
John MacFarlane
e9cb08e74c sample.lua - fix error message.
image_format not img_format.

Closes #6135.
2020-02-12 20:34:20 -08:00
John MacFarlane
3a79f37d88 LaTeX reader: improve caption and label parsing.
- Don't emit empty Span elements for labels.
- Put tables with labels in a surrounding Div.
2020-02-12 17:43:55 -08:00
John MacFarlane
1433aaa4c3 HTML reader: don't parse data-id as id attribute.
And similarly don't parse any `data-X` as `X` when `X`
is a valid HTML attribute.

Reported in comment on #5415.
2020-02-12 08:47:32 -08:00
John MacFarlane
fae8ea36f0 Moved html5Attributes, html4Attributes, rdfaAttributes...
from T.P.Writers.HTML (where they were unexported) to
T.P.XML (where they are now exported).

[API change: new exported functions]

This allows these sets to be used elsewhere, e.g.
in the HTML reader.
2020-02-12 08:45:59 -08:00
John MacFarlane
3fbee8c6ed LaTeX reader: resolve \ref to table numbers.
Closes #6137.
2020-02-11 22:28:06 -08:00
Caleb Maclennan
4bd8a35e8f
sample.lua: Fix typo in descriptive comments (#6136) 2020-02-11 09:30:48 -08:00
John MacFarlane
114d77c2ab Fix spurious dots in markdown_mmd metadata output
Closes #6133 (regression).
2020-02-10 09:00:21 -08:00
Albert Krewinkel
689cb7128f
Org reader: simplify parsing of sub- and superscripts
Speeds up parsing of single-word, markup-less sub- and superscripts.

Fixes: #6127
2020-02-08 21:07:57 +01:00
John MacFarlane
5f0bd52221 reveal.js: ensure that pauses work even in title slides.
Closes #5819.
2020-02-08 09:38:07 -08:00
Joseph C. Sible
f2f559003e Factor out a findM function (#6125)
This adds a new function to the API: Text.Pandoc.Shared.findM.
2020-02-08 09:12:30 -08:00
Joseph C. Sible
12c75701be
Use <$> instead of >>= and return (#6128) 2020-02-08 09:12:01 -08:00
Joseph C. Sible
e97a99616e Clean up after "hlint --refactor" (#6129)
HLint's automatic refactoring isn't quite perfect, so some of its
changes were overcomplicated, wrong, or created new findings.
Clean these up.
2020-02-08 09:11:00 -08:00
Joseph C. Sible
02ff42b178
More cleanup (#6130)
* Use an infix operator normally instead of immediately applying an operator section

* Use M.fromList
2020-02-08 09:09:33 -08:00
John MacFarlane
4c3db9273f Apply linter suggestions. Add fix_spacing to lint target in Makefile. 2020-02-07 09:08:22 -08:00
Albert Krewinkel
6cd77d4c63
Resolve HLint warnings
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
2020-02-07 10:17:24 +01:00