Commit graph

5169 commits

Author SHA1 Message Date
John MacFarlane
842c705097 SelfContained: Fixed determining of source URL from within CSS files.
(This fixes a bug introduced a couple commits back.)
2014-08-02 16:33:22 -07:00
John MacFarlane
85ff3c5771 fetchItem: improved mime type guessing.
Strip a fragment like `?#iefix` from the extension before doing
the mime lookup.
2014-08-02 16:32:11 -07:00
John MacFarlane
1d137fbed6 Shared: fetchItem improvements.
* 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-08-02 16:12:05 -07:00
John MacFarlane
ce8922437d Text.Pandoc.SelfContained changes.
* mkSelfContained now takes just two arguments, WriterOptions and
  the string.
* It no longer looks in data files.  This only made sense when we
  had copies of slidy and S5 code there.
* Shared.fetchItem' is used instead of the nearly duplicate getItem.
2014-08-02 16:07:19 -07:00
John MacFarlane
cbaaa17d49 Bump aeson upper bound. 2014-08-02 15:14:15 -07:00
John MacFarlane
36c9537b90 benchmark: use only test suite for benchmark.
This way the benchmarks don't take so long to run.
2014-08-01 13:40:26 -07:00
John MacFarlane
836d1f06bb Use nfIO in benchmark instead of getLength trick. 2014-08-01 13:20:08 -07:00
John MacFarlane
a1bb71a02c Merge pull request #1475 from Aelve/fix-benchmark
Make benchmarks compile again.
2014-08-01 08:40:36 -07:00
Artyom Kazak
857c63f77e Make benchmarks compile again.
Additionally, fix the problem which caused one failing benchmark
to stop other benchmarks from running.
2014-08-01 15:40:25 +04:00
John MacFarlane
1b9371cfdf Merge branch 'underline-option' of https://github.com/jkr/pandoc 2014-07-31 16:40:20 -07:00
John MacFarlane
f075b0e5d9 pandoc.hs: More code reorganization. 2014-07-31 16:27:06 -07:00
Jesse Rosenthal
43ca784d1c Update docx test to interpret single underline as emph. 2014-07-31 18:46:43 -04:00
Jesse Rosenthal
57939a9282 Docx Reader: Single underlines are "emph"
All other underlines are ignored.
2014-07-31 18:44:41 -04:00
John MacFarlane
2b7e7acc4b Merge pull request #1473 from jkr/mediabag-test-2
Docx tests: rewrite mediabag tests.
2014-07-31 15:28:20 -07:00
John MacFarlane
0565a81676 pandoc.hs: Rewrote some of the logic for clarity. 2014-07-31 12:51:01 -07:00
Jesse Rosenthal
96ad37536e Remove now unneeded JSON test file. 2014-07-31 15:47:45 -04:00
Jesse Rosenthal
ed71e9b31d Docx tests: rewrite mediabag tests.
This will allow us to test the whole mediabag (making sure, for example,
that images are added with the correct keys) instead of just individual
extracted images. We compare each entry in the media bag to an image
extracted on the fly from the docx. As a result, we only need one file
to test with.

The image in the current tests was also replaced with a smaller one.
2014-07-31 15:47:45 -04:00
John MacFarlane
6dd2418476 New module, Text.Pandoc.MediaBag.
Moved `MediaBag` definition and functions from Shared:
`lookupMedia`, `mediaDirectory`, `insertMedia`, `extractMediaBag`.
Removed `emptyMediaBag`; use `mempty` instead, since `MediaBag`
is a Monoid.
2014-07-31 12:00:21 -07:00
John MacFarlane
00662faefb Made MediaBag a newtype, and added mime type information to media.
Shared now exports functions for interacting with a MediaBag:

- `emptyMediaBag`
- `lookuMedia`
- `insertMedia`
- `mediaDirectory`
- `extractMediaBag`
2014-07-31 11:05:35 -07:00
John MacFarlane
6e96f8b478 Merge branch 'master' of github.com:jgm/pandoc 2014-07-31 09:43:08 -07:00
John MacFarlane
76031f01c1 Merge pull request #1472 from mpickering/master
Shared: Added function insertMedia which is an alias for M.insert
2014-07-31 09:42:53 -07:00
John MacFarlane
fcafcaa8e6 Added note in README about pipe tables not wrapping in LaTeX/PDF.
See
http://stackoverflow.com/questions/25037357/pandoc-long-tablerows-in-markdown-pdf-documents-do-not-get-linewrap/25050474#25050474
2014-07-31 07:48:14 -07:00
Matthew Pickering
31e7c1b67c Shared: Added function insertMedia which is an alias for M.insert 2014-07-31 15:47:49 +01:00
John MacFarlane
143d5b7328 Merge pull request #1470 from jkr/metadata-test
Media test
2014-07-30 23:52:36 -07:00
Jesse Rosenthal
4d1d8a4b6f Docx test: Test image from media bag. 2014-07-30 22:32:55 -04:00
Jesse Rosenthal
b24b328906 Docx tests: Add test image.
This is the cow image extracted from `docx.image.docx`.
2014-07-30 22:32:27 -04:00
Jesse Rosenthal
16f88edb3b Docx tests: Added media test comparison function.
Also tell pandoc.cabal that we'll be needing base64, since we want to
compare strings here.
2014-07-30 22:31:38 -04:00
John MacFarlane
f1885ae799 Removed deprecated and no longer used readerStrict in ReaderOptions.
This is handled by readerExtensions now.
2014-07-30 18:32:06 -07:00
John MacFarlane
71e76175be getT2TMeta: Take list of source files instead of single.
Get latest modification time.
2014-07-30 17:25:00 -07:00
John MacFarlane
3e26fb517d Updated RTF writer tests. 2014-07-30 15:30:51 -07:00
John MacFarlane
e4913d6dba Allow --self-contained to get content from MediaBag.
Added a parameter to makeSelfContained (API change).
2014-07-30 15:26:40 -07:00
John MacFarlane
23d806644f RTF writer: Improved image embedding.
Use calculated sizes.
2014-07-30 14:49:57 -07:00
John MacFarlane
e365af9c23 RTF writer: refactored image embedding, using fetchItem'. 2014-07-30 14:27:51 -07:00
John MacFarlane
234652a4b8 PDF, Docx, EPUB, and ODT writers now automatically use MediaBag.
The MediaBag is thread through from the reader, with no need
to extract to files.
2014-07-30 14:07:31 -07:00
John MacFarlane
28321a18bf Shared: Added fetchItem', which searches a media bag too. 2014-07-30 13:47:07 -07:00
John MacFarlane
67c5c7a575 Moved MediaBag back from Shared to Options, to avoid module cycle. 2014-07-30 13:46:48 -07:00
John MacFarlane
77aa72ec24 pandoc: Thread media bag into WriterOptions.
This will make it available to docx and epub readers, etc.,
so we don't have to extract media to a directory when going
from docx -> epub.
2014-07-30 13:20:44 -07:00
John MacFarlane
08e2498e73 Added writerMediaBag to WriterOptions. 2014-07-30 13:09:55 -07:00
John MacFarlane
555f9b746d Moved MediaBag from Shared to Options.
This will allow us to put a MediaBag in WriterOptions.
2014-07-30 13:00:54 -07:00
John MacFarlane
d3cf53a956 Moved withTempDir from PDF to Shared, export from Shared.
API change.
2014-07-30 12:29:04 -07:00
John MacFarlane
b5210bc175 Added --extract-media option.
This has been documented to affect the epub and docx readers, so
we should either add the epub reader before the next release or
change the documentation.
2014-07-30 11:44:25 -07:00
John MacFarlane
b12d2ea20a Merge pull request #1468 from jkr/mediabag
Mediabag
2014-07-30 10:55:29 -07:00
Jesse Rosenthal
f733b50150 Make toplevel pandoc bin make use of mediabag.
Note that at the moment the mediabag is discarded. This will have to be
changed to make use of it.
2014-07-30 12:48:07 -04:00
Jesse Rosenthal
a79ea18503 Pandoc.hs: change BSReader to output MediaBag as well as pandoc. 2014-07-30 12:47:49 -04:00
Jesse Rosenthal
f78d2f6219 Shared: Make MediaBag available through Shared. 2014-07-30 12:47:26 -04:00
Jesse Rosenthal
941df1b0de Docx reader: change tests to make use of media bag. 2014-07-30 12:46:53 -04:00
Jesse Rosenthal
9ce2295700 Docx reader: Make docx reader put image data in MediaBag.
Image data will not be put in a media bag map, which will be output
along with the pandoc output.
2014-07-30 12:46:03 -04:00
John MacFarlane
02c79ea4f6 Mediawiki writer: don't escape inside <source>.
Closes #1445.  Escapes can still be used with `<code>`
and `<pre>`.
2014-07-29 21:32:07 -07:00
John MacFarlane
33a051d00d Docx writer: Print subtitle from metadata if present.
Use Subtitle style.

See #1451.
2014-07-29 20:46:55 -07:00
John MacFarlane
8c2ed54e2e LaTeX writer: use \(..\) instead of $..$ for inline math.
Closes #1464.
2014-07-29 20:45:49 -07:00