Commit graph

2601 commits

Author SHA1 Message Date
Jesse Rosenthal
293e4cfdc3 Add DocX files to tree.
This introduces Text.Pandoc.DocX, and its exported `readDocX` function.
2014-06-16 07:18:34 -04:00
James Aspnes
abbf33ae7d allow (and discard) optional argument for \caption 2014-06-12 21:19:00 -04:00
John MacFarlane
9681574661 LaTeX reader: Handle comments at the end of tables.
This resolves the issue illustrated in
http://stackoverflow.com/questions/24009489/comments-in-latex-break-pandoc-table.
2014-06-03 23:17:42 -07:00
John MacFarlane
ab5dda7a60 Markdown writer: Prettier pipe tables.
Columns are now aligned.  Closes #1323.
2014-06-03 23:17:03 -07:00
John MacFarlane
45f3851611 Docx writer: Section numbering carries over from reference.docx.
Closes #1305.
2014-06-03 16:46:55 -07:00
John MacFarlane
0ddb4cd2e8 Docx writer: Combine reference.docx numbering with pandoc's.
This should have fixed #1305, allowing the reference.docx to define
section numbering, but it doesn't.  Now the headings appear with proper
indentation, but the numbers don't appear.  Unclear why.  styles.xml and
numbering.xml basically match the docx which has the expected result.
2014-06-03 13:14:32 -07:00
John MacFarlane
ec047aaa8c Docx writer: pandoc uses only numIds >= 1000 for lists.
This opens up the possiblity (with further code changes) of
preserving some numbering from the reference.docx (e.g. header
numbering.)  See #1305.
2014-06-03 12:13:31 -07:00
John MacFarlane
2842ad5a97 Docx writer: Changed abstractNumId numbering scheme.
Now the minimum id used by pandoc is 990.  All ids start with "99".
This gives some room for a reference.docx to define numbering styles.
Note:  this is not yet possible, since pandoc generates numbering.xml
entirely on its own.
2014-06-03 11:33:09 -07:00
John MacFarlane
05355ac57b Docx writer: Simplified abstractNumId numbering.
Instead of sequential numbering, we assign numbers based on the
list marker styles.  This simplifies some of the code and should
make it easier to modify numbering in the future.
2014-06-03 11:03:40 -07:00
John MacFarlane
9b4e772718 Templates: use ordNum instead of ord.
Closes #1022.
2014-06-03 11:01:23 -07:00
John MacFarlane
2a627f85fe Shared: Added ordNub.
API change (adds export).
2014-06-03 11:00:54 -07:00
John MacFarlane
cbfde5cb50 Docx writer: Create overrides per-image for media/ in ref docx.
This should be somewhat more robust and cover more types
of images.
2014-06-02 20:39:27 -07:00
John MacFarlane
326d7fa8f8 Docx writer: Improved entryFromArchive to avoid parse.
No need to parse the XML if we're just going to render it
right away!
2014-06-02 20:20:16 -07:00
John MacFarlane
bf915da6cd Docx writer: Make images work in reference.docx headers/footers.
* All media from reference.docx are copied into result.
* Added defaults for common image types to [Content Types].
* Avoided redundant XML parse + write for entries taken over from
  reference.docx, for better performance.
2014-06-02 20:07:41 -07:00
John MacFarlane
e1cf47efa0 Templates: Fail informatively on template syntax errors.
With the move from parsec to attoparsec, we lost good error
reporting.  In fact, since we weren't testing for end of input,
malformed templates would fail silently.  Here we revert back to
Parsec for better error messages.
2014-06-01 23:45:05 -07:00
John MacFarlane
7242165bed Docx writer: Improved handling of headers/footers. 2014-06-01 22:29:13 -07:00
John MacFarlane
6848f642e8 Docx writer: Header and footer are now carried over from reference.docx. 2014-06-01 21:17:00 -07:00
John MacFarlane
6327ccf523 Minor code reformat. 2014-06-01 15:29:27 -07:00
John MacFarlane
23a9b800a3 Docx writer: Take over document formatting from reference.docx.
This includes margins, page size, page orientation.
2014-05-31 22:02:33 -07:00
John MacFarlane
9cf5f74e8f PDF writer: Fixed treatment of data uris for images.
Closes #1062.
2014-05-28 10:41:40 -07:00
John MacFarlane
e656658af8 Merge pull request #1302 from tarleb/inline-latex
Org reader: support for inline LaTeX
2014-05-28 09:26:48 -07:00
John MacFarlane
e3ddc371de Markdown reader: Handle c++ and objective-c as language identifiers
in github-style fenced blocks.  Closes #1318.

Note:  This is special-case handling of these two cases.
It would be good to do something more systematic.
2014-05-27 12:44:39 -07:00
John MacFarlane
2e80613451 Markdown reader: inline math must have nonspace before final $.
Closes #1313.
2014-05-27 11:59:28 -07:00
Albert Krewinkel
3238a2f919 Org reader: support for inline LaTeX
Inline LaTeX is now accepted and parsed by the org-mode reader.  Both,
math symbols (like \tau) and LaTeX commands (like \cite{Coffee}), can be
used without any further escaping.
2014-05-20 22:29:21 +02:00
John MacFarlane
3c77ab98bf EPUB writer: Handle multiple dates with OPF event attributes.
Note: in EPUB3 we can have only one dc:date, so only the first
one is used.
2014-05-19 13:25:44 -07:00
John MacFarlane
8d04c821aa Avoid import Prelude hiding (catch).
See #1309.
2014-05-19 09:45:00 -07:00
John MacFarlane
ee8c8da8cc Removed dependency on conduit.
* http-conduit flag is now https.
* Instead of http-conduit, we depend on http-client and http-client-tls.
2014-05-18 22:07:00 -07:00
John MacFarlane
c5c9b0d289 EPUB writer: Fixed regression on cover image.
In 1.12.4 and 1.12.4.2, the cover image would not appear properly,
because the metadata id was not correct.

This was introduced by the fix to #1254.

Now we derive the id from the actual cover image filename,
which we preserve rather than using "cover-image."
2014-05-15 10:11:48 -07:00
John MacFarlane
60b8b85040 Merge pull request #1293 from tarleb/typo
Process: Fix minor typo in pipeProcess' docs
2014-05-14 06:41:04 -07:00
John MacFarlane
b5959b2007 Merge pull request #1297 from tarleb/citations
Org reader: support Pandocs citation extension
2014-05-14 06:37:29 -07:00
Albert Krewinkel
ceeb701c25 Org reader: support Pandocs citation extension
Citations are defined via the "normal citation" syntax used in markdown,
with the sole difference that newlines are not allowed between "[...]".
This is for consistency, as org-mode generally disallows newlines
between square brackets.

The extension is turned on by default and can be turned off via the
default syntax-extension mechanism, i.e. by specifying "org-citation" as
the input format.
Move `citeKey` from Readers.Markdown into Parsing

The function can be used by other readers, so it is made accessible for
all parsers.
2014-05-14 15:00:26 +02:00
Albert Krewinkel
2423f9e6b1 Move citeKey from Readers.Markdown to Parsing
The function can be used by other readers, so it is made accessible for
all parsers.
2014-05-14 14:58:05 +02:00
Albert Krewinkel
9df589b9c5 Introduce class HasLastStrPosition, generalize functions
Both `ParserState` and `OrgParserState` keep track of the parser position at
which the last string ended.  This patch introduces a new class
`HasLastStrPosition` and makes the above types instances of that class.  This
enables the generalization of functions updating the state or checking if one
is right after a string.
2014-05-14 14:57:00 +02:00
John MacFarlane
aa019448d6 LaTeX reader: Support \addbibresource. 2014-05-12 13:06:06 -07:00
John MacFarlane
2348f07b11 Shared addMetaField: if old and new values both lists, concatenate. 2014-05-12 13:05:42 -07:00
John MacFarlane
a8319d1339 LaTeX reader: set bibliography in metadata from \bibliography cmd. 2014-05-11 22:52:29 -07:00
Albert Krewinkel
113a32daa8 Process: Fix minor typo in pipeProcess' docs
Replace fullstop with comma, adjust capitalisation.
2014-05-11 15:07:01 +02:00
John MacFarlane
0092606476 LaTeX reader: Don't error on "%foo" with no newline. 2014-05-10 23:26:32 -07:00
Albert Krewinkel
c5fd631b55 Org reader: Fix block parameter reader, relax constraints
The reader produced wrong results for block containing non-letter chars
in their parameter arguments.  This patch relaxes constraints in that it
allows block header arguments to contain any non-space character (except
for ']' for inline blocks).

Thanks to Xiao Hanyu for noticing this.
2014-05-10 11:35:54 +02:00
John MacFarlane
884693fea8 Merge pull request #1288 from tarleb/update-copyright
Update copyright notices for 2014, add missing notices
2014-05-09 09:53:06 -07:00
Albert Krewinkel
07694b3018 Org reader: Fix parsing of blank lines within blocks
Blank lines were parsed as two newlines instead of just one.
Thanks to Xiao Hanyu (@xiaohanyu) for pointing this out.
2014-05-09 18:23:23 +02:00
Albert Krewinkel
757c4f68f3 Org reader: Support arguments for code blocks
The general form of source block headers
(`#+BEGIN_SRC <language> <switches> <header arguments>`) was not
recognized by the reader.  This patch adds support for the above form,
adds header arguments to the block's key-value pairs and marks the block
as a rundoc block if header arguments are present.

This closes #1286.
2014-05-09 18:08:30 +02:00
Albert Krewinkel
7760504bb2 Org reader: refactor #+BEGIN..#+END block parsing code 2014-05-09 10:53:08 +02:00
Albert Krewinkel
8fdbef841d Update copyright notices for 2014, add missing notices 2014-05-09 00:46:08 +02:00
mpickering
f0f88111e6 Small improvement to textile reader fix. Removed 'try'. 2014-05-07 09:48:48 -07:00
mpickering
0050b50905 Fix textile reader hanging.
Textile reader hung on

    pandoc -f textile http://johnmacfarlane.net/pandoc/demo/example25.textile

The reader no longer hangs.
2014-05-07 09:32:25 -07:00
John MacFarlane
84f2336a7d Textile reader: Rearranged inline parsers for performance.
This is possible because of the rewrite of simpleInline.
Also removed a redundant parser for grouped inlines.
2014-05-06 23:41:56 -07:00
John MacFarlane
442eecc15c Textile reader: Rewrote simpleInline for clarity and efficiency.
This way we only look once for the opening `[`.
2014-05-06 23:27:16 -07:00
John MacFarlane
ea4e947bd0 Textile reader: Disallow blank lines in inline contexts.
@hi

    there@

should not be a single code span.
2014-05-06 23:16:47 -07:00
John MacFarlane
d6a9ba1cdc Make --trace work with textile reader. 2014-05-06 22:28:11 -07:00