Commit graph

5250 commits

Author SHA1 Message Date
John MacFarlane
29ec13184d LaTeX writer: escape ~ in code with --listings.
Closes #4111.
2017-12-01 17:17:26 -08:00
John MacFarlane
b2a190546d Revert "LaTeX writer: Add keepaspectratio to includegraphics..."
This reverts commit 171187a452.
2017-12-01 13:51:33 -08:00
Albert Krewinkel
6640506ddc
Lua/StackInstances: push Pandoc and Meta via constructor
Pandoc and Meta elements are now pushed by calling the respective
constructor functions of the pandoc Lua module. This makes serialization
consistent with the way blocks and inlines are pushed to lua and allows
to use List methods with the `blocks` value.
2017-12-01 17:58:12 +01:00
Albert Krewinkel
8473a151c5
List.lua: add missing fixes as discussed in #4099
The changes were missing due to an error while using git.
2017-12-01 17:12:56 +01:00
John MacFarlane
171187a452 LaTeX writer: Add keepaspectratio to includegraphics...
...if only one of height/width is given.
2017-11-30 16:03:28 -08:00
John MacFarlane
03ddac451e Support beamer \alert in LaTeX reader. Closes #4091. 2017-11-29 21:30:13 -08:00
John MacFarlane
a276bb0a8a Let papersizes a0, a1, a2, ... be case-insensitive in LaTeX and ConTeXt. 2017-11-29 09:45:38 -08:00
Alexander Krotov
7751391fce Muse reader: correctly remove indentation from notes
Exactly one space is required and considered to be part of the marker.
2017-11-29 05:12:25 +03:00
Albert Krewinkel
0105a3c293 Add basic lua List module (#4099)
The List module is automatically loaded, but not assigned to a global
variable. It can be included in filters by calling `List = require
'List'`.

Lists of blocks, lists of inlines, and lists of classes are now given
`List` as a metatable, making working with them more convenient. E.g.,
it is now possible to concatenate lists of inlines using Lua's
concatenation operator `..` (requires at least one of the operants to
have `List` as a metatable):

    function Emph (emph)
      local s = {pandoc.Space(), pandoc.Str 'emphasized'}
      return pandoc.Span(emph.content .. s)
    end

Closes: #4081
2017-11-28 17:20:01 -07:00
John MacFarlane
845b6c8670 Added --print-highlight-style option.
This generates a JSON version of a highlighting style, which can be
saved as a .theme file, modified, and used with `--highlight-style`.

Closes #4106.
Closes #4096.
2017-11-28 13:35:49 -08:00
John MacFarlane
00561b1bb9 Support --webtex for gfm output. 2017-11-28 10:56:32 -08:00
Mauro Bieg
393ce6f1e3 make normalizeDate more forgiving (#4101)
also parse two-digit days, e.g. "April 20, 2017"
2017-11-28 11:15:35 -07:00
Mauro Bieg
de75d4eaf9 Fix --help output for --highlight-style to include FILE (#4098)
Closes #4095.
2017-11-27 18:30:53 -07:00
Alexander Krotov
c2993a6fc6 Muse reader: parse "~~" as non-breaking space in Emacs mode 2017-11-27 12:25:06 +03:00
John MacFarlane
a1378ed76b Clearer deprecation warning for --latexmathml, --asciimathml, -m.
Previously we only mentioned `--latexmathml`, even if `-m` was
used.
2017-11-26 22:31:32 -08:00
Alexander Krotov
00004f042c Muse reader: make code blocks round trip 2017-11-27 04:54:23 +03:00
Alexander Krotov
bdad8c1d69 Muse reader: drop common space prefix from list items 2017-11-26 22:14:18 +03:00
Alexander Krotov
5ba890a973 Fix comment typo: s/elemnet/element/ 2017-11-25 22:47:29 +03:00
Alexander Krotov
ea2ea455b3 Muse reader: don't interpret XML entities 2017-11-25 22:46:25 +03:00
Alexander Krotov
887977c421 Muse reader: remove nested 2017-11-25 18:59:03 +03:00
Alexander Krotov
77af25b4c3 Muse reader: parse markup in definition list terms 2017-11-24 14:02:43 +03:00
Alexander Krotov
137c7c2a65 Muse reader: allow definition to end with EOF 2017-11-24 13:16:09 +03:00
Alexander Krotov
bd3feb864f Muse writer: improve inline normalization 2017-11-24 12:35:25 +03:00
Alexander Krotov
0cfd764d27 Muse: move inline list normalization to writer 2017-11-24 12:17:20 +03:00
Albert Krewinkel
cd85c73ded
Org reader: allow empty list items
Fixes: #4090
2017-11-22 22:53:24 +01:00
Alexander Krotov
75e2a1104c Muse reader: allow list items to be empty 2017-11-22 18:49:07 +03:00
Alexander Krotov
454062eccd Muse writer: escape hash symbol 2017-11-22 16:17:30 +03:00
Alexander Krotov
87e10ac28b Muse reader: don't allow blockquotes within lists 2017-11-22 15:22:39 +03:00
Alexander Krotov
e32657a671 Muse reader: fix reading of multiline definitions 2017-11-22 14:59:14 +03:00
Alexander Krotov
7e42857ed8 Muse writer: escape "----" to avoid accidental horizontal rules 2017-11-22 01:39:20 +03:00
Alexander Krotov
351765d4ad Muse reader: concatenate inlines of the same type 2017-11-22 01:22:43 +03:00
Alexander Krotov
df3a80cc97 Muse writer: escape only </code> inside code tag
Additional <verbatim> is not needed as <code> is verbatim already.
2017-11-22 01:22:43 +03:00
Jasper Van der Jeugt
cf87ffe9ee Change Generic JSON instances to TemplateHaskell (#4085) 2017-11-21 12:27:40 -08:00
John MacFarlane
fda4426883 Add comment explaining why TH is used in Text.Pandoc.App. 2017-11-21 09:22:06 -08:00
Jasper Van der Jeugt
30c1e53c42 Change JSON instances for Opt to TemplateHaskell (#4083)
The `Generic` JSON instances for `Text.Pandoc.App.Opt` seem to tickle a
particulary bad quadratic complexity case (Generics complexity is worse
than quadratic with respect to the number of fields in the datatype).
This is with GHC-8.2.1, I didn't test it using 8.0 but I assume it is
similar.

Using `Generic`, compilation of the `Text.Pandoc.App` module takes
minutes and often gets killed due to out of memory on slower machines
with "only" 8GB of accessible memory.  This is particularly annoying to
me since it means I cannot build pandoc on Travis.

TemplateHaskell is a little uglier, but the module seems to compile
within a few seconds, and compilation doesn't take more than 1GB of
memory.

Should I also change the other JSON instances throughout the codebase
for consistency?
2017-11-21 09:20:05 -08:00
Alexander Krotov
6c17117ef2 Muse reader: add inline <literal> support 2017-11-21 19:53:55 +03:00
Alexander Krotov
046f5bcc81 Muse reader: chop newlines after <literal> and before </literal> 2017-11-21 19:01:53 +03:00
Alexander Krotov
91d6733426 Muse reader: <literal> has "style" attribute, not "format" 2017-11-21 19:01:53 +03:00
Alexander Krotov
1b970cca13 Recognize ".muse" file extension 2017-11-21 14:08:14 +03:00
John MacFarlane
97efed8c23 Allow spaces after \( and before \) with tex_math_single_backslash.
Previously `\( \frac{1}{a} < \frac{1}{b} \)` was not parsed as math
in `markdown` or `html` `+tex_math_single_backslash`.
2017-11-19 13:06:03 -08:00
Alexander Krotov
82bcda80c6 Muse reader: count only one space as part of list item marker 2017-11-19 04:40:00 +03:00
Alexander Krotov
163af3fdee Muse reader: produce SoftBreaks on newlines
Now wrapping can be preserved with --wrap=preserve
2017-11-19 02:37:52 +03:00
John MacFarlane
b9cdef03f0 HTML reader: ensure we don't produce level 0 headers,
even for chapter sections in epubs.

This causes problems because writers aren't set up to
expect these.

This fixes the most immediate problem in #4076.
It would be good to think more about how to propagate
the information that top-level headers are chapters
from the reader to the writer.
2017-11-18 14:08:45 -08:00
Albert Krewinkel
53aafd6643 Lua filters: preload text module (#4077)
The `text` module is preloaded in lua. The module contains some UTF-8
aware string functions, implemented in Haskell.  The module is loaded on
request only, e.g.:

    text = require 'text'
    function Str (s)
      s.text = text.upper(s.text)
      return s
    end
2017-11-18 13:24:06 -08:00
Alexander Krotov
6018a2324d Muse reader: Add Text::Amuse footnote extensions
Footnote end is indicated by indentation,
so footnotes can be placed anywhere in the text,
not just at the end of it.
2017-11-18 23:43:02 +03:00
Alexander
26e59b331f Introduce HasSyntaxExtensions typeclass (#4074)
+ Added new `HasSyntaxExtensions` typeclass for `ReaderOptions` and `WriterOptions`.
+ Reimplemented `isEnabled` function from `Options.hs` to accept both `ReaderOptions`
  and `WriterOptions`.
+ Replaced `enabled` from `CommonMark.hs` with new `isEnabled`.
2017-11-16 09:24:02 -08:00
Sascha Wilde
4e02ed5f5c Creole reader: Fix performance issue for longer lists. (#4075)
Fixes #4067.
2017-11-15 17:38:11 -08:00
John MacFarlane
508aab0bd5 Text.Pandoc.Parsing.uri: allow & and = as word characters.
This fixes a bug where pandoc would stop parsing a URI with an
empty attribute:  for example, `&a=&b=` wolud stop at `a`.
(The uri parser tries to guess which punctuation characters
are part of the URI and which might be punctuation after it.)

Closes #4068.
2017-11-14 22:08:14 -08:00
John MacFarlane
22d69c8916 RST reader: better support for 'container' directive.
Create a div, incorporate name attribute and classes.

Closes #4066.
2017-11-14 21:20:30 -08:00
John MacFarlane
c2a68ad763 EPUB writer: Fixed path for cover image.
It was previously `media/media/imagename`, and should have
been `media/imagename`.
2017-11-14 21:06:24 -08:00