Commit Graph
10211 Commits
Author SHA1 Message Date
Jesse Rosenthal c343f1a90b Docx Reader: Add change types
Insertion and deletion. Dates are just strings for now.
2014-06-25 08:10:19 -04:00
John MacFarlane 5ba4760527 Merge pull request #1370 from jkr/fix-zero-indent
Docx reader: Ignore zero (or negative) indent
2014-06-24 13:41:19 -07:00
Jesse Rosenthal 69743cd598 Docx reader: Ignore zero (or negative) indent
If a block has an indentation less than or equal to zero, it should not be
treated as a block quote.
2014-06-24 15:06:25 -04:00
John MacFarlane 98ca2e512c Merge pull request #1368 from jkr/docxCode
Docx verbatim code formatting
2014-06-24 11:28:51 -07:00
Jesse Rosenthal a8866bc121 Docx reader: remove T.P.Generic import.
This marks the removal of the final tree-walk in the code. (Though there
is still one in the Lists module.)
2014-06-24 12:15:26 -04:00
Jesse Rosenthal 5ae6b8c6f1 Docx reader: pass definition test.
This commit also fixes a problem with the previous code pushes, which
wouldn't allow code blocks to share a div.
2014-06-24 12:12:02 -04:00
Jesse Rosenthal 2621482d69 Docx Reader: add failing defintion list tests. 2014-06-24 12:11:57 -04:00
Jesse Rosenthal bebea5e936 Docx reader: pass code tests. 2014-06-24 10:34:07 -04:00
Jesse Rosenthal 21295c5ab5 Docx reader: add failing tests for inline code and code blocks. 2014-06-24 10:33:49 -04:00
John MacFarlane fc4e6b3135 Merge pull request #1367 from jkr/reducible-copyright
Add copyright block to T.P.R.Docx.Reducible.
2014-06-23 17:31:12 -07:00
Jesse Rosenthal 08633fad33 Add copyright block to T.P.R.Docx.Reducible. 2014-06-23 20:26:08 -04:00
John MacFarlane ac6756009f Merge pull request #1366 from jkr/reducible3
Docx rewrite and cleanup (in terms of Reducible typeclass)
2014-06-23 14:33:38 -07:00
Jesse Rosenthal 9b954fa855 Add test for correctly trimming spaces in formatting.
This used to be fixed in the tree-walking. We need to make sure we're doing it
right now.
2014-06-23 17:08:26 -04:00
Jesse Rosenthal 8517a4f2e5 Add Reducible to cabal file. 2014-06-23 17:08:17 -04:00
Jesse Rosenthal 11b0778744 Use Reducible in docx reader.
This cleans up them implementation, and cuts down on tree-walking.
Anecdotally, I've seen about a 3-fold speedup.
2014-06-23 17:08:17 -04:00
Jesse Rosenthal 94d0fb1538 Move some of the clean-up logic into List module.
This will allow us to get rid of more general functions we no longer need in
the main reader.
2014-06-23 17:08:17 -04:00
Jesse Rosenthal ef5fad2698 Add new typeclass, Reducible
This defines a typeclass `Reducible` which allows us to "reduce" pandoc
Inlines and Blocks, like so

    Emph [Strong [Str "foo", Space]] <++> Strong [Emph [Str "bar"]], Str
"baz"] =
        [Strong [Emph [Str "foo", Space, Str "bar"], Space, Str "baz"]]

So adjacent formattings and strings are appropriately grouped.

Another set of operators for `(Reducible a) => (Many a)` are also
included.
2014-06-23 17:08:05 -04:00
John MacFarlane 87ab01637e LaTeX writer: Use \textquotesingle for ' in inline code.
Otherwise we get curly quotes in the PDF output.
Closes #1364.
2014-06-23 12:51:10 -07:00
John MacFarlane e03ed7377c Markdown reader: Combine consecutive latex environments.
This helps when you have two minipages which can't have
blank lines between them.

See #690, #1196.
2014-06-23 12:42:27 -07:00
Grégory Bataille d4d7a14ddd Scale images to fit the page for DOCX
Images that are bigger than the page were truncated. This will now
scale them if they are larger than the page. The scale is currently
hardcoded with Word "letter" defaults (page size and margins)
2014-06-23 10:38:15 +02:00
John MacFarlane cab16024fc Merge pull request #1363 from jkr/newNormalize
Improve normalization
2014-06-21 23:14:03 -07:00
Jesse Rosenthal ed43513087 Docx reader tests: add tests for normalization deep in blocks. 2014-06-22 01:58:41 -04:00
Jesse Rosenthal b3df3a3861 Docx reader tests: Correct normalize test. 2014-06-22 01:56:33 -04:00
Jesse Rosenthal 8e5bd9d851 Docx reader: Fix spacing in formatting.
The normalizing tests revealed a problem with unformatted spaces, brought about
by `spanTrim`. This fixes by not trimming the spaces out of spans until they
are in their final form.
2014-06-22 01:53:30 -04:00
Jesse Rosenthal ca4add679c Add normalization test.
Add torture-test for new normalization functions.

One problem that this test demonstrates is that word has a tendency to
turn off formatting at a space, and then turn it back on after. I'm not
sure yet whether this is something we should fix.
2014-06-22 00:46:19 -04:00
Jesse Rosenthal 9c7e0dc84b Implement new normalization.
There were some problems with the old str normalization. This fixes those
problems. Also, since it drills down on its own, it only needs to be
mapped over the blocks, not walked over the tree.
2014-06-22 00:45:18 -04:00
John MacFarlane 08fe16e972 Fixed compiler warnings. 2014-06-21 11:26:43 -07:00
John MacFarlane f5c8b05a1a Filters: don't print misleading error message.
Previously pandoc would say that a filter was not found,
even in a case where the filter had a syntax error.
2014-06-20 23:08:00 -07:00
John MacFarlane 793bfc81fe Merge pull request #1361 from jkr/testNormalize
Docx reader tests: Introduce NoNormPandoc type.
2014-06-20 16:23:24 -07:00
Jesse Rosenthal a4508d7fcf Docx reader tests: Introduce NoNormPandoc type.
This is just a wrapper around Pandoc that doesn't normalize with
`toString`. We want to make sure that our own normalization process
works. If, in the future, we are able to hook into the builder's
normalization, this will be removed.
2014-06-20 18:37:52 -04:00
John MacFarlane 5d0103606f Markdown reader: Support smallcaps through span.
`<span style="font-variant:small-caps;">foo</span>` will be
parsed as a `SmallCaps` inline, and will work in all output
formats that support small caps.

Closes #1360.
2014-06-20 15:26:45 -07:00
John MacFarlane d397a66107 MediaWiki reader: Tightened up template parsing.
The opening "{{" must be followed by an alphanumeric or ':'.
This prevents the exponential slowdown in #1033.
Closes #1033.
2014-06-20 12:00:26 -07:00
John MacFarlane 8f20ac3da3 MediaWiki reader: Support --trace. 2014-06-20 11:39:24 -07:00
John MacFarlane d81b4358ea LaTeX writer: Correctly handle figures in notes.
Notes can't contain figures in LaTeX, so we fake it to avoid
an error.  Closes #1053.
2014-06-20 11:26:38 -07:00
John MacFarlane 56c410ef6a Markdown reader: Prevent spurious line breaks after list items.
When the `hard_line_breaks` option was specified, pandoc would
produce a spurious line break after a tight list item.  This
patch solves the problem.  Closes #1137.
2014-06-20 11:10:35 -07:00
John MacFarlane 2eadc78053 ImageSize: Use default instead of failing if image size not found
in exif header.  Closes #1358.
2014-06-20 10:58:26 -07:00
John MacFarlane b3b40546cb HTML reader: Fix performance issue with malformed HTML tables.
We let a `</table>` tag close an open `<tr>` or `<td>`.
Closes #1167.
2014-06-20 10:47:29 -07:00
John MacFarlane cab4b829b3 Support --trace in HTML reader. 2014-06-20 10:39:24 -07:00
John MacFarlane 12efffa85a LaTeX writer: Fixed strikeout + highlighted code. Closes #1294.
Previously strikeout highlighted code caused an error.
2014-06-20 10:24:30 -07:00
John MacFarlane 1a2a0a3a85 Merge pull request #1357 from jkr/bottomUpStrNormalize
Make strNormalize go bottomUp.
2014-06-20 10:00:08 -07:00
Jesse Rosenthal f6ae644831 Make strNormalize go bottomUp.
This was how it used to be before it was folded into blockNormalize.
2014-06-20 12:31:36 -04:00
John MacFarlane d587558859 Merge pull request #1355 from jkr/normalizeFixes
Docx reader: Fixes to block Normalization
2014-06-20 09:15:55 -07:00
Jesse Rosenthal 2aa5f58c5b Docx reader: Add a comment explaining strNormalize
`normalize` from Text.Pandoc.Shared is more general. In tests, though,
it more than doubles the run time. `strNormalize` does less, but it does
what we need. This comment is added for future maintainability.
2014-06-20 10:27:18 -04:00
Jesse Rosenthal 03af19a7e1 Docx Reader: Normalize DefinitionLists
Previously DefinitionList had been left out of `blockNormalize`. Now it
is included.
2014-06-20 10:20:37 -04:00
Jesse Rosenthal 3da515bdb0 Docx reader: simplify blockNormalize
Use a function `stripSpaces`, instead of recursion. Makes it a bit
easier to read and mantain, and simplify normalizing DefinitionList,
which was left out the first time.
2014-06-20 10:12:28 -04:00
Jesse Rosenthal 7fd48b30e0 Docx reader: Fix hdr handling in block norm
`blockNormalize` previously forgot to account for the case in which a
Header's inlines did not start with a space.
2014-06-20 09:30:30 -04:00
John MacFarlane 557b302731 Docx writer: Use Compact style for empty table cells.
Otherwise we get overly tall lines when there are empty
table cells and the other cells are compact.

Closes #1353.
2014-06-19 23:31:17 -07:00
John MacFarlane 3c059dbe60 HTML reader: Allow space between <col> and </col>.
Test case:

```
<table border="1">
  <colgroup>
    <col> </col>
    <col></col>
  </colgroup>
  <tbody>
    <tr>
        <td>X</td>
        <td>Y</td>
    </tr>
    <tr>
        <td>1</td>
        <td>2</td>
    </tr>
  </tbody>
</table>

```
2014-06-19 23:24:28 -07:00
John MacFarlane 0d8e0e5674 Merge pull request #1354 from jkr/literalTab
Parse literal tabs in docx
2014-06-19 22:47:32 -07:00
Jesse Rosenthal da0d1d27ac Add tabs tests. 2014-06-19 19:33:22 -04:00