Commit graph

5143 commits

Author SHA1 Message Date
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
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
John MacFarlane
8d4eebaff4 Merge pull request #1463 from jkr/metadata
Make metadata out of styled pars
2014-07-29 11:15:34 -07:00
Jesse Rosenthal
54708da371 Add and update docx tests in pandoc.cabal. 2014-07-29 13:05:19 -04:00
Jesse Rosenthal
840108a9c1 Docx reader: Make metavalues out of styled paragraphs.
This will make paragraphs styled with `Author`, `Title`, `Subtitle`,
`Date`, and `Abstract` into pandoc metavalues, rather than text. The
implementation only takes those elements from the beginning of the
document (ignoring empty paragraphs).

Multiple paragraphs in the `Author` style will be made into a metaList,
one paragraph per item. Hard linebreaks (shift-return) in the paragraph
will be maintained, and can be used for institution, email, etc.
2014-07-29 13:03:01 -04:00
John MacFarlane
4ddb8433a8 Merge pull request #1459 from mpickering/formats
Parsing: Added isbn and pmid schemes
2014-07-27 12:18:17 -07:00
Matthew Pickering
95fb0755c1 Parsing: Added isbn and pmid schemes 2014-07-27 19:59:57 +01:00
John MacFarlane
19109331df Markdown writer: Separate adjacent lists of the same kind with comment.
Closes #1458.
2014-07-27 08:26:17 -07:00
John MacFarlane
c302ab3133 Markdown writer: More improvements to 'plain' output, updated tests.
Math now appears in unicode if possible, without the distracting
italics around identifiers.

Blank lines around headers are more consistent.

Footnotes appear in regular [n] style.
2014-07-27 07:57:23 -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
John MacFarlane
3eff3782c1 Markdown writer: Better 'plain' output.
We now largely follow the style of Project Gutenberg.

Emphasis is rendered with `_underscores_`, strong with ALL CAPS.

The appearance of horizontal rules has changed (even in regular
markdown) to a line across the whole page.

Headings are rendered differently, using space to set them off.
2014-07-27 00:17:15 -07:00
John MacFarlane
18d72a0768 Markdown writer: Update definition lists.
They now behave like the new reader does. The old behavior
can be activated with the `compact_definition_lists` extension.
2014-07-27 00:15:18 -07:00
John MacFarlane
b104db4fb4 Docx writer: Added missing case from last commit. 2014-07-26 23:32:13 -07:00
John MacFarlane
2610de0159 Docx writer: include abstract with Abstract style.
Addresses docx part of #1451.
2014-07-26 22:55:45 -07:00
John MacFarlane
d9751f91c4 Merge pull request #1457 from mpickering/generalstate
Generalised more in Parsing.hs to enable the use of custom state
2014-07-26 19:01:26 -07:00
John MacFarlane
74690b191e Added t2t to -f in README documentation. 2014-07-26 18:49:19 -07:00
John MacFarlane
31b8a95c1d Merge pull request #1453 from mpickering/txt2tagsfinal
Txt2Tags Reader
2014-07-26 18:46:51 -07:00
Matthew Pickering
9e4604fa0b Added compatability layer to support directory-1.1 2014-07-27 00:36:23 +01:00
Matthew Pickering
00cb9836b8 Txt2Tags Reader: Updated README and package description 2014-07-27 00:12:57 +01:00
Matthew Pickering
f0a32197c8 Txt2Tags Reader: Added copyright information 2014-07-27 00:12:57 +01:00
Matthew Pickering
e340a7da02 Txt2Tags Reader: Added tests 2014-07-27 00:12:57 +01:00
Matthew Pickering
43304d6bd6 Txt2Tags Reader: Added recognition of macros 2014-07-27 00:12:56 +01:00
Matthew Pickering
ab3589ff0b Txt2Tags Reader: Integrated into pandoc 2014-07-27 00:12:56 +01:00
Matthew Pickering
7d04d383a6 Added txt2tags reader
http://txt2tags.org/

There are two points which currently do not match the official
implementation.

1. In the official implementation lists can not be nested like the
following but the reader would interpret this as a bullet list with the
first item being a numbered list.

```
  - + This is not a list
```

2. The specification describes how URIs automatically becomes links.
Unfortunately as is often the case, their definitiong of URI is not
clear. I tried three solutions but was unsure about which to adopt.

* Using isURI from Network.URI, this matches far too many strings and is
therefore unsuitable
* Using uri from Text.Pandoc.Shared, this doesn't match all strings that
the reference implementation matches
* Try to simulate the regex which is used in the native code

I went with the third approach but it is not perfect, for example
trailing punctuation is captured in Urls.
2014-07-27 00:12:56 +01:00
Matthew Pickering
5e2d22a27e Generalised more in Parsing.hs to enable the use of custom state 2014-07-26 21:23:49 +01:00
John MacFarlane
18f4490482 Fixed runtime error with compactify'DL on certain lists.
Closes #1452.  Added test.
2014-07-25 10:53:04 -07:00
John MacFarlane
9c3f7688ee DocBook reader: Better handle elements inside code environments.
Of course, we can't include structure in the code block, but
this way we at least preserve the text.  Closes #1449.
2014-07-23 10:06:36 -07:00
John MacFarlane
5089bc8fe2 Merge pull request #1444 from mpickering/master
Generalised readWith to readWithM
2014-07-22 09:14:38 -07:00