Commit graph

44 commits

Author SHA1 Message Date
Alexander Krotov
00b64f337d hlint 2017-11-01 14:40:10 +03:00
John MacFarlane
0e57b8b85d Add Millimeter constructor to Dimension in ImageSize.
Minor API change.

Now sizes given in 'mm' are no longer converted to 'cm'.

Closes #4012.
2017-10-31 11:58:43 -07:00
John MacFarlane
cbcb9b36c0 hlint suggestions. 2017-10-27 23:13:55 -07:00
John MacFarlane
b61a51ee15 hlint suggestions. 2017-06-02 15:25:39 +02:00
John MacFarlane
cb7b0a6985 Allow em for image height/width in HTML, LaTeX.
- Export `inEm` from ImageSize [API change].
- Change `showFl` and `show` instance for `Dimension` so
  extra decimal places are omitted.
- Added `Em` as a constructor of `Dimension` [API change].
- Allow `em`, `cm`, `in` to pass through without conversion
  in HTML, LaTeX.

Closes #3450.
2017-05-25 22:48:27 +02:00
Marc Schreiber
03cb05f4c6 Improve SVG image size code.
The old code made some unwise assumptions about
how the svg file would look.

See #3580.
2017-05-20 23:09:08 +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
schrieveslaach
1c8683f205 Read image size of Inkscape SVGs (#3580) 2017-04-16 19:39:24 +02:00
John MacFarlane
092c8f7732 ImageSize: export lengthToDim, new function scaleDimension. 2017-02-26 23:40:09 +01:00
mb21
3f6b50e525 imageSize interface change
`imageSize img` is now `imageSize opts img`
2017-02-22 15:34:53 +01:00
mb21
b312ac6d2d make imageSize recognize basic SVG dimensions, see #3462 2017-02-22 15:34:53 +01:00
John MacFarlane
00240ca7ed Removed hush from Text.Pandoc.Shared.
Not used anywhere.
2017-01-25 17:07:41 +01:00
Jesse Rosenthal
7f676b534a Remove Text.Pandoc.Compat.Except 2016-09-02 09:18:09 -04:00
John MacFarlane
499985c1a3 Updated copyright dates to include 2016. 2016-03-22 17:20:39 -07:00
John MacFarlane
c5b9ae3060 ImageSize: use safeRead instead of readMaybe.
readMaybe is only provided in base 4.6+.
2015-11-21 08:46:01 -08: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
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
878ab00233 ImageSize: Added functions for converting between image dimensions.
(mb21)
2015-08-05 16:08:46 +02:00
John MacFarlane
4b251e93b4 ImageSize: fixed some exif parsing bugs.
Closes #1834.  The image originally supplied works fine now
with pandoc.
2015-05-10 16:52:37 -07:00
John MacFarlane
31b3f2ef88 ImageSize: Use runGetOrFail with binary 0.7+. 2015-05-09 22:28:49 -07:00
John MacFarlane
a60c65c4e9 ImageSize: make jpeg header parsing routines return Either.
See #1834.
2015-05-09 21:55:19 -07:00
John MacFarlane
6fe243abbd ImageSize: make imageSize return an Either, not a Maybe.
This will give us better error reporting options.
This is part of a fix for #1834.
2015-05-09 21:32:31 -07:00
John MacFarlane
1868cb5e42 Updated copyright notices to -2015. Closes #2111. 2015-04-26 10:18:29 -07:00
Matthew Pickering
ad39bc7009 Move utility error functions to Text.Pandoc.Shared 2015-02-18 21:09:07 +00:00
Matthew Pickering
bf8667660d Remove landmine from ImageSize 2015-02-18 20:11:08 +00: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
5cb53a48d5 ImageSize: ignore unknown exif header tag rather than crashing.
Some images seem to have tag type of 256, which was causing
a runtime error.
2014-06-19 14:30:03 -07:00
Albert Krewinkel
8fdbef841d Update copyright notices for 2014, add missing notices 2014-05-09 00:46:08 +02:00
John MacFarlane
a333d9788e ImageSize: Avoid use of lookAhead, which is not in binary >= 0.6.
Closes #1124.
2014-01-24 16:00:53 -08:00
John MacFarlane
a1abb3eeea Allow binary 0.5. Version bump to 1.12.3.1. 2014-01-14 10:13:08 -08:00
John MacFarlane
b4b16d5786 Minor improvement to exif parser. 2014-01-09 22:51:23 -08:00
John MacFarlane
5c8c380a79 Better exif parsing, including image resolution.
This introduces a dependency on binary >= 0.6, but we depend
on binary >= 0.5 via zip-archive anyway.

Closes #976.
2014-01-09 11:16:55 -08:00
John MacFarlane
3bf8012bf6 Text.Pandoc.ImageSize: Parse EXIF format JPGs.
Note:  For now we just assign them all 72 dpi.  It wasn't
clear to me how to extract the resolution information.
At least the aspect ratio will be right, and 72 dpi is
the most common setting.

Closes #976.
2014-01-08 19:33:14 -08:00
John MacFarlane
b2385d0e9b Text.Pandoc.ImageSize: Handle EPS.
Closes #903.  This change will make EPS images properly sized
on conversion to Word.
2013-07-16 22:04:59 -07:00
John MacFarlane
588a49acf9 ImageSize: Added Pdf to ImageType.
So far we have no function to determine PDF's size.
2013-02-23 23:03:56 -08:00
John MacFarlane
1cc4e7db52 ImageSize: Remove no longer exported readImageSize. 2013-01-11 15:44:16 -08:00
John MacFarlane
2685ebff0f ImageSize: Use strict, not lazy bytestrings. 2013-01-11 12:11:37 -08:00
John MacFarlane
9ce3e2bf85 ImageSize: Fixed implementation of sizeInPoints. 2012-01-15 16:01:46 -08:00
John MacFarlane
b4e2d69cda Fixed whitespace bug in comments. 2012-01-15 15:43:52 -08:00
John MacFarlane
691b7bdc66 ImageSize: extract dpi information from PNG and JPEG.
* ImageSize record now includes dpiX, dpiY, pxX, pxY.
* New functions sizeInPixels and sizeInPoints.
2012-01-15 15:40:26 -08:00
John MacFarlane
0d1740ea08 Export ImageType(..) from ImageSize. 2012-01-14 11:46:41 -08:00
John MacFarlane
51365b3b36 Added Text.Pandoc.ImageSize.
This is intened for use in docx and odt writers, so the size
of image boxes can be calculated.
2012-01-14 11:42:35 -08:00