Commit Graph
16004 Commits
Author SHA1 Message Date
John MacFarlane 0535a8f98c Fix compiler warning. 2022-10-17 21:15:54 -07:00
John MacFarlane ff0efa6faf T.P.Error: Remove PandocParsecError constructor from PandocError.
T.P.Parsing now exports `fromParsecError`, which can be used
to turn a parsec ParseError into a regular PandocParseError
(the appearance to the user should be unchanged in every case).

[API change]

Closes #8382.
2022-10-17 19:15:52 -07:00
John MacFarlane 1a61eec293 Adjust tests for CSS change; add CSS comments to mark...
highlighting CSS and citations CSS in the source.
2022-10-17 16:59:56 -07:00
John MacFarlane 5ca064b401 Fix typo introduced by recent commit in styles.html. 2022-10-17 16:31:01 -07:00
John MacFarlane 1e7b57e1e8 MediaWiki writer: avoid extra section divs with repeated ids.
Closes #8383.

Previously when converting HTML with headings nested under
section elements, pandoc would produce HTML div tags and
a span with an identifier duplicating the one on the div.

It seems better just to omit the superstructure of section
divs, so that's what this commit does, yielding more
normal MediaWiki output.
2022-10-17 15:14:09 -07:00
John MacFarlane 0cc48b560e Use styles.citations.html partial in styles.html. 2022-10-17 15:09:40 -07:00
John MacFarlane 3666d79ae7 EPUB CSS changes.
With this change, we reduce the amount of inline CSS used
for EPUBs.  Almost everything is now in the default EPUB
CSS (`data/epub.css`), which can be overridden either by
putting `epub.css` in the user data directory or by using
`--css` on the command line.  Inline styles are only used
for syntax highlighting (which depends on the style specified,
and is only included on pages with highlighted code) and
for bibliography formatting (which can depend on the CSL
style, and is only used in the page containing the bibliography).

Note that, for compatibility with older readers, we don't
use flexbox to style `column/columns` divs by default, as
we do in HTML.  Instead, we use an older method which only
works when there are two `column` divs inside a `columns`
div.  If you need more than two columns and aren't worried
about support for older EPUB readers, you can modify the
default CSS (there is a comment in the CSS telling you what to do).

Closes #8379.
2022-10-17 13:36:18 -07:00
John MacFarlane ef432b4324 MANUAL: Clarify that --css should be used with -s. 2022-10-17 08:09:47 -07:00
John MacFarlane 34479e3954 T.P.Readers.VimWiki: avoid direct import of parsec. 2022-10-16 23:24:30 -07:00
John MacFarlane bf96a3a83a T.P.Parsing: export errorMessages, messageString.
[API change]
2022-10-16 23:15:22 -07:00
John MacFarlane c64ac35ae2 T.P.Parsing: Remove gratuitious renaming of Parsec types.
We were exporting Parser, ParserT as synonyms of Parsec, ParsecT.
There is no good reason for this and it can cause confusion.

Also, when possible, we replace imports of Text.Parsec with
T.P.Parsing. The idea is to make it easier, at some point,
to switch to megaparsec or another parsing engine if we want to.

T.P.Parsing new exports: Stream(..), updatePosString, SourceName,
Parsec, ParsecT [API change].

Removed exports: Parser, ParserT [API change].
2022-10-16 20:01:01 -07:00
John MacFarlane 276335bcea Makefile: add ghcid target 2022-10-16 19:57:16 -07:00
John MacFarlane abb7aab75f RST writer: improve inline escaping rules.
Also a small performance optimization.

Closes #8380.
2022-10-16 14:59:28 -07:00
John MacFarlane fa450607a8 Makefile: fix .PHONY for test and build. 2022-10-16 14:59:22 -07:00
Albert Krewinkel f189579770 MANUAL: fix reference link in section "pandoc-lua" 2022-10-16 21:39:37 +02:00
Albert Krewinkel af2b4c47bb Lua: fix rendering of Lua errors in Lua
Otherwise the `Error running Lua` message can be prepended multiple
times.
2022-10-16 21:38:25 +02:00
John MacFarlane c8ef079c0f Makefile: hide command output for make binpath.
This allows:

    alias pandoc=`make binpath`

for convenient local testing of a build.
2022-10-16 11:30:26 -07:00
John MacFarlane d348dfa39e 'make help': add environment variables and default values. 2022-10-16 11:29:07 -07:00
John MacFarlane d849fe4525 Makefile changes.
Rename quick-cabal -> all, quick-test -> test.

Add binpath target.
2022-10-16 11:20:53 -07:00
Albert Krewinkel 2463477229 Lua: fix peeker for PandocError.
String error messages were incorrectly popped of the stack when
retrieving a PandocError.
2022-10-16 17:10:00 +02:00
John MacFarlane 726c54de27 Use skylighting 0.13.1. 2022-10-15 15:36:48 -07:00
John MacFarlane 1195f5bb3b Minor code cleanups. 2022-10-15 11:43:56 -07:00
John MacFarlane 8a21aa8142 Update changelog. 2022-10-14 10:56:01 -07:00
Albert Krewinkel dac059eb3e changelog: remove reverted change.
The change in template handling was reverted via #8372.
2022-10-14 19:52:38 +02:00
Albert Krewinkel 8900b0f953 Lua: Support built-in default templates for custom writers
Custom writers can define a default template via a global `Template`
function; the data directory is no longer searched for a default
template.

Writer authors can restore the old lookup behavior with

``` lua
Template = function ()
  local template
  return template.compile(template.default(PANDOC_SCRIPT_FILE))
end
```
2022-10-14 10:37:37 -07:00
Albert Krewinkel 06ba4e9788 doc/custom-writers.md: fix formatting 2022-10-14 17:14:49 +02:00
Ilona d501199aea doc/custom-writers.md: Rephrase paragraph on format extensions (#8375) 2022-10-14 17:13:24 +02:00
John MacFarlane 27ecd894ca CI: make sure we catch benchmark build failure. 2022-10-13 23:46:07 -07:00
John MacFarlane 7312e36104 Extensions: simpler implementation based on Set.
This implementation would allow us (if we wanted) to add
an extensible Ext_custom Text constructor.
2022-10-13 23:36:25 -07:00
John MacFarlane e26c8eca69 Got benchmarks compiling with new API. 2022-10-13 23:36:25 -07:00
John MacFarlane cc8ed74c25 FlavoredFormat: add Show, Semigroup, Monad instances 2022-10-13 23:36:25 -07:00
Albert Krewinkel 64fe7b1e2f Changelog: fix some typos, attribution 2022-10-14 08:03:16 +02:00
John MacFarlane 65812a8a2f Update changelog. 2022-10-13 21:17:21 -07:00
John MacFarlane f486fcde13 Rollback parameterize options on scripting engine.
Rolls back 0ab014ed1e.
We don't need this because we aren't needing to print the Lua
version in options any more; we're handling `--version` now at
the pandoc-cli level.
2022-10-13 17:59:49 -07:00
Albert Krewinkel 14c7b5db20 Lua: add function pandoc.template.meta_to_context.
The functions converts Meta values to template contexts; the intended
use is in combination with `pandoc.template.apply`.
2022-10-12 10:16:01 -07:00
Albert Krewinkel 253d2e768a Lua: support extensions in custom readers.
Like custom readers, like writers, can define the set of supported
extensions by setting a global. E.g.:

``` lua
reader_extensions = {
  smart = true,
  citations = false,
}
```
2022-10-12 11:58:18 +02:00
Albert Krewinkel 543cb5d45d Lua: allow Doc values in WriterOptions.variables.
The specialized peeker and pusher function for `Context Text` values
does not go via JSON, and thus keeps Doc values unchanged during
round-tripping.
2022-10-12 11:35:44 +02:00
Albert Krewinkel 78d7fc46fe Lua: add function pandoc.template.apply
The new function applies a context, containing variable assignments, to
a template.
2022-10-11 14:03:08 -07:00
Albert Krewinkel 3cac33bdd2 Templates: use filename to search for default template of custom writers
The default template of a custom writer `/path/to/my-writer.lua` is
expected in the `templates/default.my-writer.lua` data file. Note that
templates are *not* applied automatically to the output of custom
writers; custom writer authors must ensure that the template is applied
if one is present in the writer options.

Closes: #8137
2022-10-11 18:19:31 +02:00
Albert Krewinkel 4a97f5799a Templates: do not try to normalize input to getDefaultTemplate
The function `getDefaultTemplate` no longer splits off extension
modifers from the given format, as that conflicts with using custom
writers as formats. Haskell library users should use `getDefaultTemplate
<=< (fmap formatName . parseFlavoredFormat)` if the input format can
still contain extensions. The same is true for `compileDefaultTemplate`,
which calls `getDefaultTemplate` internally.
2022-10-11 18:17:25 +02:00
John MacFarlane 1612cc3bf4 Simplify some citation code in LaTeX writer. 2022-10-10 21:17:56 -07:00
Albert Krewinkel a088cbf563 Lua: support extensions in custom writers
Custom writers can define the extensions that they support via the
global `writer_extensions`. The variable's value must be a table with
all supported extensions as keys, and their default status as values.

E.g., the below specifies that the writer support the extensions `smart`
and `sourcepos`, but only the `smart` extension is enabled by default:

    writer_extensions = {
      smart = true,
      sourcepos = false,
    }
2022-10-10 09:39:18 -07:00
John MacFarlane e1e07cce65 MANUAL.txt: add note about MathJax fonts to --embed-resources. 2022-10-10 09:34:40 -07:00
Albert Krewinkel 44827c1161 doc/libraries.md: add hslua-cli and the hslua-module-* packages 2022-10-10 16:59:20 +02:00
Amir Dekel 31aa660e65 Org reader: make #+pandoc-emphasis-pre work as expected. (#8360)
So far, `orgStateLastPreCharPos` wasn't updated appropriately after each
parsing to native Str (by the parser `str`). In addition to solving
this, the guard `notAfterString` in `emphasisStart` is removed to allow
emphasis after Str at the first place.
2022-10-10 12:20:58 +02:00
Albert Krewinkel 8f4308f2e5 doc/lua-filters.md: deprecate PANDOC_WRITER_OPTIONS in custom writers 2022-10-10 12:09:09 +02:00
Albert Krewinkel a5ffaaa413 Lua: support custom bytestring readers. 2022-10-10 11:27:42 +02:00
Albert Krewinkel d6fb8fb20f Remove redundant import from T.P.Scripting 2022-10-10 09:25:01 +02:00
Albert Krewinkel 3e1d3b5e5e Lua: use Reader type for custom readers. 2022-10-10 09:13:09 +02:00
John MacFarlane 5d858e4119 HTML writer; Properly merge classes for headings of level > 6.
Previously we got two separate `class` attributes in the `p`
tag. Closes #8363.
2022-10-09 16:04:36 -07:00