aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
AgeCommit message (Collapse)AuthorFilesLines
2015-11-09Restored Text.Pandoc.Compat.Monoid.John MacFarlane1-0/+1
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-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane1-6/+5
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane1-5/+6
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-10-17Remove compiler warning with embed_data_files.John MacFarlane1-1/+1
2015-10-14More changes to avoid compiler warnings on ghc 7.10.John MacFarlane1-3/+7
* CPP around deprecated `parseTime`. * Text.Pandoc.Compat.Locale -> Text.Pandoc.Compat.Time, now exports Data.Time.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane1-2/+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-10-11Percent-encode more special characters in URLs.John MacFarlane1-2/+5
HTML, LaTeX writers adjusted. The special characters are '<','>','|','"','{','}','[',']','^', '`'. Closes #1640, #2377.
2015-10-01Move the variable pandocVersion from `src/Text/Pandoc.hs` toAlex Vong1-1/+9
`src/Text/Pandoc/Shared.hs`, so that all Writers can access this variable without importing `src/Text/Pandoc.hs`, preventing circular import. * pandoc.hs: Import pandocVersion from `Text.Pandoc.Shared`. * src/Text/Pandoc.hs: Remove the definition of pandocVersion and relevant import. * src/Text/Pandoc/Shared.hs: Add the definition of pandocVersion and relevant import.
2015-09-26Removed unneeded imports.John MacFarlane1-2/+2
2015-09-26MediaBag: ensure that / is always used as path separator.John MacFarlane1-3/+4
2015-08-10EPUB TOC: replace literal "<br/>" with space.John MacFarlane1-0/+1
Closes #2105.
2015-08-07Updated readers, writers and README for link attributemb211-2/+2
2015-08-07Updated readers and writers for new image attribute parameter.John MacFarlane1-2/+2
(mb21)
2015-07-30fix build failure with --flags=-httpsSergei Trofimovich1-1/+2
The issue was originally reported by CasperVector as https://github.com/gentoo-haskell/gentoo-haskell/issues/427 Mainfests itself as a builg failure full of missing zip-archive names: src/Text/Pandoc/Shared.hs:756:49: Not in scope: type constructor or class ‘Archive’ src/Text/Pandoc/Shared.hs:777:38: Not in scope: ‘toEntry’ src/Text/Pandoc/Shared.hs:786:19: Not in scope: ‘toArchive’ Perhaps you meant ‘mbArchive’ (line 778) Included Codec.Archive.Zip unconditionally. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2015-07-23Added odt readerMarLinn1-6/+6
Fully implemented features: * Paragraphs * Headers * Basic styling * Unordered lists * Ordered lists * External Links * Internal Links * Footnotes, Endnotes * Blockquotes Partly implemented features: * Citations Very basic, but pandoc can't do much more * Tables No headers, no sizing, limited styling
2015-07-21Use newManager instead of withManager in recent http-client.John MacFarlane1-1/+10
This avoids a deprecation warning.
2015-07-12Changed hierarchicalize so it treats references div as top-level header.John MacFarlane1-0/+5
Fixes a bug with `--section-divs`, where the final references section added by pandoc-citeproc, enclosed in its own div, got put in the div for the section previous to it. This fixes #2294. Longer term, we might think about how hierarchicalize should interact with Div elements.
2015-06-28Added a needed import in Shared.John MacFarlane1-0/+1
2015-06-28Let reference.docx/odt behave as if they are virtual data files.John MacFarlane1-1/+72
Now they are constructed on the fly from their components, but we now allow them to be printed with `--print-default-data-file` and to override the defaults if placed in the user data directory. Shared now exports getDefaultReferenceDocx and getDefaultReferenceODT (API change). These functions have been removed from the Docx and ODT writers. Shared.readDataFile has been modified so that requests to read a reference.odt or reference.docx will use these functions to generate the files.
2015-06-28Minor fixes to previous commit.John MacFarlane1-8/+3
* Instead of defining readmeFile in Text.Pandoc.Data (which we forgot to export anyway), we simply add a record for "README" to the `dataFiles` lookup table. This allows simplifying some of the code for `readDefaultDataFile` in SHared. * As a bonus, `pandoc --print-default-data-file README` now works.
2015-06-28New method for producing man pages.John MacFarlane1-6/+14
This change adds `--man1` and `--man5` options to pandoc, so pandoc can generate its own man pages. It removes the old overly complex method of building a separate executable (but not installing it) just to create the man pages. The man pages are no longer automatically created in the build process. The man/ directory has been removed. The man page templates have been moved to data/. New unexported module: Text.Pandoc.ManPages. Text.Pandoc.Data now exports readmeFile, and `readDataFile` knows how to find README. Closes #2190.
2015-05-27Fixed svg handling in EPUB writer.John MacFarlane1-0/+1
This is a crude workaroud for #2183. A correct fix would require having openURL and fetchItem return a content encoding as well as a content type.
2015-04-26Updated copyright notices to -2015. Closes #2111.John MacFarlane1-2/+2
2015-02-18Move utility error functions to Text.Pandoc.SharedMatthew Pickering1-0/+10
2015-02-18Make safeRead safe.Matthew Pickering1-3/+3
Fixes #1801
2014-12-19Added Text.Pandoc.Compat.Locale to assist with transition to time 1.5.John MacFarlane1-1/+1
2014-10-08fix inDirectory to reset to the original directory in case an exception occursFreiric Barral1-6/+4
2014-09-25Shared: Make collapseFilePath OS-agnosticmpickering1-5/+9
2014-08-31Shared: Moved import of toChunks outside of conditional.John MacFarlane1-1/+1
Closes #1590.
2014-08-30Merge branch 'mime' of https://github.com/Aelve/John into Aelve-mimeJohn MacFarlane1-4/+4
Conflicts: src/Text/Pandoc/Writers/Docx.hs
2014-08-22Fixed --self-contained with Windows paths.John MacFarlane1-1/+2
Previously C:\foo.js was being wrongly interpreted as a URI. Closes #1558.
2014-08-17MIME cleanup.Artyom Kazak1-4/+4
* Create a type synonym for MIME type (instead of `String`). * Add `getMimeTypeDef` function. * Avoid recreating MIME type `Map`s every time. * Move “Formula-...” case handling into `getMimeType`.
2014-08-13Fixed haddock comment.John MacFarlane1-9/+7
2014-08-13Removed unneeded import.John MacFarlane1-1/+0
2014-08-08Shared: Added collapseFilePath functionMatthew Pickering1-1/+26
This function removes intermediate "." and ".." from a path.
2014-08-04Add PatternGuards pragmas.Artyom Kazak1-1/+1
2014-08-04Use `stripPrefix` where appropriate.Artyom Kazak1-7/+7
2014-08-03Correctly implement capitalisation.Artyom Kazak1-0/+13
Using `map toUpper` to capitalise text is wrong, as e.g. “Straße” should be converted to “STRASSE”, which is 1 character longer. This commit adds a `capitalize` function and replaces 2 identical implementations in different modules (`toCaps` and `capitalize`) with it.
2014-08-02fetchItem: improved mime type guessing.John MacFarlane1-4/+5
Strip a fragment like `?#iefix` from the extension before doing the mime lookup.
2014-08-02Shared: fetchItem improvements.John MacFarlane1-11/+12
* More consistent logic: absolute URIs are fetched from the net; other things are treated as relative URIs if sourceURL is a Just, otherwise as file paths. * We escape characters that are not allowed in URIs before trying to parse them (e.g. '|', which often occurs in the wild). * When treating relative paths as local file paths, we drop any fragment or query. This is useful e.g. when you've downloaded web fonts locally, but your source still contains the original relative URLs. Together with the previous commit, this should close #1477.
2014-07-31New module, Text.Pandoc.MediaBag.John MacFarlane1-75/+4
Moved `MediaBag` definition and functions from Shared: `lookupMedia`, `mediaDirectory`, `insertMedia`, `extractMediaBag`. Removed `emptyMediaBag`; use `mempty` instead, since `MediaBag` is a Monoid.
2014-07-31Made MediaBag a newtype, and added mime type information to media.John MacFarlane1-15/+65
Shared now exports functions for interacting with a MediaBag: - `emptyMediaBag` - `lookuMedia` - `insertMedia` - `mediaDirectory` - `extractMediaBag`
2014-07-31Shared: Added function insertMedia which is an alias for M.insertMatthew Pickering1-1/+8
2014-07-30PDF, Docx, EPUB, and ODT writers now automatically use MediaBag.John MacFarlane1-3/+2
The MediaBag is thread through from the reader, with no need to extract to files.
2014-07-30Shared: Added fetchItem', which searches a media bag too.John MacFarlane1-0/+14
2014-07-30Moved MediaBag back from Shared to Options, to avoid module cycle.John MacFarlane1-0/+11
2014-07-30Moved MediaBag from Shared to Options.John MacFarlane1-11/+0
This will allow us to put a MediaBag in WriterOptions.
2014-07-30Moved withTempDir from PDF to Shared, export from Shared.John MacFarlane1-1/+16
API change.
2014-07-30Shared: Make MediaBag available through Shared.Jesse Rosenthal1-0/+11
2014-07-25Fixed runtime error with compactify'DL on certain lists.John MacFarlane1-11/+13
Closes #1452. Added test.