aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/ImageSize.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-12-14ImageSize: use exif width and height when available.John MacFarlane1-0/+13
After the move to JuicyPixels, we were getting incorrect width and heigh information for some images (see #6936, test-3.jpg). The correct information was encoded in Exif tags that JuicyPixels seemed to ignore. So we check these first before looking at the Width and Height identified by JuicyPixels. Closes #6936.
2020-12-13ImageSize: use JuicyPixels to extract size...John MacFarlane1-305/+8
...for png, jpeg, gif, instead of doing our own binary parsing. See #6936.
2020-12-13ImageSize: use JuicyPixels to determine png size.John MacFarlane1-31/+19
2020-11-23ImageSize: default to DPI 72 if the format specifies DPI of 0.John MacFarlane1-1/+7
This shouldn't happen, in general, but it can happen with JPEGs that don't conform to the spec. Having a DPI of 0 will blow up size calculations (division by 0). Closes #6880.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-02-07More in-depth refactoring and cleanup (#6123)Joseph C. Sible1-3/+1
* Avoid duplicating the dash case * Pull common functions out of case branches * Make sure list lengths are only calculated once * Use unless * Simplify parseURIReference' and avoid an unnecessary call to length * Use <$> instead of reimplementing it * Use swap instead of reimplementing it * Remove eta-expansion that's been unnecessary since 90f5dd8 * Use tailDef instead of reimplementing it * Use second instead of fmap, per @tarleb
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-37/+38
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-03-21Improve pdfSize in ImageSize by ignoring all whitespace in /MediaBox command ↵richarddavis1-1/+4
(#5383) This fix ignores all whitespace in the PDF /MediaBox line so that a wider range of PDF sizes can be read. This improves fix to #4322.
2019-03-20Improve pdfSize in ImageSize.John MacFarlane1-20/+25
Improves fix to #4322.
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2018-08-10Avoid non-exhaustive pattern matches.John MacFarlane1-4/+6
2018-08-10Avoid non-exhaustive pattern match.John MacFarlane1-11/+12
2018-08-10Avoid non-exhaustive pattern match.John MacFarlane1-10/+12
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane1-0/+2
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-03-17hlint fixes.John MacFarlane1-5/+5
2018-02-18EMF Image size support (#4375)Andrew Pritchard1-1/+37
2018-02-16Make image size detection for PDFs more robust.John MacFarlane1-2/+4
See #4322.
2018-02-03C -> c.John MacFarlane1-1/+1
2018-02-02Determine image size for PDFs.John MacFarlane1-1/+22
Closes #4322.
2018-01-17ImageSize: add derived Eq instance to DimensionJesse Rosenthal1-0/+1
2018-01-05Update copyright notices to include 2018Albert Krewinkel1-2/+2
2017-11-01hlintAlexander Krotov1-2/+2
2017-10-31Add Millimeter constructor to Dimension in ImageSize.John MacFarlane1-1/+6
Minor API change. Now sizes given in 'mm' are no longer converted to 'cm'. Closes #4012.
2017-10-27hlint suggestions.John MacFarlane1-1/+0
2017-06-02hlint suggestions.John MacFarlane1-29/+28
2017-05-25Allow em for image height/width in HTML, LaTeX.John MacFarlane1-2/+18
- 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-20Improve SVG image size code.Marc Schreiber1-1/+1
The old code made some unwise assumptions about how the svg file would look. See #3580.
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-04-16Read image size of Inkscape SVGs (#3580)schrieveslaach1-4/+4
2017-02-26ImageSize: export lengthToDim, new function scaleDimension.John MacFarlane1-0/+12
2017-02-22imageSize interface changemb211-6/+5
`imageSize img` is now `imageSize opts img`
2017-02-22make imageSize recognize basic SVG dimensions, see #3462mb211-16/+48
2017-01-25Removed hush from Text.Pandoc.Shared.John MacFarlane1-3/+3
Not used anywhere.
2016-09-02Remove Text.Pandoc.Compat.ExceptJesse Rosenthal1-2/+1
2016-03-22Updated copyright dates to include 2016.John MacFarlane1-2/+2
2015-11-21ImageSize: use safeRead instead of readMaybe.John MacFarlane1-2/+1
readMaybe is only provided in base 4.6+.
2015-11-19Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into ↵John MacFarlane1-15/+138
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-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-1/+0
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-0/+1
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-1/+0
- 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-08-05ImageSize: Added functions for converting between image dimensions.John MacFarlane1-15/+138
(mb21)
2015-05-10ImageSize: fixed some exif parsing bugs.John MacFarlane1-22/+26
Closes #1834. The image originally supplied works fine now with pandoc.
2015-05-09ImageSize: Use runGetOrFail with binary 0.7+.John MacFarlane1-2/+13
2015-05-09ImageSize: make jpeg header parsing routines return Either.John MacFarlane1-29/+34
See #1834.
2015-05-09ImageSize: make imageSize return an Either, not a Maybe.John MacFarlane1-9/+11
This will give us better error reporting options. This is part of a fix for #1834.
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-02-18Move utility error functions to Text.Pandoc.SharedMatthew Pickering1-2/+1
2015-02-18Remove landmine from ImageSizeMatthew Pickering1-30/+37