Commit graph

4077 commits

Author SHA1 Message Date
Jesse Rosenthal
1c589c51b1 ODT Writer: fix compiler complaint. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
f404412331 Free: Add Typeable instance to PandocActionError 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
2ea3e77172 Finish pure writer of FB2. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
e711043dee FB2 writer: Rewrite image-fetching to use fetchItem.
This uses the function from shared, which will allow us to convert it
over to the free monad.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
30cfda7a71 Continue refactoring FB2 writer. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
d97fb5f3c6 FB2 writer: bring functions to toplevel.
This is the first of a number of changes to bring the FB2 writer a bit
closer to the idioms used elsewhere in pandoc, so it can be more easily
converted to using the pure functions from Free.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
9ac1303660 Make pure rtf writer using free. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
590e119df0 Fix up compiler warnings.
Export TestState and TestEnv, and remove redundant import.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
e24d5a56a7 Implement runTest functions.
These work with a State monad and a Reader monad to produce
deterministic results. It can probably be simplified somewhat.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
072107d1a2 Remove IORef from EPUB writer. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
8d1d0eb9a5 Remove IORef from ODT writer.
We want pure writers, so IORef shouldn't be in there. We switch to using
a normal State Monad. If this produces performance problems, we can look
into trying STRefs, but that seems like unnecessary complication at the
moment.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
32c68dada9 Introduce pure versions of IO Writers.
Using Text.Pandoc.Free, introduce pure versions of Docx, EPUB, ICML, and
ODT writers. Each of the pure versions is exported along with the IO
version (produced by running `runIO` on the pure reader). Ideally, this
should make the writers easier to test.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
0ab4af2f03 New Free module, with pure versions of IO funcs
Introduce a new module, Text.Pandoc.Free, with pure versions, based on
the free monad, of numerous IO functions used in writers and
readers. These functions are in a pure
Monad (PandocAction). PandocAction takes as a parameter the type of
IORefs in it. It can be aliased in individual writers and readers to
avoid this parameter.

Note that this means that at the moment a reader can only use one type
of IORef. If possible, it would be nice to remove this limitation.
2017-01-25 17:07:39 +01:00
Hubert Plociniczak
a6b469c02b Adds support for pagebreaks (when it makes sense)
Update all writers to take into account page breaks.
A straightforwad, far from complete, implementation of page
breaks in selected writers.
Readers will have to follow in the future as well.
2017-01-25 17:07:39 +01:00
Hubert Plociniczak
30b3412857 Added page breaks into Pandoc.
This requires an updated version of pandoc-types that
introduces PageBreak definition.
Not that this initial commit only introduces ODT pagebreaks
and distinguishes for it page breaks before, after, or both,
the paragraph, as read from the style definition.
2017-01-25 17:07:39 +01:00
John MacFarlane
a5d855d342 Update list of listings languages in Highlighting.
This allows more languages to be used when using the `--listings`
option.

Closes #3374.
2017-01-25 12:35:14 +01:00
John MacFarlane
6d751cb386 OpenDocument writer: small refactoring.
Removed separate 'parent' param in paraStyle.
2017-01-24 15:01:39 +01:00
John MacFarlane
41f4476aab OpenDocument writer: don't profilerate text styles unnecessarily.
This change makes the writer create only as many temporary
text styles as are absolutely necessary. It also consolidates
adjacent nodes with the same style.

Closes #3371.
2017-01-23 15:18:34 +01:00
Albert Krewinkel
5729f1f2ea
Org reader: allow short hand for single-line raw blocks
Single-line raw blocks can be given via `#+FORMAT: raw line`, where
`FORMAT` must be one of `latex`, `beamer`, `html`, or `texinfo`.

Closes: #3366
2017-01-19 20:33:05 +01:00
John MacFarlane
06bdb8dbab MediaWiki reader: improved handling of display math.
Sometimes display math is indented with more than one colon.
Previously we handled these cases badly, generating definition
lists and missing the math.

Closes #3362.
2017-01-19 11:24:19 +01:00
John MacFarlane
4781819a6b Fixed -f markdown_github-hard_line_breaks+escaped_line_breaks.
Previously this did not properly enable escaped line breaks.
Closes #3341.
2017-01-08 10:01:19 +01:00
Albert Krewinkel
4da41bdb8e
Remove pipe char irking the haddock coverage tool
Haddock documentation strings must be associated with functions. Remove
pipe char from a comment that was moved into a `do` block in
`Readers/Org/Inlines.hs`.
2017-01-06 18:59:07 +01:00
Albert Krewinkel
4ca420e937
Org reader: accept org-ref citations followed by commas
Bugfix for an issue which, whenever the citation was immediately followed by a
comma, prevented correct parsing of org-ref citations.
2017-01-06 18:22:19 +01:00
Albert Krewinkel
21e6ca1976 Org reader: ensure emphasis markup can be nested
Nested emphasis markup (e.g. `/*strong and emphasized*/`) was
interpreted incorrectly in that the inner markup was not recognized.
2017-01-05 23:30:46 +01:00
tgkokk
f2e3e756f8 MediaWiki reader: Fix quotation mark parsing (#3336)
Change MediaWiki reader's behavior when the smart option is parsed to
match other readers' behavior.

Fix #2012.
2017-01-05 21:24:33 +01:00
Mauro Bieg
32cbb8f46d DocBook5 writer: make id attribute xml:id, fixes #3329 (#3330) 2016-12-30 20:03:43 -07:00
Mauro Bieg
9b29a55d9b HTML writer: don't process pars with empty RawInline, fixes #1040 (#3327) 2016-12-24 14:41:54 -07:00
Mauro Bieg
0159956f7f markdown reader: disallow space between inline code and attributes (#3326)
closes #3323
2016-12-24 07:34:07 -07:00
John MacFarlane
9d781b1454 Updates to use skylighting rather than highlighting-kate.
So far this just reproduces capacity.

Later we'll be able to add features like warning
messages, dynamic loading of xml syntax definitions,
and dynamic loading of themes.
2016-12-23 18:07:49 -07:00
Albert Krewinkel
d27188ad30
Org writer: prefix footnote numbers with fn:
Unprefixed numbers where used by older org-mode versions, but are no
longer supported.
2016-12-21 23:51:15 +01:00
John MacFarlane
ee03272883 LaTeX writer: allow tables with empty cells to count as "plain."
This addresses a problem of too-wide tables when empty cells
are used.

Thanks to Joost Kremers for reporting the issue.
2016-12-16 14:03:58 +01:00
Jesse Rosenthal
60004cd518 Docx reader: Empty header should be list of lists.
In the past, the docx reader wrote an empty header as an empty list. It
should have the same width as a row (and be filled with empty cells).

(Note that I've reordered the code here slightly to get rid of a call to
`head`. It wasn't unsafe because it tested for null, but it was a bit of
a smell.)
2016-12-13 07:04:40 -05:00
John MacFarlane
7caaa5b2b6 Fix display math with --webtex in markdown output.
Closes #3298.
2016-12-11 17:00:58 +01:00
Jesse Rosenthal
8ced8cbc6e Docx reader: Ensure one-row tables don't have header.
Tables in MS Word are set by default to have special first-row
formatting, which pandoc uses to determine whether or not they have a
header. This means that one-row tables will, by default, have only a
header -- which we imagine is not what people want. This change
ensures that a one-row table is not understood to be a header only.

Note that this means that it is impossible to produce a header-only
table from docx, even though it is legal pandoc. But we believe that
in nearly all cases, it will be an accidental (and unwelcome) result

Closes #3285.
2016-12-08 07:01:01 -05:00
John MacFarlane
6708c6a7fc Removed debug trace from HTML reader. 2016-12-08 11:06:50 +01:00
John MacFarlane
7ce622475c HTML reader: Understand style=width: as well as width in col.
Closes #3286.
2016-12-07 15:21:01 +01:00
John MacFarlane
0e9c96d28a RST reader: print warnings when keys, substitition, notes not found.
Previously the parsers failed and we got raw text.
Now we get a link with an empty URL, or empty inlines in
the case of a note or substitution.
2016-12-07 13:03:56 +01:00
John MacFarlane
7fbfcb03d8 RST reader: fix hyperlink aliases.
`link <google_>`_

    .. _google: https://google.com

is really a reference link.

Closes #3283.
2016-12-07 12:54:25 +01:00
John MacFarlane
97274c9991 Fixed some bad regressions in HTML table parser.
This regression leads to the introduction of empty rows
in some circumstances.

Closes #3280.
2016-12-06 23:20:28 +01:00
John MacFarlane
41627ed62c Man writer: Ensure that periods are escaped at beginning of line.
Closes #3270.
2016-12-05 00:50:17 +01:00
John MacFarlane
33b4bc8371 Pretty: Added afterBreak.
This makes it possible to insert escape codes for content
that needs escaping at the beginning of a line.
2016-12-05 00:49:53 +01:00
Albert Krewinkel
bfa734c402
LaTeX writer: Fix unnumbered headers when used with --top-level
Fix interaction of top-level divisions `part` or `chapter` with
unnumbered headers when emitting LaTeX.  Headers are ensured to be
written using stared commands (like `\subsection*{}`).

Fixes: #3272
2016-12-04 21:15:52 +01:00
John MacFarlane
7ace7dd66b Markdown writer: Fixed incorrect word wrapping.
Previously pandoc would sometimes wrap lines too early
due to this bug.

Closes #3277.
2016-12-04 17:13:06 +01:00
John MacFarlane
fb8a2540bd Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless
a template was provided in writerTemplate.  Now a fragment
will be generated if writerTemplate is Nothing; otherwise,
the specified template will be used and standalone output
generated.  [API change]
2016-11-30 15:34:58 +01:00
John MacFarlane
ac83d4b806 Use new module from texmath to lookup MS font codepoints.
+ Removed Text.Pandoc.Readers.Docx.Fonts
+ Moved its code to texmath; we now use (from texmath 0.9)
  Text.TeXMath.Unicode.Fonts
+ Use texmath 0.9 (currently from git).
+ Updated epub tests because texmath now handles more mathml.
2016-11-30 00:43:55 +01:00
John MacFarlane
e2a452ba4a Shared.fetchItem: Better handling of protocol-relative URL.
If URL starts with `//` and there is no "base URL" (as there
would be if a URL were used on the command line), then default
to http:.

Closes #2635.
2016-11-27 21:19:26 +01:00
John MacFarlane
ea916432ac Updated renderHtml import in HTML writer to avoid deprecated function. 2016-11-27 21:18:58 +01:00
Albert Krewinkel
1fc07ff4da Refactor top-level division selection (#3261)
The "default" option is no longer represented as `Nothing` but via a new
type constructor, making the `Maybe` wrapper superfluous.

The default behavior of using heuristics can now be enabled explicitly
by setting `--top-level-division=default`.

API change (`Text.Pandoc.Options`): The `Division` type was renamed to
`TopLevelDivision`. The `Section`, `Chapter`, and `Part` constructors
were renamed to `TopLevelSection`, `TopLevelChapter`, and
`TopLevelPart`, respectively. An additional `TopLevelDefault`
constructor was added, which is now also the new default value of the
`writerTopLevelDivision` field in `WriterOptions`.
2016-11-27 20:31:04 +01:00
John MacFarlane
5222572033 HTML reader: improved table parsing.
We now check explicitly for non-1 rowspan or colspan
attributes, and fail when we encounter them. Previously
we checked that each row had the same number of cells,
but that could be true even with rowspans/colspans.
And there are cases where it isn't true in tables that
we can handle fine -- e.g. when a tr element is empty.
So now we just pad rows with empty cells when needed.

Closes #3027.
2016-11-26 22:28:28 +01:00
John MacFarlane
7b4a12a532 Revert "Open Document writer: set first level of blockquotes to not use indent (#2757)"
This reverts commit fee0b913c5.

The previous commit did not provide a good way to get increased
indentation for nested block quotes.

Rolling it back for now. @jjsheets feel free to submit something
that handles multiple levels of block quote smoothly, if you like.
2016-11-26 22:03:57 +01:00