Commit graph

2514 commits

Author SHA1 Message Date
John MacFarlane
7d60c798bf Fixed compiler warning. 2014-06-16 23:02:20 -07:00
John MacFarlane
bbe99003f8 Naming: Use Docx instead of DocX.
For consistency with the existing writer.
2014-06-16 22:44:40 -07:00
John MacFarlane
bec9f3c641 Merge branch 'docx' of https://github.com/jkr/pandoc into jkr-docx 2014-06-16 22:16:45 -07:00
John MacFarlane
78ee2416d1 Org reader: make tildes create inline code.
Closes #1345.  Also relabeled 'code' and 'verbatim' parsers
to accord with the org-mode manual.

I'm not sure what the distinction between code and verbatim
is supposed to be, but I'm pretty sure both should be represented
as Code inlines in pandoc.  The previous behavior resulted in the
text not appearing in any output format.
2014-06-16 22:03:26 -07:00
John MacFarlane
f9b97e6bfb Small improvement to fix to #1333.
This allows blank lines at end of multiline headers.
2014-06-16 21:26:50 -07:00
John MacFarlane
9da5d8955e Markdown reader: fixed #1333 (table parsing bug). 2014-06-16 21:18:24 -07:00
John MacFarlane
87c08be58f LaTeX reader: handle leading/trailing spaces in emph better.
`\emph{ hi }` gets parsed as `[Space, Emph [Str "hi"], Space]`
so that we don't get things like `* hi *` in markdown output.

Also applies to textbf and some other constructions.

Closes #1146.  (`--normalize` isn't touched by this, but
normalization should not generally be necessary with the
changes to the readers.)
2014-06-16 19:18:33 -07:00
John MacFarlane
459805de4c LaTeX reader: don't assume preamble doesn't contain environments.
Closes #1338.
2014-06-16 17:43:56 -07:00
John MacFarlane
31fd843133 HTML reader: Fixed major parsing problem with HTML tables.
Table cells were being combined into one cell.  Closes #1341.
2014-06-16 15:45:20 -07:00
John MacFarlane
2b364b34bb Merge pull request #1344 from mpickering/master
Moved extractSpaces to Shared.hs
2014-06-16 14:43:43 -07:00
John MacFarlane
01ef573ac2 Org reader: fixed #1342.
This change rewrites `inlineLaTeXCommand` so that parsec will
know when input is being consumed.  Previously a run-time
error would be produced with some input involving raw latex.
(I believe this does not affect the last release, as the inline
latex reading was added recently.)
2014-06-16 14:18:06 -07:00
mpickering
7807564d44 Moved extractSpaces to Shared.hs
Generalised and move the extractSpaces function from `HTML.hs` to
`Shared.hs` so that the docx reader can also use it.
2014-06-16 20:45:54 +01:00
mpickering
3bc818d2d3 Integrated the docx reader into the main pandoc program.
Changes also include generalising the types of reader allowed. The
mechanism now mimics the more general output mechanism.
2014-06-16 07:18:40 -04:00
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
John MacFarlane
10644607e3 Textile reader: Rewrote some inline parsing code for clarity.
(It seems clearer to put the whitespace parsing in the grouped
parser.  This also uses stateLastStrPos to determine when the
border is adjacent to an alphanumeric.)
2014-05-06 22:14:35 -07:00
Albert Krewinkel
71bd4fb2b3 Org reader: Read inline code blocks
Org's inline code blocks take forms like `src_haskell(print "hi")` and
are frequently used to include results from computations called from
within the document.  The blocks are read as inline code and marked with
the special class `rundoc-block`.  Proper handling and execution of
these blocks is the subject of a separate library, rundoc, which is
work in progress.

This closes #1278.
2014-05-06 13:21:26 +02:00
John MacFarlane
dbd6c1540f Fixed the fix to #1154.
We need to strip off up to 4 spaces, not up to 3.
2014-05-04 16:21:18 -07:00
John MacFarlane
51aa304834 LaTeX writer: Fixed inconsistencies with reference escaping.
- toLabel is now monadic, and it does the needed string escaping.
- Closes #1130.
2014-05-04 14:43:05 -07:00
John MacFarlane
0c7e084342 Docx writer: Fall back on distribution reference.docx.
* Undid changes to parseXml in last commit.
* Instead of a string fallback, we have parseXml fall back
  on the reference.docx that comes with pandoc if the user's
  reference.docx does not contain a needed file.
* Closes #1185.
2014-05-04 10:54:45 -07:00
John MacFarlane
d728715981 Docx writer: Added ability to give fallback in parseXml. 2014-05-04 10:45:20 -07:00
John MacFarlane
3e42f08e87 Markdown reader: Fixed bug with unwanted code in lists.
Closes #1154.

When reading a raw list item, we now strip off nonindent
spaces.
2014-05-04 08:07:17 -07:00
John MacFarlane
96c0c950ca AsciiDoc writer: Handle multiblock table cells.
Closes #1246.
2014-05-03 21:31:53 -07:00
John MacFarlane
fde52c25a6 AsciiDoc writer: Correctly handle empty table cells.
Closes #1245.
2014-05-03 21:08:45 -07:00
John MacFarlane
abd3a039b9 DocBook writer: Small tweaks to last commit.
* Use isTightList from Shared.
* Adjust writer test, since isTightList is a bit different from what
  was used before.

Closes #1250.
2014-05-03 20:45:38 -07:00
Neil Mayhew
ccbf4fc9c2 Distinguish tight and loose lists in Docbook output
Determined by the first block of the first item being Plain.
2014-05-03 18:37:02 -07:00
John MacFarlane
2ba7873086 LaTeX reader: Fixed regression introduced with last commit.
Tests now pass again.
2014-05-03 18:34:23 -07:00
John MacFarlane
743dac493f LaTeX reader: Better error messages with include files.
Closes #1274.

Rewrote handleIncludes.

We now report the actual source file and position where the error
occurs, even if it is included.  We do this by inserting special
commands, `\PandocStartInclude` and `\PandocEndInclude`, that encode
this information in the preprocessing phase.

Also generalized the types of a couple functions from
`Text.Pandoc.Parsing`.
2014-05-03 17:37:54 -07:00
John MacFarlane
4c43824203 Fixed empty reference links. Closes #1186.
Includes test.
2014-05-02 22:58:47 -07:00
John MacFarlane
007eb96e06 Markdown reader: Make one-column pipe tables work.
Closes #1218.
2014-05-01 09:23:21 -07:00
John MacFarlane
b306405caa Merge pull request #1272 from tarleb/link-types
Org reader: add support for custom link types
2014-05-01 08:44:05 -07:00
Albert Krewinkel
8726eebcd3 Org reader: Add support for custom link types
Org allows users to define their own custom link types.  E.g., in a
document with a lot of links to Wikipedia articles, one can define a
custom wikipedia link-type via

    #+LINK: wp https://en.wikipedia.org/wiki/

This allows to write [[wp:Org_mode][Org-mode]] instead of the
equivallent [[https://en.wikipedia.org/wiki/Org_mode][Org-mode]].
2014-05-01 11:50:32 +02:00
John MacFarlane
eaba340b93 RST reader: Some fixes to last change, and use "author" not "authors".
(in metadata)
2014-04-30 11:28:18 -07:00
John MacFarlane
81bf82c258 RST reader: Better handling of directives.
* We now correctly handle field lists that are indented more than
  3 spaces.
* We treat an "aafig" directive as a code block with attributes,
  so it can be processed in a filter.  (Closes #1212.)
2014-04-30 09:59:36 -07:00
John MacFarlane
093229dc35 ConTeXt writer: Improved autolinks.
Closes #1270.
2014-04-30 08:58:10 -07:00
John MacFarlane
c8f97d3d41 Fix #1267.
We now check the writerName for a lua script in pandoc.hs, so that
lowercasing and format parsing aren't done.  Note this behavior
change: getWriter in Text.Pandoc no longer returns a custom writer on
input "foo.lua".
2014-04-27 20:56:50 -07:00
John MacFarlane
22e36e1040 LaTeX reader: Made \nocite work.
This adds nocite citations to a metadata field, `nocite`.
These will appear in the bibliography but not in the text
(unless you use a `$nocite$` variable in your template, of
course).
2014-04-26 12:14:42 -07:00
John MacFarlane
35ea8de369 HTML writer: improved detection of image links.
Previously image links with queries were not recognized,
leading to use of an embed tag rather than an img tag.
2014-04-26 12:04:08 -07:00
John MacFarlane
60297089f6 Merge pull request #1265 from tarleb/org-links
Improvements handling of internal links
2014-04-25 08:08:00 -07:00
Albert Krewinkel
b09412d852 LaTeX writer: Mark span contents with label if span has an ID
Prepend `\label{span-id}` to span contents iff `span-id` is defined.
2014-04-25 16:17:24 +02:00
Albert Krewinkel
2eec20d92f Org reader: Enable internal links
Internal links in Org are possible by using an anchor-name as the target
of a link:

[[some-anchor][This]] is an internal link.

It links <<some-anchor>> here.
2014-04-25 15:29:28 +02:00
John MacFarlane
cbeb3bb213 EPUB writer: Fixed some idrefs to match changes in ids. 2014-04-24 17:37:10 -07:00
John MacFarlane
e6333a9d7c Markdown writer: Use proper escapes to avoid unwanted lists.
Previously we used 0-width spaces, an ugly hack.

Closes #980.
2014-04-24 16:44:49 -07:00
John MacFarlane
d16775e1c7 Render numbers in YAML metadata without decimals when possible.
The change to aeson > 0.7 caused numbers to be rendered with
decimals.  This change causes them to be rendered without decimals
wehn possible.
2014-04-24 11:09:07 -07:00
Albert Krewinkel
2f724aaaa4 Org reader: Read anchors as empty spans
Anchors (like <<this>>) are parsed as empty spans.
2014-04-24 17:57:06 +02:00
Albert Krewinkel
c128daba9d Org reader: Recognize plain and angle links
This adds support for plain links (like http://zeitlens.com) and angle
links (like <http://moltkeplatz.de>).
2014-04-24 17:55:24 +02:00
Albert Krewinkel
ec24f9761c RST reader: Remove duplicate 'http' in PEP links
The generated link to PEPs had a duplicate 'http://' in its URL.
2014-04-24 17:55:22 +02:00
John MacFarlane
e0688711fd EPUB writer: include extension in epub ids.
This fixes a problem with duplicate extensions for fonts and
images with the same base name but different extensions.

Closes #1254.
2014-04-23 10:23:02 -07:00
John MacFarlane
6a2361c457 Merge pull request #1256 from tarleb/org-reader-improvements
Org reader improvements
2014-04-19 20:35:41 -07:00
Albert Krewinkel
8276449520 Org reader: Allow for compact definition lists
Use `Text.Pandoc.Shared.compactify'DL` to allow for compact definition
lists.
2014-04-19 15:13:16 +02:00
Albert Krewinkel
efebade38b Move compactify'DL from Markdown reader into Shared
The function `compactify'DL`, used to change the final definition item of a
definition list into a `Plain` iff all other items are `Plain`s as well, is
useful in many parsers and hence moved into Text.Pandoc.Shared.
2014-04-19 15:03:33 +02:00
Albert Krewinkel
8e91d362a3 Org reader: Fix parsing of footnotes
Footnotes can consist of multiple blocks and end only at a header or at
the beginning of another footnote.  This fixes the previous behavior,
which restricted notes to a single paragraph.
2014-04-19 14:40:46 +02:00
Albert Krewinkel
a69416091b Org reader: Fix distinction of images and normal links
Fixed a false assumption about the precedence of (&&) vs (||).
2014-04-19 11:25:39 +02:00
Albert Krewinkel
6ded3d41d9 Org reader: Apply captions to code blocks and tables
The `Table` blocktype already takes the caption as an argument, while code
blocks are wrapped in a `Div` block together with a labelling `Span`.
2014-04-19 10:41:45 +02:00
Albert Krewinkel
09441b65a8 Org reader: Add support for plain LaTeX fragments
This adds support for LaTeX fragments like the following:

```
\begin{equation}
\int fg \mathrm{d}x
\end{equation}
```
2014-04-18 10:22:54 +02:00
Albert Krewinkel
f19d7233d8 Org reader: Fix parsing of loose lists
Loose lists (i.e. lists with blankline separated items), were parsed as
multiple lists, each containing a single item.  This patch fixes this
issue.
2014-04-18 08:34:06 +02:00
Albert Krewinkel
6d6724cf2c Org reader: Support more types of '#+BEGIN_<type>' blocks
Support for standard org-blocks is improved.  The parser now handles
"HTML", "LATEX", "ASCII", "EXAMPLE", "QUOTE" and "VERSE" blocks in a
sensible fashion.
2014-04-17 18:33:39 +02:00
Albert Krewinkel
0672f58a44 Org reader: Support footnotes 2014-04-17 13:23:14 +02:00
Albert Krewinkel
92582c6272 Org reader: introduce Reader environment around Blocks/Inlines
This introduces a Reader environment in the style of
Text.Pandoc.Parsing.F, but adapted to the Org reader parser.
2014-04-16 13:38:50 +02:00
Albert Krewinkel
5fc252270c Org reader: Fix code for subexpression parsing 2014-04-16 13:26:32 +02:00
Albert Krewinkel
346bcea713 Org reader: Better module description, minor style changes
Use module description analogous to the markdown reader's.
Use (<$) where it makes sense.
2014-04-16 13:23:30 +02:00
John MacFarlane
7f036c0b57 Shared: Fixed bug in toRomanNumeral.
9 and numbers ending in 9 would end with "IXIV."
Thanks to Jesse Rosenthal.  Closes #1249.
2014-04-15 19:53:58 -07:00
John MacFarlane
857fcff7d6 Merge pull request #1240 from neilmayhew/master
Docbook output of Line Blocks
2014-04-13 14:37:28 -07:00
John MacFarlane
86b4da9dec Merge pull request #1239 from tarleb/org-linebreak
Org linebreaks
2014-04-13 14:04:48 -07:00
John MacFarlane
d5d4227ea5 Merge pull request #1238 from tarleb/org-figures
Org reader: Add support for figures
2014-04-13 14:03:15 -07:00
John MacFarlane
d4c1cd456c Org reader: Removed ANN pragma.
This relies on Template Haskell, which causes problems in Windows
due to libraries with C dependencies.  We need to avoid using TH
in pandoc code.
2014-04-12 21:44:54 -07:00
Neil Mayhew
464d7a8e49 Improve handling of hard line breaks in Docbook writer
* Use a <literallayout> for the entire paragraph, not just for the
   newline character
 * Don't let LineBreaks inside footnotes influence the enclosing
   paragraph
2014-04-12 09:16:07 -06:00
Albert Krewinkel
82d4160bdc Org reader: Read linebreaks
Linebreaks are marked by the string `\\` at the end of a line.
2014-04-12 11:07:38 +02:00
Albert Krewinkel
36066699c3 Org writer: Fix output for linebreaks
Hard linebreaks in Org mode are represented by the string "\\" as the
last characters in a line.  Adds this feature to the Org-mode writer.
2014-04-12 10:47:49 +02:00
Albert Krewinkel
ae4280fba5 Org reader: Add support for figures
Support for figures (images with name and caption) is added.
2014-04-12 10:31:45 +02:00
John MacFarlane
8699071ec2 HTML reader: Treat processing instructions & declarations as block.
Previously these were treated as inline, and included in paragraph
tags in HTML or DocBook output, which is generally not what is wanted.

Closes #1233.
2014-04-11 10:10:54 -07:00
Albert Krewinkel
6f19be7d40 Org reader: Fix parsing of sub-/superscript expressions
This fixes the org-reader's handling of sub- and superscript
expressions.  Simple expressions (like `2^+10`), expressions in
parentheses (`a_(n+1)`) and nested sexp (like `a_(nested()parens)`) are
now read correctly.
2014-04-11 11:05:42 +02:00
John MacFarlane
ca40acea5b MediaWiki reader: Handle table rows containing just an HTML comment.
Closes #1230.
2014-04-10 16:52:30 -07:00
Albert Krewinkel
ace8837cd6 Org reader: Improve code by following HLint recommendations
HLint's recommendations for better code are applied to the Org-mode
reader code.
2014-04-10 19:17:58 +02:00
Albert Krewinkel
1715d7cee0 Org reader: Support more inline/display math variants
Support all of the following variants as valid ways to define inline or
display math inlines:

  - `\[..\]` (display)
  - `$$..$$` (display)
  - `\(..\)` (inline)
  - `$..$`   (inline)

This closes #1223.  Again.
2014-04-10 15:32:02 +02:00
John MacFarlane
54e33a132b Merge pull request #1226 from tarleb/org-emphasis-reader
Org reader: Precise rules for the recognition of markup
2014-04-09 09:34:44 -07:00
Albert Krewinkel
030020236c Org reader: Precise rules for the recognition of markup
The inline parsers have been rewritten using the org source code as a
reference. This fixes a couple of bugs related to erroneous markup
recognition.
2014-04-09 15:26:06 +02:00
John MacFarlane
e555a5703d Textile reader: Improved link parsing.
In particular we now pick up on attributes. Since pandoc links
can't have attributes, we enclose the whole link in a span
if there are attributes.

Closes #1008.
2014-04-07 21:23:39 -07:00
John MacFarlane
bfd598e1e9 Merge pull request #1224 from tarleb/org-math
Org reader: Read inline math, recognize definition lists
2014-04-07 07:24:30 -07:00
Albert Krewinkel
c47bd8404f Org reader: Support inline math (like $E=mc^2$)
Closes #1223.
2014-04-07 11:47:36 +02:00
John MacFarlane
e352ec5a0e LaTeX writer: Workaround for level 4-5 headers in quotes.
These previously produced invalid LaTeX: `\paragraph` or
`\subparagraph` in a `quote` environment.  This adds an
`mbox{}` in these contexts to work around the problem.
See http://tex.stackexchange.com/a/169833/22451.

Closes #1221.
2014-04-06 16:32:53 -07:00
John MacFarlane
fcddd0e4bd LaTeX reader: handle @{} and p{length} in tabular.
The length is not actually recorded, but at least we get a table.

Closes #1180.
2014-04-06 15:11:49 -07:00
Albert Krewinkel
480b33b710 Org reader: Add support for definition lists 2014-04-06 20:39:10 +02:00
Albert Krewinkel
4ebf6f6ebf Org reader: Minor code clean-up 2014-04-06 20:39:05 +02:00
John MacFarlane
971e4c4364 HTML reader: Updated closes with rules from HTML5 spec. 2014-04-05 23:05:11 -07:00
John MacFarlane
24f438aa5f Textile reader: Better support for attributes.
Instead of being ignored, attributes are now parsed and
included in Span inlines.

The output will be a bit different from stock textile:
e.g. for `*(foo)hi*`, we'll get `<em><span class="foo">hi</span></em>`
instead of `<em class="foo">hi</em>`.  But at least the data is
not lost.
2014-04-05 21:02:12 -07:00
John MacFarlane
060a76a38e Textile reader: Improved treatment of HTML spans (%).
Closes #1115.
2014-04-05 20:41:38 -07:00
John MacFarlane
75dbe87a99 Removed whitespace at ends of lines. 2014-04-05 20:31:27 -07:00
John MacFarlane
d4054444c0 Text.Pandoc.PDF: Ensure that temp directories deleted on Windows.
The PDF is now read as a strict bytestring, ensuring that process
ownership will be terminated, so the temp directory can be deleted.
Closes #1192.
2014-04-05 19:57:42 -07:00
John MacFarlane
f2deb9d86d Org reader: Added type signature. 2014-04-05 15:50:46 -07:00
John MacFarlane
971dca588e Merge pull request #1219 from tarleb/org-images
Org-reader: support inline images, clean-up code, fix bugs
2014-04-05 15:12:40 -07:00
John MacFarlane
c0309a60bc Shared.openURL: Set proxy with value of http_proxy env variable.
Note:  proxies with non-root paths are not supported,
because of limitations in http-conduit.

Closes #1211.
2014-04-05 10:58:32 -07:00
Albert Krewinkel
652c781e37 Org reader: Support inline images 2014-04-05 16:15:53 +02:00
Albert Krewinkel
d76d2b707b Org reader: Provide more language identifier translations
Org-mode and Pandoc use different language identifiers, marking source
code as being written in a certain programming language.  This adds more
translations from identifiers as used in Org to identifiers used in
Pandoc.

The full list of identifiers used in Org and Pandoc is available through
http://orgmode.org/manual/Languages.html and `pandoc -v`, respectively.
2014-04-05 16:15:50 +02:00
Albert Krewinkel
fd98532784 Org reader: Fix parsing of nested inlines
Text such as /*this*/ was not correctly parsed as a strong, emphasised
word.  This was due to the end-of-word recognition being to strict as it
did not accept markup chars as part of a word.  The fix involves an
additional parser state field, listing the markup chars which might be
parsed as part of a word.
2014-04-05 16:14:40 +02:00
Albert Krewinkel
d43c3e8101 Org reader: Use specialized org parser state
The default pandoc ParserState is replaced with `OrgParserState`.  This
is done to simplify the introduction of new state fields required for
efficient Org parsing.
2014-04-05 16:14:09 +02:00
Albert Krewinkel
7cf7e45e4c Org reader: Slight cleaning of table parsing code 2014-04-05 16:13:18 +02:00
John MacFarlane
ee2e769cd7 DocBook reader: Better treatment of formalpara.
We now emit the title (if present) as a separate paragraph
with boldface text.

Closes #1215.
2014-04-04 22:06:25 -07:00
John MacFarlane
e06aa97bb9 DocBook reader: set metadata "author" not "authors" 2014-04-04 21:39:08 -07:00
John MacFarlane
c5a0c7a819 Removed trailing whitespace. 2014-04-04 21:34:12 -07:00
John MacFarlane
c99ecf6cc5 DocBook reader: set "author" not "authors". 2014-04-04 21:33:16 -07:00
Matthew Pickering
1b930a9670 Added recognition of authorgroup element and releaseinfo element to DocBook reader.
Closes #1214
2014-04-04 21:00:49 -07:00