Commit graph

4898 commits

Author SHA1 Message Date
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
John MacFarlane
d29ef39f6f EPUB writer: fix paths for cover image.
Closes #4069.
2017-11-14 20:57:41 -08:00
John MacFarlane
51897937cd LaTeX reader: allow optional arguments on \footnote.
Closes #4062.
2017-11-13 21:19:38 -08:00
John MacFarlane
8d6e0e516a Markdown writer: fix bug with doubled footnotes in grid tables.
Closes #4061.
2017-11-13 21:12:04 -08:00
Alexander Krotov
3a83b3843d Replace "emacs" extension with "amuse" extension
It makes clear that extension is related to Muse markup.
2017-11-13 18:41:49 +03:00
John MacFarlane
b85921259d Fix comment that confuses haddock. 2017-11-12 16:51:49 -08:00
John MacFarlane
eeaa3b048c LaTeX reader: support column specs like *{2}{r}.
This is equivalent to `rr`.  We now expand it like a macro.

Closes #4056.
2017-11-12 14:46:29 -08:00
John MacFarlane
7ba0ae8b4d LaTeX reader: allow optional args for parbox.
See #4056.
2017-11-12 14:19:58 -08:00
Alexander Krotov
df4cb20f29 Muse reader: accept Emacs Muse definition lists
Emacs Muse does not require indentation.
2017-11-12 18:08:41 +03:00
Alexander Krotov
f13f142945 Add emacs extension 2017-11-12 16:06:22 +03:00
John MacFarlane
6094c84b7a Functor instance to fix ghc 7.8 warning. 2017-11-11 21:13:43 -08:00
John MacFarlane
6174b5bea5 Add lua filter functions to walk inline and block elements.
Refactored some code from Text.Pandoc.Lua.PandocModule
into new internal module Text.Pandoc.Lua.Filter.

Add `walk_inline` and `walk_block` in pandoc lua module.
2017-11-11 14:41:11 -08:00
John MacFarlane
fb5ba1bb00 Fixed YAML metadata with "chomp" (|-).
Previously if a YAML block under `|-` contained
a blank line, pandoc would not parse it as metadata.
2017-11-11 10:17:53 -05:00
Alexander Krotov
f501ad031d MediaWiki reader: hlint 2017-11-11 03:12:15 +03:00
Alexander Krotov
6e832a571b Txt2Tags reader: hlint 2017-11-10 14:48:11 +03:00
Alexander Krotov
207b3edcb9 Vimwiki reader: hlint 2017-11-10 13:26:39 +03:00
John MacFarlane
1592d38821 Allow fenced code blocks to be indented 1-3 spaces.
This brings our handling of them into alignment with
CommonMark's.

Closes #??.
2017-11-09 23:22:44 -05:00
Alexander Krotov
f72d763655 HTML reader: hlint 2017-11-10 02:23:58 +03:00
John MacFarlane
fef5770591 Fix regression with --metadata.
It should replace a metadata value set in the document
itself, rather than creating a list including a new value.

Closes #4054.
2017-11-08 21:54:23 -08:00
John MacFarlane
c6338fa883 EPUB writer: fixed modified paths for raw HTML tags
(src, poster, etc.)  This had not been updated for the
new EPUB container layout, with a separate text/ subdirectory.
Closes #4050. Closes #4055.
2017-11-08 17:07:27 -08:00
John MacFarlane
5a4c0d6a8c Deprecated ancient HTML math methods.
`--latexmathml`,
`--gladtex`,
`--mimetex`,
`--jsmath`
2017-11-07 13:05:06 -08:00
John MacFarlane
b0b90aba62 EPUB writer: fixed EPUB OCF structure.
The structure of the EPUBs was messed up, and #3720 was
improperly implemented.  This commit fixes things.
2017-11-07 12:24:37 -08:00
John MacFarlane
36449d3ea4 EPUB writer: fix image paths with empty --epub-subdirectory. 2017-11-07 08:30:52 -08:00
Alexander Krotov
38ad0b3204 Spellcheck comments 2017-11-06 06:56:21 +03:00
John MacFarlane
8e8d7802ee Logging: issue INFO, not WARNING, if LaTeX .sty file can't be read.
Normally this is not a situation requiring a fix from the user,
so a warning is inappropriate.
2017-11-04 17:07:55 -07:00
John MacFarlane
fe42c175eb Revert "Better indentation under headers in org mode output."
This reverts commit 1a81751cef.
2017-11-04 11:32:47 -07:00
John MacFarlane
1a81751cef Better indentation under headers in org mode output.
See #4036.

Close examination by org experts needed, to ensure that
nothing breaks.
2017-11-04 11:25:38 -07:00
John MacFarlane
8e53489cbc Fix strikethrough in gfm writer.
Previously we got a crash, because we were trying to print
a native cmark STRIKETHROUGH node, and the commonmark writer
in cmark-github doesn't support this.  Work around this by
using a raw node to add the strikethrough delimiters.

Closes #4038.
2017-11-04 10:35:52 -07:00