Commit graph

3913 commits

Author SHA1 Message Date
John MacFarlane
41627ed62c Man writer: Ensure that periods are escaped at beginning of line.
Closes #3270.
2016-12-05 00:50:17 +01:00
John MacFarlane
33b4bc8371 Pretty: Added afterBreak.
This makes it possible to insert escape codes for content
that needs escaping at the beginning of a line.
2016-12-05 00:49:53 +01:00
Albert Krewinkel
bfa734c402
LaTeX writer: Fix unnumbered headers when used with --top-level
Fix interaction of top-level divisions `part` or `chapter` with
unnumbered headers when emitting LaTeX.  Headers are ensured to be
written using stared commands (like `\subsection*{}`).

Fixes: #3272
2016-12-04 21:15:52 +01:00
John MacFarlane
7ace7dd66b Markdown writer: Fixed incorrect word wrapping.
Previously pandoc would sometimes wrap lines too early
due to this bug.

Closes #3277.
2016-12-04 17:13:06 +01:00
John MacFarlane
fb8a2540bd Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless
a template was provided in writerTemplate.  Now a fragment
will be generated if writerTemplate is Nothing; otherwise,
the specified template will be used and standalone output
generated.  [API change]
2016-11-30 15:34:58 +01:00
John MacFarlane
ac83d4b806 Use new module from texmath to lookup MS font codepoints.
+ Removed Text.Pandoc.Readers.Docx.Fonts
+ Moved its code to texmath; we now use (from texmath 0.9)
  Text.TeXMath.Unicode.Fonts
+ Use texmath 0.9 (currently from git).
+ Updated epub tests because texmath now handles more mathml.
2016-11-30 00:43:55 +01:00
John MacFarlane
e2a452ba4a Shared.fetchItem: Better handling of protocol-relative URL.
If URL starts with `//` and there is no "base URL" (as there
would be if a URL were used on the command line), then default
to http:.

Closes #2635.
2016-11-27 21:19:26 +01:00
John MacFarlane
ea916432ac Updated renderHtml import in HTML writer to avoid deprecated function. 2016-11-27 21:18:58 +01:00
Albert Krewinkel
1fc07ff4da Refactor top-level division selection (#3261)
The "default" option is no longer represented as `Nothing` but via a new
type constructor, making the `Maybe` wrapper superfluous.

The default behavior of using heuristics can now be enabled explicitly
by setting `--top-level-division=default`.

API change (`Text.Pandoc.Options`): The `Division` type was renamed to
`TopLevelDivision`. The `Section`, `Chapter`, and `Part` constructors
were renamed to `TopLevelSection`, `TopLevelChapter`, and
`TopLevelPart`, respectively. An additional `TopLevelDefault`
constructor was added, which is now also the new default value of the
`writerTopLevelDivision` field in `WriterOptions`.
2016-11-27 20:31:04 +01:00
John MacFarlane
5222572033 HTML reader: improved table parsing.
We now check explicitly for non-1 rowspan or colspan
attributes, and fail when we encounter them. Previously
we checked that each row had the same number of cells,
but that could be true even with rowspans/colspans.
And there are cases where it isn't true in tables that
we can handle fine -- e.g. when a tr element is empty.
So now we just pad rows with empty cells when needed.

Closes #3027.
2016-11-26 22:28:28 +01:00
John MacFarlane
7b4a12a532 Revert "Open Document writer: set first level of blockquotes to not use indent (#2757)"
This reverts commit fee0b913c5.

The previous commit did not provide a good way to get increased
indentation for nested block quotes.

Rolling it back for now. @jjsheets feel free to submit something
that handles multiple levels of block quote smoothly, if you like.
2016-11-26 22:03:57 +01:00
Jeff Sheets
fee0b913c5 Open Document writer: set first level of blockquotes to not use indent (#2757)
* Open Document writer: set first level of blockquotes to not use indent
Nested blockquotes start using indents like before. Quotation style is
still in use, so the style's indent settings take effect on the first
level of blockquotes.

* Removed list construction to improve pull request to fix #2747
2016-11-26 21:50:20 +01:00
hubertp-lshift
5219599a77 [Tex] Remove invalid inlines in sections (#3218)
Latex doesn't like when hypertargets or images are
put in the options list of the section. They are not
lost since they were actually duplicated and present
also in the second argument list.

Note on the implementation:
I had to inline the definiton of 'foldMap' since it is
not implemented in every version of Haskell that Pandoc
supports.
2016-11-26 21:47:51 +01:00
hubertp-lshift
015dead0bb [odt] Infer table's caption from the paragraph (#3224)
ODT's reader always put empty captions for the parsed
tables. This commit
1) checks paragraphs that follow the table definition
2) treats specially a paragraph with a style named 'Table'
3) does some postprocessing of the paragraphs that combines
 tables followed immediately by captions

The ODT writer used 'TableCaption' style name for the caption
paragraph. This commit follows the open office approach which
allows for appending captions to table but uses a built-in style
named 'Table' instead of 'TableCaption'. Any users of odt format
(both writer and reader) are therefore required to change the
style's name to 'Table', if necessary.
2016-11-26 21:45:56 +01:00
Albert Krewinkel
baa25362a4 Allow to overwrite top-level division type heuristics (#3258)
Pandoc uses heuristics to determine the most resonable top-level
division type when emitting LaTeX or Docbook markup.  It is now possible
to overwrite this implicitly set top-level division via the
`top-level-division` command line parameter.

API change (`Text.Pandoc.Options`): the type of the
`writerTopLevelDivision` field in of the `WriterOptions` data type is
altered from `Division` to `Maybe Division`. The field's default value
is changed from `Section` to `Nothing`.

Closes: #3197
2016-11-26 21:43:46 +01:00
John MacFarlane
2873cd8288 LaTeX reader: don't treat \vspace and \hspace as block commands.
Fixed an error which came up, for example, with `\vspace`
inside a caption.  (Captions expect inlines.)

Closes #3256.
2016-11-26 21:27:56 +01:00
Albert Krewinkel
f4a8f12387
Org reader: respect column width settings
Table column properties can optionally specify a column's width with
which it is displayed in the buffer. Some exporters, notably the ODT
exporter in org-mode v9.0, use these values to calculate relative column
widths. The org reader now implements the same behavior.

Note that the org-mode LaTeX and HTML exporters in Emacs don't support
this feature yet, which should be kept in mind by users who use the
column widths parameters.

Closes: #3246
2016-11-24 20:07:39 +01:00
John MacFarlane
d7fb9db295 LaTeX writer: use \autocites* when "suppress-author" citation used. 2016-11-24 10:12:13 +01:00
John MacFarlane
03788eb164 Fixed some bugs in Pretty that caused blank lines in tables.
The bugs caused spurious blank lines in grid tables
when we had things like

    blankline $$ blankline

Closes #3251.
2016-11-23 15:18:03 +01:00
John MacFarlane
5449e4a226 Docx writer: Give full detail when there are errors converting tex math. 2016-11-22 22:21:07 +01:00
John MacFarlane
77912ddc56 Put 'warn' in MonadIO. Add warnings for math conversions in docx. 2016-11-22 10:56:59 +01:00
John MacFarlane
8d7ecc27a1 Allow beamer-style <...> options in raw LaTeX (also in Markdown).
This allows use of things like `\only<2,3>{my content}` in
Markdown that is going to be converted to beamer.

Closes #3184.
2016-11-20 21:17:41 +01:00
John MacFarlane
bd19176026 LaTeX writer: ensure that simple tables have simple cells.
If cells contain more than a single Plain or Para, then
we need to set nonzero widths and put contents into minipages.

Closes #2666.
2016-11-20 17:01:51 +01:00
Björn Peemöller
2761fecd57 Fix for calculation of column widths for aligned multiline tables
This also fixes excessive CPU and memory usage for tables
when --columns is set in such a way that cells must be very
tiny.

Now cells are guaranteed to be big enough so that single
words don't need to line break, even if this pushes the
line length above the column width.

Closes #1911.
2016-11-19 23:14:35 +01:00
Björn Peemöller
18f5d25abe Added function to compute the minimal width of a document 2016-11-19 23:04:29 +01:00
Björn Peemöller
6246d6e213 Added error message for illegal call to Pretty.block 2016-11-19 23:03:53 +01:00
John MacFarlane
d905551b12 LaTeX reader: improved table handling.
We can now parse all of the tables emitted by pandoc in
our tests.

The only thing we don't get yet are alignments and
column widths in more complex tables.

See #2669.
2016-11-19 22:46:32 +01:00
John MacFarlane
f255625ad7 LaTeX reader: limited support for minipage. 2016-11-19 22:46:32 +01:00
Albert Krewinkel
64413b1ce2
Un-break Travis build
Remove whitespace before function documentation The extra spaced cause
problems with documentation tools and Travis tests are failing because
of this.
2016-11-19 22:30:02 +01:00
John MacFarlane
5a1796e650 LaTeX reader: improved parsing of tables.
Reader can now parse simple LaTeX tables such as those
generated by pandoc itself.

We still can't handle pandoc multiline tables which involve
minipages and column widths.

Partially addresses #2669.
2016-11-19 21:36:16 +01:00
John MacFarlane
e4798a6726 Fixed xref lookup in DocBook reader. Closes #3243.
It previously only worked when the qnames lacked the docbook
namespace URI.
2016-11-19 10:30:20 +01:00
Albert Krewinkel
1a8af5fc44
Org reader: Ensure images in paragraphs are not parsed as figures
This fixes a regression introduced in
7e5220b57c.
2016-11-19 01:17:04 +01:00
John MacFarlane
f9df62c29f Export Text.Pandoc.getDefaultExtensions.
See #3178.
2016-11-18 17:01:09 +01:00
John MacFarlane
a729dd8ad3 Docx writer: fixed XML markup for empty cells.
Closes #3238.

Previously the Compact style wasn't being applied properly
to empty cells.
2016-11-18 16:47:23 +01:00
John MacFarlane
31076adf09 Markdown writer: Use bracketed form for native spans...
...when `bracketed_spans` enabled.

Closes #3229.
2016-11-18 11:58:56 +01:00
ickc
e8ce21d614 Small caps in Bracketed Spans (#3191)
* Markdown reader: modify bracketedSpan to check small caps

* MANUAL.txt: add description on the use of `bracketed_spans` in small cap

* Improve markdown readers: bracketedSpan function EXACTLY as spanHtml
2016-11-16 11:53:51 +01:00
John MacFarlane
0dfcedad7e Adjust widths in Markdown grid tables so that they match on round-trip. 2016-11-15 16:48:24 +01:00
John MacFarlane
298e6f38f9 Allow alignments to be specified in Markdown grid tables. 2016-11-15 16:41:54 +01:00
John MacFarlane
064e3f8c55 Markdown writer: fixed inconsistent spacing issue.
Previously a tight bullet sublist got rendered with
a blank line after, while a tight ordered sublist did
not.  Now we don't get the blank line in either case.

Closes #3232.
2016-11-15 10:32:16 +01:00
John MacFarlane
50f0cfcc1a HTML reader: only treat "a" element as link if it has href.
Otherwise treat as span.

Closes #3226.
2016-11-13 22:41:11 +01:00
John MacFarlane
3de6b97b9f Use correct mime types for woff and woff2.
Closes #3228.
2016-11-12 23:22:34 +01:00
John MacFarlane
b6a916974e Markdown writer: Fix escaping of spaces in super/subscript.
Previously two backslashes were inserted, which gave a
literal backslash.

Closes #3225.
2016-11-12 23:19:15 +01:00
Jesse Rosenthal
eea4d14f60 Docx reader: add a placeholder value for CHART.
We wrap `[CHART]` in a `<span class="chart">`. Note that it maps to
inlines because, in docx, anything in a drawing tag can be part of a
larger paragraph.
2016-11-10 13:19:27 -05:00
Jesse Rosenthal
7539de0287 Docx reader: Be more specific in parsing images
We not only want "w:drawing", because that could also include
charts. Now we specify "w:drawing"//"pic:pic". This shouldn't change
behavior at all, but it's a first step toward allowing other sorts of
drawing data as well.
2016-11-10 13:19:27 -05:00
Albert Krewinkel
7e5220b57c
Org reader: allow HTML attribs on non-figure images
Images which are the only element in a paragraph can still be given HTML
attributes, even if the image does not have a caption and is hence not a figure.
The following will add set the `width` attribute of the image to `50%`:

    #+ATTR_HTML: :width 50%
    [[file:image.jpg]]

Closes: #3222
2016-11-09 22:49:20 +01:00
Hubert Plociniczak
13bc573e7f Inline code when text has a special style
When a piece of text has a text 'Source_Text' then
we assume that this is a piece of the document
that represents a code that needs to be inlined.
Addapted an odt writer to also reflect that change;
previously it was just writing a 'preformatted' text using
a non-distinguishable font style.

Code blocks are still not recognized by the ODT reader.
That's a separate issue.
2016-11-08 09:29:46 -05:00
John MacFarlane
eced02d70e Markdown reader: Allow reference link labels starting with @...
...if citations extension disabled.  Example:  in

    [link text][@a]

    [@a]: url

`link text` isn't hyperlinked because `[@a]` is parsed as a citation.
Previously this happened whether or not the `citations` extension was
enabled. Now it happens only if the `citations` extension is enabled.

Closes #3209.
2016-11-05 21:14:20 +01:00
Jesse Rosenthal
4a99e142ec Docx Reader: abstract out function to avoid code repetition. 2016-11-02 12:28:56 -04:00
Jesse Rosenthal
378603c770 Docx writer: Handle title text in images.
We already handled alt text. This just puts the image "title" into the
docx "title" attr.
2016-11-02 12:10:45 -04:00
Jesse Rosenthal
effc348965 Docx reader: Handle Alt text and titles in images.
We use the "description" field as alt text and the "title" field as
title. These can be accessed through the "Format Picture" dialog in
Word.
2016-11-02 12:10:45 -04:00
Jesse Rosenthal
1138ae6656 Docx reader utils: handle empty namespace in elemName
Previously, if given an empty namespace:

    (elemName ns "" "foo")

`elemName` would output a QName with a `Just ""` namespace. This is
never what we want. Now we output a `Nothing`. If someone *does* want a
`Just ""` in the namespace, they can enter the QName value explicitly.
2016-11-02 12:10:45 -04:00
John MacFarlane
bdda4b185b HTML reader: treat <math> as MathML by default...
unless something else is explicitly specified in xmlns.
Provided it parses as MathML, of course.

Also fixed default which should be to inline math if no
display attribute is used.
2016-11-02 16:43:36 +01:00
John MacFarlane
705df61198 LaTeX reader: Handle BVerbatim from fancyvrb. Fixes #3203. 2016-11-02 12:05:56 +01:00
John MacFarlane
eb5cb0f304 Handle hungarumlaut in LaTeX reader. Closes #3201. 2016-11-01 10:17:15 +01:00
hubertp-lshift
01a21dd43f [odt] Infer tables' header props from rows (#3199)
ODT reader simply provided an empty header list
which meant that the contents of the whole table,
even if not empty, was simply ignored.
While we still do not infer headers we at least have
to provide default properties of columns.
2016-11-01 10:07:39 +01:00
John MacFarlane
5d02e478d0 LaTeX reader: allow for []s inside LaTeX optional args.
Fixes cases like:

    \begin{center}
    \begin{tikzpicture}[baseline={([yshift=+-.5ex]current bounding box.center)}, level distance=24pt]
    \Tree [.{S} [.NP John\index{i} ] [.VP [.V likes ] [.NP himself\index{i,*j} ]]]
    \end{tikzpicture}
    \end{center}
2016-10-31 22:04:22 +01:00
Albert Krewinkel
4f06e6c445
Org reader: support ATTR_HTML for special blocks
Special blocks (i.e. blocks with unrecognized names) can be prefixed
with an `ATTR_HTML` block attribute.  The attributes defined in that
meta-directive are added to the `Div` which is used to represent the
special block.

Closes: #3182
2016-10-30 20:23:53 +01:00
Albert Krewinkel
63bdc5d08f
Org reader: support the todo export option
The `todo` export option allows to toggle the inclusion of TODO keywords
in the output.  Setting this to `nil` causes TODO keywords to be dropped
from headlines.  The default is to include the keywords.
2016-10-30 13:20:25 +01:00
Albert Krewinkel
d5182778c4
Org reader: add support for todo-markers
Headlines can have optional todo-markers which can be controlled via the
`#+TODO`, `#+SEQ_TODO`, or `#+TYP_TODO` meta directive.  Multiple such
directives can be given, each adding a new set of recognized todo-markers.
If no custom todo-markers are defined, the default `TODO` and `DONE`
markers are used.

Todo-markers are conceptually separate from headline text and are hence
excluded when autogenerating headline IDs.

The markers are rendered as spans and labelled with two classes: One
class is the markers name, the other signals the todo-state of the
marker (either `todo` or `done`).
2016-10-30 10:27:47 +01:00
Daniele D'Orazio
78e4fbda51 Markdown Reader: add attributes for autolink (#3183) 2016-10-26 12:18:58 +02:00
John MacFarlane
c46ad7c8db reveal.js: don't change slide title to level 1 header.
This also affects other HTML slide show formats.

Closes #2221.
2016-10-25 17:07:51 +02:00
John MacFarlane
d51e475bad Export Text.Pandoc.Error in Text.Pandoc.
[API change]
2016-10-24 22:31:36 +02:00
John MacFarlane
bf72a482eb Tighten up parsing of raw email addresses.
Technically `**@user` is a valid email address, but if we
allow things like this, we get bad results in markdown flavors
that autolink raw email addresses. (See #2940.)
So we exclude a few valid email addresses in order to
avoid these more common bad cases.

Closes #2940.
2016-10-23 23:12:36 +02:00
Thomas Weißschuh
96fa1daa6e fix example in documentation (#3176)
Errors are encountered while reading, not writing
2016-10-23 21:48:22 +02:00
Mauro Bieg
9dd18ebf34 ICML writer: replace partial function (!!) in table handling (#3175) 2016-10-23 21:42:33 +02:00
John MacFarlane
696dfbc993 Added angle_brackets_escapable extension.
This is needed because github flavored Markdown has a slightly
different set of escapable symbols than original Markdown;
it includes angle brackets.

Closes #2846.
2016-10-22 23:41:55 +02:00
John MacFarlane
d2a6533d6e EPUB reader: don't add root path to data: URIs.
Closes #3150.

Thanks to @lep for the bug report and patch.
2016-10-22 23:07:15 +02:00
John MacFarlane
1da40d63b1 Merge pull request #3108 from tarleb/part
Add command line option allowing to set type of top-level divisions
2016-10-19 14:07:44 +02:00
Albert Krewinkel
595a171407
Add option for top-level division type
The `--chapters` option is replaced with `--top-level-division` which allows
users to specify the type as which top-level headers should be output. Possible
values are `section` (the default), `chapter`, or `part`.

The formats LaTeX, ConTeXt, and Docbook allow `part` as top-level division, TEI
only allows to set the `type` attribute on `div` containers.  The writers are
altered to respect this option in a sensible way.
2016-10-19 13:12:57 +02:00
Hubert Plociniczak
dd799df0ae Image with a caption needs special formatting
Latex Writer only handles captions if the image's title
is prefixed with 'fig:'.
2016-10-19 11:40:44 +02:00
John MacFarlane
4a2a7a21e5 Merge pull request #3166 from hubertp-lshift/bug/3134
Issue 3143: Don't duplicate text for anchors
2016-10-18 22:03:45 +02:00
John MacFarlane
0cd11b3e54 Merge pull request #3165 from hubertp-lshift/feature/odt-image
[odt] images parser
2016-10-18 22:00:58 +02:00
John MacFarlane
8264ae2abe Better fix for the problem with ghc 7.8. 2016-10-18 16:25:13 +02:00
John MacFarlane
3747abf029 Try to fix build error on ghc 7.8.
@tarleb this is an interesting one, see the build log in
https://travis-ci.org/jgm/pandoc/jobs/168612017

It only failed on ghc 7.8; I think this must have to do with
the change making Monad a superclass of Applicative, hence
this change.
2016-10-18 16:03:34 +02:00
Hubert Plociniczak
c74c5fdd97 Issue 3143: Don't duplicate text for anchors
When creating an anchor element we were adding its representation
as well as the original content, leading to text duplication.
2016-10-18 10:50:37 +02:00
Albert Krewinkel
1266b210ac
Org writer: drop space before footnote markers
The writer no longer adds an extra space before footnote markers.

Fixes: #3162
2016-10-17 22:11:03 +02:00
Hubert Plociniczak
4417e33ea9 Use bind function instead of pattern matching 2016-10-17 16:58:53 +02:00
Hubert Plociniczak
7234321e8f Minor refactoring 2016-10-17 16:50:03 +02:00
Hubert Plociniczak
a02f276ff1 Infer caption from the text following the img
Frame can contain other frames with the text boxes.
This is something that has not been considered before
and meant that the whole construction of images was
broken in those cases. Also the captions were fixed/ignored.
2016-10-17 16:35:13 +02:00
Jesse Rosenthal
e666c92bc9 RST reader: skip whitespace before note.
RST requires a space before a footnote marker. We discard those spaces
so that footnotes will be adjacent to the text that comes before
it. This is in line with what rst2latex does. rst2html does not discard
the space, but its html output is different than pandoc's, so this seems
the most semantically correct approach.

Closes #3163
2016-10-17 09:54:59 -04:00
Albert Krewinkel
462c140eb6
Org reader: allow figure with empty caption
A `#+CAPTION` attribute before an image is enough to turn an image into a
figure. This wasn't the case because the `parseFromString` function, which
processes the caption value, would fail on empty values. Adding a newline
character to the caption value fixes this.

Fixes: #3161
2016-10-14 23:16:51 +02:00
John MacFarlane
9bd1da122a Merge pull request #3146 from hubertp-lshift/feature/odt-list-start-value
[ODT Parser] Include list's starting value
2016-10-14 15:15:50 +02:00
Hubert Plociniczak
9282fadc6b Added tests and a corner case for starting number
Review revealed that we didn't handle the case
when the starting point is an empty string. While
this is not a valid .odt file, we simply added
a special case to deal with it.

Also added tests for the new feature.
2016-10-14 13:56:24 +02:00
Jesse Rosenthal
cd1427876e Markdown writer: Abstract out note/ref function.
We do basically the same thing every time we insert notes, so let's cut
down on code duplication.
2016-10-13 11:04:35 -04:00
John MacFarlane
6d13567ac5 Allow http-client 0.4.30, which is the version in stackage lts.
Previously we required 0.5.
Remove CPP conditionals for earlier versions.
2016-10-13 13:01:49 +02:00
John MacFarlane
4a1ef0b51d Revert "Remove http-client CPP conditionals."
This reverts commit 3f82471355.

We might want to revert the requirement of http-client 0.5,
as this is not yet in Stackage and that is starting to
cause problems.  I can't recall why it is there.
2016-10-13 12:35:58 +02:00
Albert Krewinkel
3e60ed9c03
Allow empty lines when parsing line blocks
Line blocks are allowed to contain empty lines and should be parsed as a
single block in that case.  Previously an empty (line block) line would
have terminated parsing of the line block element.
2016-10-13 08:46:44 +02:00
Albert Krewinkel
c9460e7013
Parse line-oriented markup as LineBlock
Markup-features focusing on lines as distinctive part of the markup are read
into `LineBlock` elements. This currently means line blocks in reStructuredText
and Markdown (the latter only if the `line_block` extension is enabled), the
`linegroup`/`line` combination from the Docbook 5.1 working draft, and Org-mode
`VERSE` blocks.
2016-10-13 08:46:44 +02:00
Albert Krewinkel
22cb9e3327
Add support for the LineBlock element to writers
The following markup features are used to output the lines of the `LineBlock`
element:

  - AsciiDoc: a `[verse]` block,
  - ConTeXt: text surrounded by `\startlines` and `\endlines`,
  - HTML: `div` with an per-element style setting to interpret the content as
    pre-wrapped,
  - Markdown: line blocks if the `line_blocks` extension is enabled, a simple
    paragraph with hard linebreaks otherwise,
  - Org: VERSE block,
  - RST: a line block, and
  - all other formats: a paragraph, containing hard linebreaks between lines.

Custom lua writers should be updated to use the `LineBlock` element.
2016-10-13 08:46:44 +02:00
Albert Krewinkel
64b77cc2c5
Shared: add function combining lines using LineBreak
The `linesToBlock` function takes a list of lines and combines them by appending
a hard `LineBreak` to each line and concatenating the result, putting the result
it into a `Para`. This is most useful when dealing when converting `LineBlock`
elements.
2016-10-13 08:46:38 +02:00
Hubert Plociniczak
edc951ee7d [ODT Parser] Include list's starting value
Previously the starting value of the lists' items has been
hardcoded to 1. In reality ODT's list style definition can
provide a new starting value in one of its attributes.

Writers already handle the modified start value so no need
to change anything in that area.
2016-10-12 18:36:40 +02:00
Hubert Plociniczak
c924611de5 Basic support for images in ODT documents
Highly influenced by the docx support, refactored
some code to avoid DRY.
2016-10-12 17:50:35 +02:00
John MacFarlane
901045b0bb Merge pull request #3159 from jkr/refs
Specify location for footnotes (and reference links) in MD output
2016-10-12 11:11:06 +02:00
Jesse Rosenthal
ca50deeeee Markdown writer: Allow footnotes/refs at the end of blocks, sections
This allows footnotes and refs to be placed at the end of blocks and
sections. Note that we only place them at the end of blocks that are at
the top level and before headers that are the top level. We add an
environment variable to keep track of this. Because we clear the
footnotes and refs when we use them, we also add a state variable to
keep track of the starting number.

Finally, note that we still add any remaining footnotes at the end. This
takes care of the final section, if we are placing at the end of a
section, and will always come after a final block as well.
2016-10-11 15:17:01 -04:00
Jesse Rosenthal
6914808139 Add ReaderT monad for environment variables.
This will make it easier to keep track of what level of block we are at.
2016-10-11 13:53:47 -04:00
Jesse Rosenthal
27113bda1f Options: Add references location.
This will be used by the markdown writer for deciding where to put links
and footnotes.
2016-10-11 13:30:01 -04:00
Albert Krewinkel
bb48f2edc4
Org reader: trim verse lines properly
An empty verse line should not result in `Str ""` but in `mempty`.
2016-10-10 21:12:47 +02:00
John MacFarlane
f4b7ab125e More checks for Ext_raw_html when rendering HTML in Markdown.
Previously we'd emit raw HTML tables even if the `raw_html`
extension was disabled.

Now we just emit `[TABLE]` if no table formats are enabled
and raw HTML is not enabled.

We also check for the `raw_html` extension before emiting
a raw HTML block.

Closes #3154.
2016-10-10 11:23:04 +02:00
KolenCheung
46be319ca9 removed mmd raw_tex in src/Text/Pandoc/Options.hs 2016-10-09 21:30:03 +02:00
Jesse Rosenthal
6d05c378d0 Docx writer: Move one more env var to Reader monad
PrintWidth is set at the beginning and stays the same throughout the
document writing, so we just set it as an env variable in the Reader
monad.
2016-10-05 08:15:55 -04:00
Jesse Rosenthal
4eba314c24 Docx writer: code legibility fixups.
More meaningful variable name, and explanatory comment.
2016-10-05 08:06:22 -04:00
Jesse Rosenthal
be27c9c646 Docx writer: Clean up and streamline RTL behavior
Now RTL is turned and off by a general function, `withDirection`
wrapping `inlineToOpenXML` and `blockToOpenXML`. This acts according to
the `envRTL` variable. This means we can just set the environment at the
outset, and change the environment with `local` as need be.

Note that this requires making the `inlineToOpenXML` and
`blockToOpenXML` functions into wrappers around
primed-versions (`{inline,block}ToOpenXML`) where the real work takes
place.
2016-10-04 11:18:11 -04:00
Jesse Rosenthal
1893f8fe48 Docx writer: move a couple more vars to ReaderT
In general, we want things that are either:

 1. unchanging environment variables, or
 2. environment variables that will change for a the scope of
    a function and then pop back

to be in the reader monad. This is safer for (1), since we won't
accidentally change it, and easier for (2), since we can use `local`
instad of setting the old value and then resetting.

We keep the StateT monad for values that we will want to accumulate or
change and then use later.
2016-10-04 08:54:35 -04:00
Jesse Rosenthal
41f4c8741f Clean up commented-out code
A few commented out functions were left in the code during the
conversion from StateT to ReaderT. This removes them.
2016-10-03 21:48:59 -04:00
Jesse Rosenthal
ab31d5ea8d Remove bool on setRTL.
We had to use this because we set the env, which means that setRTL
wouldn't do anything at the top level. We now don't set the env (it will
always be false at the outset), which means the toplevel setRTL will
work if necessary.
2016-10-03 21:39:40 -04:00
Jesse Rosenthal
666c042e80 Filter text/para props correctly.
We only filter on the name, not the prefix.
2016-10-03 21:39:40 -04:00
Jesse Rosenthal
acf352331c Add a boolean flag to the setRTL function.
At the toplevel we don't check to see if RTL is already set.
2016-10-03 21:39:40 -04:00
Jesse Rosenthal
e98be61a38 Test for "dir" metadata. 2016-10-03 21:39:40 -04:00
Jesse Rosenthal
8d148c02a8 Add setRTL and setLTR functions. 2016-10-03 21:39:34 -04:00
Jesse Rosenthal
a2d3854f23 Move more enviroment vars to Reader Monad.
Things that get pushed and then reset are better in ReaderT, because
they can be run with `local`.
2016-10-03 12:12:38 -04:00
Jesse Rosenthal
6a3d1cf210 Add ReaderT env to the docx writer:
This will allow us to add text and paragraph properties depending on if
rtl is already set or not.

(It would probably be cleaner and safer to move the paraprops and
textprops to this part of the stack in the future.)
2016-10-03 07:50:40 -04:00
John MacFarlane
1435906f09 MediaWiki writer: transform filename with underscores in images.
`foo bar.jpg` becomes `foo_bar.jpg`. This was already done
for internal links, but it also needs to happen for images.

Closes #3052.
2016-10-02 22:09:20 +02:00
John MacFarlane
d0bfcbb801 EPUB writer: use stringify instead of plain writer for metadata.
This means that underscores won't be used for emphasis,
or CAPS for bold.  The metadata fields will just have unadorned
text.

Closes #3066.
2016-10-02 22:01:22 +02:00
John MacFarlane
46d8b42da5 AsciiDoc writer: avoid unnecessary use of "unconstrained" emphasis.
In AsciiDoc, you must use a special form of emphasis (double `__`)
for intraword emphasis.  Pandoc was previously using this more
than necessary.

Closes #3068.
2016-10-02 21:51:34 +02:00
John MacFarlane
5ec9b6352c Moved template compiling/rendering code to a separate library.
jgm/doctemplates.

This allows the pandoc templating system to be used independently.
2016-10-02 09:30:26 +02:00
John MacFarlane
e95047ed85 Markdown reader: added bracket syntax for native spans.
See #168.

Text.Pandoc.Options.Extension has a new constructor `Ext_brackted_spans`,
which is enabled by default in pandoc's Markdown.
2016-09-28 12:33:05 +02:00
John MacFarlane
c6d3eca44e Merge pull request #3093 from wilx/master-figure-placement
LaTeX: Do not set [htbp] figure placement options.
2016-09-28 11:17:48 +02:00
Jesse Rosenthal
581fc0130b LaTeX writer: change braced backtick to \textasciigrave{}
Backticks in verbatim environments are converted to
open-single-quotes. This change makes them appear as backticks. This
corresponds to how we treat `'' in verbatim environments (with
\textquotesingle{}).
2016-09-20 09:44:35 -04:00
Jesse Rosenthal
5b5f55a710 LaTeX writer: enclose backtick in {} in verbatim
We don't want ligatures like ` ?` ` (which produces `¿`) inside
`\texttt{}` environments, so we enclose the backtick in braces.

This fixes #3121
2016-09-19 16:23:28 -04:00
Albert Krewinkel
aca695ab0b
TEI writer: remove heuristic to detect book template
TEI doesn't have `<book>` elements but only generic `<divN>` division elements.
Checking the template for a trailing `</book>` is nonsensical.
2016-09-13 18:21:03 +02:00
Oliver Matthews
23fb52ef7d
Add --parts command line option to LaTeX writer.
Add --parts command line argument.
This only effects LaTeX writer, and only for non-beamer output formats.
It changes the output levels so the top level is 'part', the next
'chapter' and then into sections.
2016-09-06 21:43:45 +02:00
John MacFarlane
fd4831dd03 DocBook writer: include an anchor element when a div or span has an id.
This closes #3102.  Note that DocBook does not have a class attribute,
but at least this provides an anchor for internal links.
2016-09-06 10:09:52 +02:00
Jesse Rosenthal
3f82471355 Remove http-client CPP conditionals.
Our lower bound on http-client is 0.5, and both of these min_version
tests are less than 0.5, so they will always pass.
2016-09-03 08:41:00 -04:00
Jesse Rosenthal
7d9f2d3657 Remove blaze-html CPP conditional.
This tests for a min value >= 0.5. But we have a lower bound of 0.5 in
pandoc.cabal, so the test will always pass.

(If we bump the lower bound to 0.5.1, we can remove a conditional in the
HTML writer as well.)
2016-09-03 08:40:13 -04:00
Jesse Rosenthal
df1ca2b1a5 Add EOL note to time compat module.
Because time 1.4 is a boot library for GHC 7.8, we will support the
compatibility module as long as we support 7.8. But we should be clear
about when we will no longer need it.
2016-09-03 08:10:53 -04:00
Jesse Rosenthal
3f8d3d844f Remove TagSoup compat
We already lower-bound tagsoup at 0.13.7, which means we were always
running the compatibility layer (it was conditional on min value
0.13). Better to just use `lookupEntity` from the library directly, and
convert a string to a char if need be.
2016-09-02 12:28:53 -04:00
Jesse Rosenthal
c613dbde01 Remove unnecessary CPP condition in UTF8
Base 4.4 is ghc 7.2, so we don't have to worry about getting a lower version.
2016-09-02 09:18:09 -04:00
Jesse Rosenthal
7ea16ad058 Actually remove T/P/Compat/Except. 2016-09-02 09:18:09 -04:00
Jesse Rosenthal
f72e3b58e8 Remove directory compat
directory 1.1 depends on base 4.5 (ghc 7.4) which we are no longer
supporting. So we don't have to use a compatibility layer for it.
2016-09-02 09:18:09 -04:00
Jesse Rosenthal
7f676b534a Remove Text.Pandoc.Compat.Except 2016-09-02 09:18:09 -04:00
Jesse Rosenthal
26c3705da4 Fix grouping of imports.
Some source files keep imports in tidy groups. Changing
`Text.Pandoc.Compat.Monoid` to `Data.Monoid` could upset that. This
restores tidiness.
2016-09-02 09:18:09 -04:00
Jesse Rosenthal
1cdebe1170 Remove an inline monad compatibility macro. 2016-09-02 09:18:08 -04:00
Jesse Rosenthal
45c7108b4f Remove Compat.Monoid
This was only necessary for GHC versions with base below 4.5
(i.e., ghc < 7.4).
2016-09-02 09:18:08 -04:00
John MacFarlane
b0013bfb13 PDF: Don't crash with nonexistent image.
Instead, emit the alt text, emphasized.  This accords with what
the ODT writer currently does.

The user will still get a warning about a nonexistent image,
but will no longer get a LaTeX crash.

Closes #3100.
2016-09-02 11:44:50 +02:00
John MacFarlane
07c67cf868 Merge pull request #3091 from wilx/master-narrow-no-break-space
Translate NARROW NO-BREAK SPACE into LaTeX.
2016-09-02 11:42:18 +02:00
Albert Krewinkel
21cd76c201
Org reader: respect unnumbered header property
Sections the `unnumbered` property should, as the name implies, be
excluded from the automatic numbering of section provided by some output
formats.  The Pandoc convention for this is to add an "unnumbered" class
to the header.  The reader treats properties as key-value pairs per
default, so a special case is added to translate the above property to a
class instead.

Closes #3095.
2016-08-30 18:10:24 +02:00
Jesse Rosenthal
abc4bca46b Docx reader: make all compilers happy with traversable.
The last attempt to make 7.8 happy made 7.10 unhappy. So we need some
conditional logic to appease all versions.
2016-08-29 23:16:40 -04:00
Jesse Rosenthal
773adc7804 Docx reader: Import traverse for ghc 7.8
The GHC 7.8 build was erroring without it.
2016-08-29 21:34:26 -04:00
Jesse Rosenthal
7ae9621a87 Docx reader: clean up function with traverse 2016-08-29 18:56:24 -04:00
Albert Krewinkel
a3a3e3fdbf
Merge branch 'org-meta-handling' 2016-08-29 14:42:23 +02:00
Albert Krewinkel
88313c0b93
Org reader: respect creator export option
The `creator` option controls whether the creator meta-field should be
included in the final markup.  Setting `#+OPTIONS: creator:nil` will
drop the creator field from the final meta-data output.

Org-mode recognizes the special value `comment` for this field, causing
the creator to be included in a comment.  This is difficult to translate
to Pandoc internals and is hence interpreted the same as other truish
values (i.e. the meta field is kept if it's present).
2016-08-29 14:35:16 +02:00
Albert Krewinkel
0568aa5cad
Org reader: respect email export option
The `email` option controls whether the email meta-field should be
included in the final markup. Setting `#+OPTIONS: email:nil` will drop
the email field from the final meta-data output.
2016-08-29 14:34:39 +02:00
Albert Krewinkel
117d3f4d92
Org reader: respect author export option
The `author` option controls whether the author should be included in
the final markup.  Setting `#+OPTIONS: author:nil` will drop the author
from the final meta-data output.
2016-08-29 14:33:18 +02:00
Albert Krewinkel
28d17ea70f
Org reader: read HTML_head as header-includes
HTML-specific head content can be defined in `#+HTML_head` lines.  They
are parsed as format-specific inlines to ensure that they will only show
up in HTML output.
2016-08-29 14:10:57 +02:00
Albert Krewinkel
d164ead379
Org reader: set classoption meta from LaTeX_class_options 2016-08-29 14:10:57 +02:00
Albert Krewinkel
825ce8ca73
Org reader: set documentclass meta from LaTeX_class 2016-08-29 14:10:57 +02:00
Albert Krewinkel
a257488343
Org reader: read LaTeX_header as header-includes
LaTeX-specific header commands can be defined in `#+LaTeX_header` lines.
They are parsed as format-specific inlines to ensure that they will only
show up in LaTeX output.
2016-08-29 14:10:57 +02:00
Albert Krewinkel
75df104215
Org reader: give precedence to later meta lines
The last meta-line of any given type is the significant line.
Previously the value of the first line was kept, even if more lines of
the same type were encounterd.
2016-08-29 14:10:57 +02:00
Albert Krewinkel
2ca2585b35
Org reader: allow multiple, comma-separated authors
Multiple authors can be specified in the `#+AUTHOR` meta line if they
are given as a comma-separated list.
2016-08-29 14:10:57 +02:00
Albert Krewinkel
153970bef5
Org reader: read markup only for special meta keys
Most meta-keys should be read as normal string values, only a few are
interpreted as marked-up text.
2016-08-29 14:10:56 +02:00
Albert Krewinkel
bed5f700ce
Org reader: extract meta parsing code to module
Parsing of meta-data is well separable from other block parsing tasks.
Moving into new module to get small files and clearly arranged code.
2016-08-29 14:10:51 +02:00
Vaclav Zeman
df33d13587 LaTeX: Do not set [htbp] figure placement options.
Do not set `[htbp]` placement options on each figure to allow overriding
them by them using `\fps@figure` redefintion either in header or in
template.
2016-08-29 10:03:09 +02:00
Jesse Rosenthal
95734b2951 Docx reader: update copyright. 2016-08-28 22:53:19 -04:00
Jesse Rosenthal
9f6fd6139f Docx reader: use all anchor spans for header ids.
Previously we only used the first anchor span to affect header ids. This
allows us to use all the anchor spans in a header, whether they're
nested or not.

Along with 62882f97, this closes #3088.
2016-08-28 18:12:02 -04:00
Jesse Rosenthal
2893b0055a Docx reader: Let headers use exisiting id.
Previously we always generated an id for headers (since they wouldn't
bring one from Docx). Now we let it use an existing one if
possible. This should allow us to recurs through anchor spans.
2016-08-28 18:09:27 -04:00
Jesse Rosenthal
62882f976d Docx reader: Handle anchor spans with content in headers.
Previously, we would only be able to figure out internal links to a
header in a docx if the anchor span was empty. We change that to read
the inlines out of the first anchor span in a header.

This still leaves another problem: what to do if there are multiple
anchor spans in a header. That will be addressed in a future commit.
2016-08-28 18:03:09 -04:00
Vaclav Zeman
1053677f49 Translate NARROW NO-BREAK SPACE into LaTeX.
Translate NARROW NO-BREAK SPACE into LaTeX' `\,`.
2016-08-27 22:17:39 +02:00
John MacFarlane
d29a623896 Man writer: allow section numbers that are not a single digit.
Closes #3089.
2016-08-27 22:00:42 +02:00
Albert Krewinkel
500de5e979
Org writer: translate language identifiers
Pandoc and Org-mode use different programming language identifiers.  An
additional translation between those identifiers is added to avoid
unexpected behavior.  This fixes a problem where language specific
source code would sometimes be output as example code.
2016-08-20 23:42:36 +02:00
Albert Krewinkel
dbf4d77091
Org writer: ensure link targets are paths or URLs
Org-mode treats links as document internal searches unless the link
target looks like a URL or file path, either relative or absolute.  This
change ensures that this is always the case.
2016-08-18 14:32:59 +02:00
Albert Krewinkel
d669425640
Org writer: ensure blank line after figure
An Org-mode figure should be surrounded by blank lines.  The figure
would be recognized regardless, but images in the following line would
unintentionally be treated as figures as well.
2016-08-18 14:32:59 +02:00
Albert Krewinkel
91afa513ad
Org writer: remove blank line after figure caption
Org-mode only treats an image as a figure if it is directly preceded by
a caption.
2016-08-18 14:32:59 +02:00
Jesse Rosenthal
b784ce8866 Docx Writer: change dynamic style key
Use "custom-style" instead of "docx-style." This allows it to be used in
other formats like ODT in the future.
2016-08-15 13:58:56 -04:00
Jesse Rosenthal
2870c9be00 Docx writer: Inject text properties as well. 2016-08-15 13:56:45 -04:00
Jesse Rosenthal
66d393ae7a Docx Writer: Keep track of dynamic text props too. 2016-08-15 12:41:31 -04:00
Jesse Rosenthal
d6b60558e3 Docx writer: Allow dynamic styles on spans.
This enables dynamic styling on spans. It uses the same prefix as we
used on divs ("docx-style" for the moment). It does not yet inject the
style into styles.xml.
2016-08-15 12:35:11 -04:00
Jesse Rosenthal
59bc1e68aa Docx writer: Inject new paragraph properties
This injects new dynamic paragraph properties to be into the style
file. Nothing occurs if the prop already exists in the style file.
2016-08-15 12:19:24 -04:00
Jesse Rosenthal
9999db2e6c StyleMap: export functions on StyleMap instances
We're going to want `getMap` in the Docx Writer.
2016-08-15 12:04:20 -04:00
Jesse Rosenthal
6c6860d076 Docx Writer: Have state keep track of dynamic styles.
We want to be able to inject these into our styles.xml.
2016-08-15 10:27:01 -04:00
Jesse Rosenthal
a362a62abe Docx Writer: Implement user-defined styles.
Divs with a "docx-style" key in the attributes will apply the
corresponding key to the contained blocks.
2016-08-13 21:52:50 -04:00
Jesse Rosenthal
347d716826 Docx parser: Use xml convenience functions
The functions `isElem` and `elemName` (defined in Docx/Util.hs) make the
code a lot cleaner than the original XML.Light functions, but they had
been used inconsistently. This puts them in wherever applicable.
2016-08-13 13:46:21 -04:00
John MacFarlane
1955ee9c72 Merge pull request #3048 from tarleb/latex-mini-fix
LaTeX reader: drop duplicate `*` in bibtexKeyChars
2016-08-11 21:15:27 +02:00
John MacFarlane
13424a2bd7 Merge pull request #3065 from tarleb/org-verse-indent
Org reader: preserve indentation of verse lines
2016-08-09 21:33:24 +02:00
Albert Krewinkel
ba5b426ded Org reader: ensure image sources are proper links
Image sources as those in plain images, image links, or figures, must be
proper URIs or relative file paths to be recognized as images.  This
restriction is now enforced for all image sources.

This also fixes the reader's usage of uncleaned image sources, leading
to `file:` prefixes not being deleted from figure
images (e.g. `[[file:image.jpg]]` leading to a broken image `<img
src="file:image.jpg"/>)

Thanks to @bsag for noticing this bug.
2016-08-09 20:27:08 +02:00
Albert Krewinkel
13280a8112 Org reader: preserve indentation of verse lines
Leading spaces in verse lines are converted to non-breaking spaces, so
indentation is preserved.

This fixes #3064.
2016-08-08 09:40:50 +02:00
John MacFarlane
0fbb676c81 MediaWiki reader: properly interpret XML tags in pre environments.
They are meant to be interpreted as literal text in textile.
Closes #3042.
2016-08-06 23:57:42 +02:00
John MacFarlane
124679fd63 Improved mediawiki reader's treatment of verbatim constructions.
Previously these yielded strings of alternating Code and Space
elements; we now incorporate the spaces into the Code.  Emphasis
etc. is still possible inside these.

Closes #3055.
2016-08-06 23:41:03 +02:00
John MacFarlane
3a49439202 Fix for unquoted attribute values in mediawiki tables.
Previously an unquoted attribute value in a table row
could cause parsing problems.

Fixes #3053 (well, proper rowspans and colspans aren't
created, but that's a bigger limitation with the current
Pandoc document model for tables).
2016-08-06 23:22:03 +02:00
Matthew Pickering
be4783109c Fix out of index error in handleError
In the latex parser when includes are processed, the text of the
included file is directly included into the parse stream. This caused
problems when there was an error in the included file (and the included
file was longer than the original file) as the error would be reported
at this position.

The error handling tries to display the line and position where the
error occured. It works by including a copy of the input and finding the
place in the input when given the position of the error. In the
previously described scenario, the input file would be the original
source file but the error position would be the position of the error in
the included file.

The fix is to not try to show the exact line when it would cause an
out-of-bounds error.
2016-08-06 22:06:37 +01:00
John MacFarlane
a480293b3c LaTeX writer: don't use * for unnumbered paragraph, subparagraph.
The starred variants don't exist.

This helps with part of #3058...it gets rid of the spurious *s.
But we still have numbers on the 4th and 5th level headers.
2016-08-06 22:37:11 +02:00
Albert Krewinkel
f9afc0d378 LaTeX reader: drop duplicate * in bibtexKeyChars 2016-07-29 20:53:43 +02:00
John MacFarlane
199489c12c Merge pull request #3033 from tarleb/github-readme
PoC: GitHub-optimized README
2016-07-22 15:52:38 -07:00
John MacFarlane
27762affe3 Textile reader: disallow empty URL in explicit link.
Closes #3036.
2016-07-22 15:45:03 -07:00
John MacFarlane
5f758970a5 Textile reader: support bc.. extended code blocks.
Also, remove trailing newline in code blocks (consistently
with Markdown reader).
2016-07-22 15:32:50 -07:00
Albert Krewinkel
a396003a31 Rename README to MANUAL.txt 2016-07-20 21:16:45 +02:00
John MacFarlane
34533dd8d1 LaTeX reader: be more forgiving of non-standard characters.
E.g. `^` outside of math.  Some custom environments give
these a meaning, so we should try not to fall over when we
encounter them.
2016-07-20 11:36:50 -07:00
John MacFarlane
1b6c9733ee LaTeX reader: more robust parsing of unknown environments.
We no longer fail on things like `^` inside options for tikz.
Closes #3026.
2016-07-20 11:18:24 -07:00
John MacFarlane
3263ed3c42 RST reader: use Div for admonitions.
Previously blockquotes were used.  Now a Div is used
with class `admonition` and (if relevant) one of the
following:  `attention`, `caution`, `danger`, `error`,
`hint`, `important`, `note`, `tip`, `warning`.

`sidebar` is also put into a Div.

Note: This will change rendering of RST documents!
It should provide much more flexibility.

Closes #3031.
2016-07-20 10:14:24 -07:00
John MacFarlane
e2d59461bb Textile reader: improve definition list parsing.
- Allow multiple terms (which we concatenate with linebreaks).
- Fix exponential parsing bug (closes #3020 for real this time).
2016-07-19 09:03:15 -07:00
John MacFarlane
3490932d21 Textile reader: improved table parsing.
We now handle cell and row attributes, mostly by skipping
them.  However, alignments are now handled properly.
Since in pandoc alignment is per-column, not per-cell, we
try to devine column alignments from cell alignments.

Table captions are also now parsed, and textile indicators
for thead and tfoot no longer cause parse failure.  (However,
a row designated as tfoot will just be a regular row in pandoc.)
2016-07-18 22:40:45 -07:00
John MacFarlane
d7396e73b4 Don't require haddock-library 1.4.
Instead use CPP to work around version differences.
2016-07-15 12:04:00 -07:00
John MacFarlane
17defd5004 Use liftM since otherwise Functor type constraint needen in ghc 7.8. 2016-07-15 12:02:37 -07:00
John MacFarlane
2f54de7cc4 Fixed compiler warnings. 2016-07-14 23:38:44 -07:00
John MacFarlane
c203ace130 Haddock reader - support math.
The Haddock document model added elements for math
in 1.4.
2016-07-14 23:38:20 -07:00
Jesse Rosenthal
f529fc17ef Docx Writer: Use actual creation time as doc prop
Previously, we had used the user-supplied date, if available, for Word's
document creation metadata. This could lead to weird results, as in
cases where the user post-dates a document (so the modification might be
prior to the creation). Here we use the actual computer time to set the
document creation.
2016-07-14 17:02:30 -04:00
Jesse Rosenthal
e8e02f1220 Shared: improve year sanity check in normalizeDate
Previously we parsed a list of dates, took the first one, and then
tested its year range. That meant that if the first one failed, we
returned nothing, regardless of what the others did. Now we test for
sanity before running `msum` over the list of Maybe values. Anything
failing the test will be Nothing, so will not be a candidate.
2016-07-14 17:02:30 -04:00
Jesse Rosenthal
bbfcd50fb1 Shared: normalizeDate should reject illegal years.
We only allow years between 1601 and 9999, inclusive. The ISO 8601
actually says that years are supposed to start with 1583, but MS Word
only allows 1601-9999. This should stop corrupted word files if the date
is out of that range, or is parsed incorrectly.
2016-07-14 17:02:30 -04:00
Jesse Rosenthal
4816facee4 Shared: Add further formats for normalizeDate
We want to avoid illegal dates -- in particular years with greater than
four digits. We attempt to parse series of digits first as `%Y%m%d`, then
`%Y%m`, and finally `%Y`.
2016-07-14 17:02:30 -04:00
John MacFarlane
0b0a0e730f Removed some redundant class constraints. 2016-07-14 08:54:06 -07:00
John MacFarlane
06a3e6a03f Merge pull request #3019 from tarleb/org-verbatim-fix
Org reader: fix parsing of verbatim inlines
2016-07-14 08:43:39 -07:00