Commit graph

51 commits

Author SHA1 Message Date
John MacFarlane
9849ba7fd7 Use Control.Monad.State.Strict throughout.
This gives 20-30% speedup and reduction of memory
usage in most of the writers.
2017-06-17 07:45:28 +02:00
John MacFarlane
4dabcc27f6 Pretty: Eq instance for Doc. 2017-05-27 23:18:45 +02:00
Albert Krewinkel
965f1ddd4a
Update dates in copyright notices
This follows the suggestions given by the FSF for GPL licensed software.
<https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-13 23:30:13 +02:00
John MacFarlane
9437ab449c Revert "Experimental change to charWidth in Pretty."
This reverts commit c59e317224.
2017-03-22 16:08:09 +01:00
John MacFarlane
c59e317224 Experimental change to charWidth in Pretty.
Hunch that this might help with #3526.
2017-03-22 15:37:08 +01:00
John MacFarlane
e256c8ce17 Stylish-haskell automatic formatting changes. 2017-03-04 13:03:41 +01:00
John MacFarlane
dc9788b6dc Pretty: don't error for blocks of size < 1.
Instead, resize to 1.

Note, this (together with earlier changes to the Markdown
writer) seems to fix #1785.

The table renders as garbage, but pandoc now completes the conversion
quickly and doesn't get tied up.
2017-03-03 15:01:23 +01:00
John MacFarlane
86d8e1ef89 Pretty: simplified definition of realLength. 2017-02-23 09:54:31 +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
John MacFarlane
03788eb164 Fixed some bugs in Pretty that caused blank lines in tables.
The bugs caused spurious blank lines in grid tables
when we had things like

    blankline $$ blankline

Closes #3251.
2016-11-23 15:18:03 +01:00
Björn Peemöller
18f5d25abe Added function to compute the minimal width of a document 2016-11-19 23:04:29 +01:00
Björn Peemöller
6246d6e213 Added error message for illegal call to Pretty.block 2016-11-19 23:03:53 +01:00
Jesse Rosenthal
1cdebe1170 Remove an inline monad compatibility macro. 2016-09-02 09:18:08 -04:00
Jesse Rosenthal
45c7108b4f Remove Compat.Monoid
This was only necessary for GHC versions with base below 4.5
(i.e., ghc < 7.4).
2016-09-02 09:18:08 -04:00
John MacFarlane
2f54de7cc4 Fixed compiler warnings. 2016-07-14 23:38:44 -07:00
John MacFarlane
499985c1a3 Updated copyright dates to include 2016. 2016-03-22 17:20:39 -07:00
John MacFarlane
244cd5644b Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into mb21-new-image-attributes
* Bumped version to 1.16.
* Added Attr field to Link and Image.
* Added `common_link_attributes` extension.
* Updated readers for link attributes.
* Updated writers for link attributes.
* Updated tests
* Updated stack.yaml to build against unreleased versions of
  pandoc-types and texmath.
* Fixed various compiler warnings.

Closes #261.

TODO:

* Relative (percentage) image widths in docx writer.
* ODT/OpenDocument writer (untested, same issue about percentage widths).
* Update pandoc-citeproc.
2015-11-19 23:14:23 -08:00
John MacFarlane
c1e474f005 Restored Text.Pandoc.Compat.Monoid.
Don't use custom prelude for latest ghc.

This is a better approach to making 'stack ghci' and 'cabal repl'
work.  Instead of using NoImplicitPrelude, we only use the custom
prelude for older ghc versions.  The custom prelude presents a
uniform API that matches the current base version's prelude.
So, when developing (presumably with latest ghc), we don't
use a custom prelude at all and hence have no trouble with ghci.

The custom prelude no longer exports (<>):  we now want to
match the base 4.8 prelude behavior.
2015-11-09 11:19:25 -08:00
John MacFarlane
23b693c029 Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."
This reverts commit c423dbb5a3.
2015-11-09 10:08:22 -08:00
John MacFarlane
c423dbb5a3 Use -XNoImplicitPrelude and 'import Prelude' explicitly.
This is needed for ghci to work with pandoc, given that we
now use a custom prelude.

Closes #2503.
2015-11-08 16:56:59 -08:00
John MacFarlane
82b3e0ab97 Use custom Prelude to avoid compiler warnings.
- The (non-exported) prelude is in prelude/Prelude.hs.
- It exports Monoid and Applicative, like base 4.8 prelude,
  but works with older base versions.
- It exports (<>) for mappend.
- It hides 'catch' on older base versions.

This allows us to remove many imports of Data.Monoid
and Control.Applicative, and remove Text.Pandoc.Compat.Monoid.

It should allow us to use -Wall again for ghc 7.10.
2015-10-14 09:09:10 -07:00
John MacFarlane
2e8064346d Pretty: comment fix (mb21). 2015-07-25 15:51:55 +02:00
John MacFarlane
1868cb5e42 Updated copyright notices to -2015. Closes #2111. 2015-04-26 10:18:29 -07:00
Matthew Pickering
ef981492fd Remove partial function from Pretty 2015-02-18 20:11:08 +00:00
Matthew Pickering
9761283c8f Text.Pandoc.Pretty: Improve performance of realLength
Eliminates memory usage and twofold increase in speed.
2014-12-06 22:58:40 +00:00
John MacFarlane
7f6bbfadf4 Pretty: Make CR + BLANKLINE = BLANKLINE.
This fixes an extra blank line we were getting at the end
of markdown fragments (as well as rst, org, etc.)

Closes #1705.
2014-10-20 20:26:08 -07:00
John MacFarlane
cc24a1f3e5 Text.Pandoc.Pretty: added blanklines.
This ensures a certain number of blanklines (and no more) in output.
2014-07-27 07:56:55 -07:00
Albert Krewinkel
8fdbef841d Update copyright notices for 2014, add missing notices 2014-05-09 00:46:08 +02:00
Merijn Verstraaten
286781f801 Removed RenderState datatype context.
Reasoning:
    - It's not Haskell2010
    - It breaks some tools
    - Doesn't actually do anything
    - RenderState doesn't even have a Monoid instance
2014-02-06 23:10:59 +01:00
John MacFarlane
452a140d0c Pretty: Added nestle. API change, minor version bump to 1.12.3. 2014-01-02 21:09:39 -08:00
John MacFarlane
2d6e0b1530 Remove CPP from default-extensions; add pragmas to modules as needed. 2013-08-04 14:12:13 -07:00
John MacFarlane
68c95f4857 Pretty: Fixed chomp so it works inside Prefixed elements. 2013-02-28 20:22:08 -08:00
John MacFarlane
0c4965847f Pretty: Better Show instance for debugging purposes. 2013-02-28 20:12:21 -08:00
John MacFarlane
76edb6b848 Pretty: Fixed bug that caused combining characters to be dropped. 2012-08-13 15:52:41 -07:00
John MacFarlane
6d7f0a1b81 Fixed whitespace errors. 2012-07-26 22:32:53 -07:00
John MacFarlane
9e458d7974 Pretty: Added wide punctuation range to charWidth.
Fixes bug with Chinese commas in tables.
2012-06-30 11:51:52 -07:00
John MacFarlane
142c29d908 More efficient implementation of nowrap in Pretty. 2012-02-08 08:32:32 -08:00
John MacFarlane
bec945518c Fixed Pretty so it uses Data.Monoid's <> w/ GHC 7.4.
Note:  changed fixity to infixr 6.
2012-02-05 19:57:59 -08:00
John MacFarlane
4dec972cfe Remove dependency on dlist.
Use sequence in Pretty instead.
2012-02-05 14:25:12 -08:00
John MacFarlane
5b3c0a1081 Made charWidth in Text.Pandoc.Pretty complete.
Used the unicode spec EastAsianWidth.txt.
All characters marked W or F get width 2.

Closes #377.
2012-01-27 13:30:47 -08:00
John MacFarlane
f70dfe4d3d Pretty: Export realLength and use it in calculating offsets.
This should help fix setext headers and tables containing
asian wide characters and combining characters.
2012-01-25 23:30:21 -08:00
John MacFarlane
0c11d94e70 Pretty: Added charWidth function. 2012-01-25 23:15:18 -08:00
John MacFarlane
c264dc4f5b Pretty: Added beforeNonBreak combinator.
This allows you to include something conditionally on it being
before a nonblank.  Used for RST inline math.
2011-12-31 11:39:33 -08:00
John MacFarlane
23c26bbc65 Pretty: Added chomp combinator. 2011-11-18 13:19:22 -08:00
John MacFarlane
369502bbb4 Pretty: Added quote, doubleQuote. 2010-12-22 00:22:28 -08:00
John MacFarlane
ce533ffd90 Pretty: don't print a breaking space before a newline. 2010-12-21 16:45:13 -08:00
John MacFarlane
112717de4e Renamed 'enclosed' to 'inside'.
This avoids conflict with 'enclosed' in Text.Pandoc.Parsing.
2010-12-20 19:09:01 -08:00
John MacFarlane
2fe271d163 Pretty: Fixed parens. 2010-12-19 17:20:18 -08:00
John MacFarlane
9120514998 Pretty: Added enclosed, parens. 2010-12-19 12:39:49 -08:00
John MacFarlane
6aa5010617 Pretty: Added braces and brackets. 2010-12-19 10:13:11 -08:00