Commit graph

59 commits

Author SHA1 Message Date
John MacFarlane
536b6bf538 Implemented SoftBreak and new --wrap option.
Added threefold wrapping option.

* Command line option: deprecated `--no-wrap`, added
  `--wrap=[auto|none|preserve]`
* Added WrapOption, exported from Text.Pandoc.Options
* Changed type of writerWrapText in WriterOptions from
  Bool to WrapOption.
* Modified Text.Pandoc.Shared functions for SoftBreak.
* Supported SoftBreak in writers.
* Updated tests.
* Updated README.

Closes #1701.
2015-12-11 23:55:08 -08:00
mb21
08243d53a6 Updated tests for link attribute changes. 2015-08-07 12:39:43 +02:00
John MacFarlane
24ee1ab4f7 Markdown reader: Made implicit header references case-insensitive.
Added `stateHeaderKeys` to `ParserState`; this is a `KeyTable`
like `stateKeys`, but it only gets consulted if we don't find
a match in `stateKeys`, and if `Ext_implicit_header_references`
is enabled.

Closes #1606.
2015-05-13 23:12:58 -07:00
John MacFarlane
c9cb313a47 Fixed regression in charsInBalancedBrackets.
Introduced by e9d7504.

This regression caused link and image references containing
raw tex not to parse correctly.

Added test.

Closes #2150.
2015-05-13 10:16:06 -07:00
John MacFarlane
9a5e081073 Markdown writer: Avoid introducing spurious list items through wrapping.
Closes #1946.
2015-02-25 10:16:05 -08:00
John MacFarlane
a5cac0a0c4 Don't treat a citation as a reference link label.
Closes #1763.
2014-12-15 10:54:12 -08:00
John MacFarlane
e16683b539 HTML writer: Make header attributes work outside top level.
Previously they only appeared on top level header elements.
Now they work e.g. in blockquotes.

Closes #1711.
2014-10-23 10:27:14 -07:00
John MacFarlane
d7169c715d Parsing: fixed inlineMath so it handles \text{..} containing $.
For example: `$x = \text{the $n$th root of $y$}`.  Closes #1677.
2014-10-19 16:42:56 -07:00
John MacFarlane
8bf39cf6d6 Markdown reader: Better handle quote characters in inline links.
This was previously failing to be recognized as a link:

    [Test](http://en.wikipedia.org/wiki/Ward's_method)

Closes #1534.
2014-08-14 10:59:27 -07:00
John MacFarlane
f97ec6db2c Markdown reader: Improved parsing of indented code in list items.
Indented code at the beginning of a list item must be indented eight
spaces from the margin (or from the edge of the container), or four
spaces past the list marker, whichever is farther.

Some examples in `tests/markdown-reader-more.txt`.
2014-08-12 11:10:48 -07:00
John MacFarlane
2e80613451 Markdown reader: inline math must have nonspace before final $.
Closes #1313.
2014-05-27 11:59:28 -07:00
John MacFarlane
4c43824203 Fixed empty reference links. Closes #1186.
Includes test.
2014-05-02 22:58:47 -07:00
John MacFarlane
3cad665afb Updated tests for latest texmath. 2014-01-07 23:35:30 -08:00
John MacFarlane
3e8bd8aa15 Updated for removed unMeta, unFormat in pandoc-types. 2013-08-14 23:24:45 -07:00
John MacFarlane
210d7b7bce Updated tests for new Format. 2013-08-10 17:53:11 -07:00
John MacFarlane
6c5ba22c96 Added a test for #833. 2013-06-19 09:00:37 -07:00
John MacFarlane
db3d4113a2 Markdown reader: don't lose parentheses in URLs.
Added tests.  This fixes a regression from 1.10.x.  Closes #786.
2013-03-13 19:20:25 -07:00
John MacFarlane
07e8cedf2b Make implicit_header_references work with explicit header ids.
(Markdown reader.)
2013-02-21 19:53:35 -08:00
John MacFarlane
cc410a71b5 Allow & in emails (for entities).
Added tests for entities in titles and links.
Closes #723.
2013-02-15 23:02:17 -08:00
John MacFarlane
72d11ad20b Markdown/RST reader: Skip blank lines.
This fixes a subtle regression involving grid tables with
empty cells.  Closes #732.

Also added test for grid table with empty cells.
2013-01-27 22:13:05 -08:00
John MacFarlane
af84953781 Markdown reader: Fixed bug with headerless grid tables.
The 1.10 code assumed that each table header cell contains
exactly one block. That failed for headerless tables (0) and also
for tables with multiple blocks in a header cell.

The code is fixed and tests provided. Thanks to Andrew Lee for
pointing out the bug.
2013-01-21 09:52:24 -08:00
John MacFarlane
e0e36ce543 Revised URI parser.
* It no longer uses Network.URIs URI parser, which is too restrictive
  (not allowing unicode URIs unless encoded).
* It allows many more schemes.
* It better handles punctuation so as to avoid capturing trailing
  punctuation in bare URLs.
2013-01-15 10:52:02 -08:00
John MacFarlane
51e0bd277a Parsing: Fixed uri -- escape unicode URLs.
Otherwise Network.URI.parseURI fails on e.g. Chinese
URLs.  Changed an incorrect test in markdown-reader-more.
2013-01-14 17:38:34 -08:00
John MacFarlane
9ee9096d07 Added tests for markdown line blocks and explicit header attributes. 2013-01-13 18:03:15 -08:00
John MacFarlane
d599c4cdab Added Attr field to Header.
Previously header ids were autogenerated by the writers.
Now they are generated (unless supplied explicitly) in the
markdown parser, if the `header_identifiers` extension is
selected.

In addition, the textile reader now supports id attributes on
headers.
2013-01-09 09:30:05 -08:00
John MacFarlane
8c48bd8feb Don't put the text of an autolink in Code font. 2013-01-06 20:51:51 -08:00
John MacFarlane
5a4f7ec595 Added tests for implicit header references. 2013-01-03 20:43:44 -08:00
John MacFarlane
fadc7b0d87 Major rewrite of markdown reader.
* Use Builder's Inlines/Blocks instead of lists.

* Return values in the reader monad, which are then
  run (at the end of parsing) against the final
  parser state.  This allows links, notes, and
  example numbers to be resolved without a second
  parser pass.

* An effect of using Builder is that everything is
  normalized automatically.

* New exports from Text.Pandoc.Parsing:
  widthsFromIndices, NoteTable', KeyTable', Key', toKey',
  withQuoteContext, singleQuoteStart, singleQuoteEnd, doubleQuoteStart,
  doubleQuoteEnd, ellipses, apostrophe, dash

* Updated opendocument tests.

* Don't derive Show for ParserState.

* Benchmarks:  markdown reader takes 82% of the time it took before.
  Markdown writer takes 92% of the time (here the speedup is probably
  due to the fact that everything is normalized by default).
2012-08-01 21:45:40 -07:00
John MacFarlane
75485c2f11 Complete rewrite of LaTeX reader.
* The new reader is more robust, accurate, and extensible.
  It is still quite incomplete, but it should be easier
  now to add features.

* Text.Pandoc.Parsing: Added withRaw combinator.

* Markdown reader: do escapedChar before raw latex inline.
  Otherwise we capture commands like \{.

* Fixed latex citation tests for new citeproc.

* Handle \include{} commands in latex.
  This is done in pandoc.hs, not the (pure) latex reader.
  But the reader exports the needed function, handleIncludes.

* Moved err and warn from pandoc.hs to Shared.

* Fixed tests - raw tex should sometimes have trailing space.

* Updated lhs-test for highlighting-kate changes.
2012-02-04 09:56:43 -08:00
John MacFarlane
5b7c209373 Markdown reader: Fix parsing of consecutive lists.
Pandoc previously behaved like Markdown.pl for consecutive
lists of different styles. Thus, the following would be parsed
as a single ordered list, rather than an ordered list followed
by an unordered list:

    1. one
    2. two

    - one
    - two

This patch makes pandoc behave more sensibly, parsing this as
two lists.  Any change in list type (ordered/unordered) or in
list number style will trigger a new list. Thus, the following
will also be parsed as two lists:

    1. one
    2. two

    a. one
    b. two

Since we regard this as a bug in Markdown.pl, and not something
anyone would ever rely on, we do not preserve the old behavior
even when `--strict` is selected.
2012-01-02 17:04:59 -08:00
John MacFarlane
bdec07bac9 Shared: Removed unescapeURI, modified escapeURI.
escapeURI now only escapes space characters, leaving unicode characters
as they are, instead of converting them to octets and URL-encoding them,
as before.  This gives more readable URIs.  User agents now do the
percent-encoding themselves.

URIs are no longer unescaped at all on conversion to markdown, asciidoc,
rst, org.

Closes #349.
2011-12-02 19:39:30 -08:00
John MacFarlane
f8dca6ccbc Add support for attributes in inline Code.
Additional related changes:

* URLs in Code in autolinks now use class "url".
* Require highlighting-kate 0.2.8.2, which omits the final <br/> tag,
  essential for inline code.
2011-01-26 20:44:25 -08:00
John MacFarlane
932fc12840 Updated tests. 2011-01-26 17:23:56 -08:00
John MacFarlane
eb26fa6f54 Distinguish latex & context environments; blank line after in writers. 2011-01-26 17:23:56 -08:00
John MacFarlane
bd43c0f4c9 Bumped version to 1.8; depend on pandoc-types 1.8.
The old TeX, HtmlInline and RawHtml elements have been removed
and replaced by generic RawInline and RawBlock elements.

All modules updated to use the new raw elements.
2011-01-26 17:22:53 -08:00
John MacFarlane
52b6e38425 Updated tests for new native format. 2011-01-20 22:36:40 -08:00
John MacFarlane
93c3e27731 pandoc: Add newline to output unless standalone.
This avoids output that does not end with a newline, which
is inconvenient when working with many tools.

Updated tests accordingly.
2011-01-06 21:05:28 -08:00
John MacFarlane
17d48cf4af Markdown reader: Allow linebreaks in URLs (treat as spaces).
Also, a string of consecutive spaces or tabs is now parsed
as a single space. If you have multiple spaces in your URL,
use %20%20.
2010-12-10 12:14:51 -08:00
John MacFarlane
7864f30717 Markdown reader: handle curly quotes better.
Previously, curly quotes were just parsed literally, leading
to problems in some output formats.  Now they are parsed as
Quoted inlines, if --smart is specified.

Resolves Issue #270.
2010-12-06 20:36:58 -08:00
John MacFarlane
5a4609584c Fix regression: markdown references should be case-insensitive.
This broke when we added the Key type.  We had assumed that
the custom case-insensitive Ord instance would ensure case-insensitive
matching, but that is not how Data.Map works.

* Added a test case for case-insensitivity in markdown-reader-more
* Removed old refsMatch from Text.Pandoc.Parsing module;
* hid the 'Key' constructor;
* dropped the custom Ord and Eq instances, deriving instead;
* added fromKey and toKey to convert between Keys and Inline lists;
* toKey ensures that keys are case-insensitive, since this is the
  only way the API provides to construct a Key.

Resolves Issue #272.
2010-12-05 19:27:00 -08:00
John MacFarlane
21556e37f4 Allow HTML comments as inline elements in markdown.
So,
aaa <!-- comment --> bbb
can be a single paragraph.
2010-11-09 22:51:02 -08:00
John MacFarlane
905d194db5 Added test for macros. 2010-10-26 20:03:02 -07:00
John MacFarlane
feb70b6e93 Made spacing at end of output more consistent.
Previously some of the writers added spurious whitespace.
This has been removed, resolving Issue #232.

NOTE: If your application combines pandoc's output with other
text, for example in a template, you may need to add spacing.
For example, a pandoc-generated markdown file will not have
a blank line after the final block element.  If you are inserting
it into another markdown file, you will need to make sure there
is a blank line between it and the next block element.
2010-07-20 12:42:12 -07:00
John MacFarlane
be58768522 Added tests for example lists. 2010-07-12 23:07:00 -07:00
John MacFarlane
c3384bb3f1 Added multilingual URL tests for markdown reader. 2010-03-23 15:07:17 -07:00
fiddlosopher
76e6c071d0 Disallow blank lines in inline code span.
Also added additional test cases for markdown code spans.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1860 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-03-06 02:42:15 +00:00
fiddlosopher
77ba3429e2 Allow multi-line titles and authors in meta block.
Based on a patch by Justin Bogner.

Titles may span multiple lines, provided continuation lines
begin with a space character.

Separate authors may be put on multiple lines, provided
each line after the first begins with a space character.
Each author must fit on one line. Multiple authors on
a single line may still be separated by a semicolon.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1854 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-02-28 11:21:19 +00:00
fiddlosopher
36675bd206 Added accessors (docTitle, docAuthors, docDate) to Meta type.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1853 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-02-28 08:13:48 +00:00
fiddlosopher
07ae5bc264 Markdown reader: properly escape URIs.
+ Resolves Issue #220.
+ Added escapeURI function to Markdown reader. This escapes
  links in a way that makes sense for markdown.  If they've
  used URI escapes like %20 in their link, these will be preserved.
  But if they've used a special character or space without escaping
  it, it will be escaped. This should make sense in most cases.
+ Previously pandoc collapsed adjacent spaces and replaced these
  sequences of spaces with + characters.  That isn't correct for
  a URI path (+ is to be used only in the query part).  We've also
  removed the space-collapsing behavior.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1847 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-02-27 03:06:39 +00:00
fiddlosopher
3ec8772daf Changed Meta author and date types to Inline lists instead of Strings.
Meta [Inline] [[Inline]] [Inline] rather than
Meta [Inline] [String] String.

This is a breaking change for libraries that use pandoc and
manipulate the metadata.

Changed .native files in test suite for new Meta format.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1699 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31 01:12:44 +00:00