Commit graph

3605 commits

Author SHA1 Message Date
John MacFarlane
3abc1021aa HTML writer: Use toHtml instead of pre-escaping.
We work around the problem that blaze-html unnecessarily escapes `'`
by pre-escaping just the `'` characters, instead of the whole string.

If blaze-html later stops escaping `'` characters, we can simplify
strToHtml to toHtml.

Note that this change yields a significant speed boost (111ms to 94ms
on one benchmark).

Closes #629.
2012-09-28 11:11:31 -04:00
John MacFarlane
4be137509e RST reader: Made para parser slightly more efficient. 2012-09-28 00:59:05 -04:00
John MacFarlane
ab17faf497 RST reader: Use Text.Pandoc.Builder.
This will give us more flexibility in the future.
It also gives built-in normalization.  Performance slightly
better.
2012-09-27 17:52:48 -07:00
John MacFarlane
5c06322ab2 Shared: Export compactify', formerly in Markdown reader. 2012-09-27 17:52:38 -07:00
John MacFarlane
7633d51971 Parsing: Changed type of stateSubstitutions to use Inlines. 2012-09-27 16:44:49 -07:00
John MacFarlane
35662e14a9 Removed nullBlock.
Don't use nullBlock in Textile reader.  Better to know about parsing
problems than to skip stuff when we get stuck.
2012-09-27 16:06:29 -07:00
John MacFarlane
731415a4e5 RST reader: Support :target: on image substitutions. 2012-09-27 15:40:09 -07:00
John MacFarlane
1be27ffb3a Added stateSubstitutions to ParserState, use for RST substitutions. 2012-09-27 15:20:29 -07:00
John MacFarlane
606b5e8ed4 Removed Ext_monospace_autolinks. 2012-09-27 15:01:00 -07:00
John MacFarlane
bae39e77a8 Added Ext_autolink_urls. 2012-09-27 13:43:48 -07:00
John MacFarlane
15a8192b84 Renamed Ext_autolink_code_spans to Ext_monospace_autolinks. 2012-09-27 13:33:14 -07:00
John MacFarlane
f76478bcb9 RST reader: Support :target: on .. image:: blocks.
Still not supported on substitution definitions.
2012-09-26 22:22:14 -07:00
John MacFarlane
90a42fae05 Makefile: Don't remove citeproc-hs and pandoc-types with clean.
Added new 'veryclean' target that removes these too.
2012-09-26 17:08:31 -07:00
John MacFarlane
685e281251 Biblio: Remove workaround for toCapital.
Now citeproc-hs is fixed upstream, so this is no longer needed.
Closes #531.
2012-09-26 16:27:20 -07:00
John MacFarlane
c13f23e0b1 Makefile: Use Andrea's repository for citeproc-hs. 2012-09-26 16:26:54 -07:00
John MacFarlane
ff84881e8c Shared: Count \r as space in removeLeading/TrailingSpace. 2012-09-26 09:06:34 -07:00
John MacFarlane
c80ffe9171 UTF8: Better error message for invalid UTF8.
Read bytestring and use Text's decodeUtf8 instead of using System.IO's
hGetContents.  This way you get a message saying "invalid UTF-8 stream"
instead of "invalid byte sequence."  You are also told which byte caused
the problem.
2012-09-26 09:04:21 -07:00
John MacFarlane
885ef2072f Make --id-prefix affect footnote IDs in markdown writer.
Closes #614.
2012-09-25 20:26:38 -07:00
John MacFarlane
6ad7ac1239 Removed need for utf8-string package.
* Depend on text.
* Expose Text.Pandoc.UTF8.
* Text.Pandoc.UTF8 now exports toString, fromString,
  toStringLazy, fromStringLazy.
* These are used instead of the old utf8-string functions.
2012-09-25 19:54:21 -07:00
John MacFarlane
833977416f UTF8: use universalNewlineMode in reading.
This treats both '\r\n' and '\n' as '\n' on input, no matter
what platform we're running on.
2012-09-25 14:55:12 -07:00
John MacFarlane
4ab30f3cea Texinfo writer: Fixed internal cross-references.
Now we insert anchors after each header, and use @ref
instead of @uref for links.

Commas are now escaped as @comma{} only when needed; previously
all commas were escaped.  (This change is needed, in part, because @ref
commands must be followed by a real comma or period.)

Also insert a blank line in from of @verbatim environments.
2012-09-24 19:13:34 -07:00
John MacFarlane
12045d84b6 Revert "More intelligent handling of text encodings."
This reverts commit 7272735b3d.
2012-09-23 22:53:34 -07:00
John MacFarlane
7272735b3d More intelligent handling of text encodings.
Previously, UTF-8 was enforced for both input and output.

The new system:

* For input, UTF-8 is tried first; if an error is raised, the
  locale encoding is tried.
* For output, the locale encoding is always used.
2012-09-23 22:12:21 -07:00
John MacFarlane
31107741f0 Removed unneeded CPP conditional.
Removed code that was conditional on base < 4.2, since
now we require base >= 4.2.
2012-09-23 21:43:11 -07:00
John MacFarlane
3e302bf651 Added base dependencies for test suite. 2012-09-23 13:45:23 -07:00
John MacFarlane
3ecbf49a0e Added 'UTF8.' to decodeArg. 2012-09-23 12:57:49 -07:00
John MacFarlane
07793b6b7f Require base >= 4.2 (i.e. GHC 6.12). 2012-09-23 12:57:05 -07:00
John MacFarlane
f67333696b Revert "Use local encoding for input/output rather than forcing UTF8."
This reverts commit c69837adb6.
2012-09-23 12:33:17 -07:00
John MacFarlane
c69837adb6 Use local encoding for input/output rather than forcing UTF8.
Note that system templates are stored as UTF8
and will still be read as such, even if the local encoding
is different.  Text downloaded from URLs will also be treated
as UTF-8.
2012-09-23 11:01:33 -07:00
John MacFarlane
4d65063592 UTF8: Export decodeArg. 2012-09-23 11:01:09 -07:00
John MacFarlane
51178dda97 Export encodePath/decodePath from UTF8.
Removed duplicate code in src/pandoc.hs.
2012-09-23 10:43:03 -07:00
John MacFarlane
22bd34fa33 Markdown reader: Fixed link parser to avoid exponential slowdowns.
Previously the parser would hang on input like this:

    [[[[[[[[[[[[[[[[[[hi

We fixed this by making the link parser parser characters
between balanced brackets (skipping brackets in inline code spans),
then parsing the result as an inline list.

One change is that

    [hi *there]* bud](/url)

is now no longer parsed as a link.  But in this respect pandoc behaved
differently from most other implementations anyway, so that seems okay.
All current tests pass.  Added test for this case.

Closes #620.
2012-09-22 14:05:09 -07:00
John MacFarlane
1038606036 LaTeX reader: Added a 'try' in rawLaTeXBlock.
This allows the markdown reader to treat '\begin' (not followed
by an argument) as a raw string rather than erroring out when
it doesn't find a '{'.

Closes #622.
2012-09-22 13:00:59 -07:00
John MacFarlane
93c35cbf14 Tests.Old: Set TMP to ".".
Otherwise TMP is unset and, on Windows, C:\Windows is used by default,
leading to permission violations.
2012-09-21 20:34:27 -07:00
John MacFarlane
bec25775ba Merge pull request #619 from bgamari/master
Various version bumps
2012-09-21 17:36:12 -07:00
Ben Gamari
a96982e701 Setup: getModificationTime returns UTCTime as of GHC 7.6 2012-09-21 15:43:26 -04:00
Ben Gamari
bb4ea9d422 Bump network upper bound to <2.5
network 2.4 is now on hackage
2012-09-21 09:31:52 -04:00
Ben Gamari
77ccdf59f5 Bump directory upper bound to <1.3
directory-1.2 is in ghc 7.6
2012-09-21 09:30:42 -04:00
Ben Gamari
92c7029492 Bump containers upper bound to <0.6
Since containers 0.5 is in the wild as of ghc 7.6
2012-09-21 09:29:23 -04:00
John MacFarlane
1e7599cf6a README: Removed claim that 'enumerate' library is needed in LaTeX.
It isn't any longer.
2012-09-16 22:34:06 -07:00
John MacFarlane
dc28a653ae LaTeX/Beamer templates: Don't require 'float' package for tables.
We don't actually seem to use the '[H]' option.
2012-09-16 22:26:56 -07:00
John MacFarlane
e1be934dc2 LaTeX writer: Don't rely on the enumerate package.
Instead, use standard LaTeX commands to change numbering style.
2012-09-16 22:24:55 -07:00
John MacFarlane
1e2b20f8bc LaTeX writer: Properly escape strings inside \url{}.
Closes #576.
2012-09-16 11:20:53 -07:00
John MacFarlane
23e1a25014 RST writer: Fixed hyperlinked images.
* Use :target: field when you have a simple linked image.
* Don't wrap the reference.
* Cleaned up code.
* Closes #611.
2012-09-16 11:09:36 -07:00
John MacFarlane
ecc206f7c3 RST reader: Small tweaks to raw field lists.
* Don't allow line breaks in field names.
* Strip off initial newline from 'raw' when field body
  begins on next line.
2012-09-16 10:29:35 -07:00
John MacFarlane
9f89269941 Merge pull request #596 from dlax/rst-fieldlists
improvements to rst reader for field lists
2012-09-16 10:19:42 -07:00
John MacFarlane
fc31bf27f5 MediaWiki reader: Allow table in table cell. 2012-09-15 21:06:55 -07:00
John MacFarlane
1461693159 LaTeX writer: Don't escape _ in hyperref identifiers. 2012-09-15 20:50:43 -07:00
John MacFarlane
d9e34ce34d LaTeX writer: don't escape _ in url. 2012-09-15 20:43:36 -07:00
John MacFarlane
fc4ae15337 LaTeX writer: Don't use \endhead with longtable.
It causes the heading to be a different size form the body,
sometimes.
2012-09-15 20:40:48 -07:00