Commit graph

1730 commits

Author SHA1 Message Date
John MacFarlane
b98219773b Replaced writerStrict with writerExtensions in WriterOptions.
Still have not implemented individual tests for all the extensions
in the markdown writer.
2012-07-27 09:18:51 -07:00
John MacFarlane
00dc1e715e Moved WriterOptions and associated types Shared -> Options. 2012-07-26 22:59:56 -07:00
John MacFarlane
6d7f0a1b81 Fixed whitespace errors. 2012-07-26 22:32:53 -07:00
John MacFarlane
e797ab9136 Textile reader: Replace failIfStrict with guardEnabled. 2012-07-26 22:21:00 -07:00
John MacFarlane
14c911ba06 Parsing: Removed failIfStrict. 2012-07-26 22:20:44 -07:00
John MacFarlane
33fdea67b5 Use readerExtensions instead of readerStrict in readers.
Test individually for the extensions.
2012-07-26 20:29:08 -07:00
John MacFarlane
5186da929d Parsing: Added guardEnabled, guardDisabled. 2012-07-26 19:10:56 -07:00
John MacFarlane
631e5c16fc pandoc: Set readerExtensions instead of readerStrict. 2012-07-26 18:56:19 -07:00
John MacFarlane
45e4c123a4 Moved tests to tests/, modified cabal file so lib isn't recompiled. 2012-07-26 08:37:36 -07:00
John MacFarlane
acde1e82d2 Changed reader parameters from ParserState to ReaderOptions. 2012-07-25 22:35:41 -07:00
John MacFarlane
9b5d2031c7 Restored stateStandalone as readerStandalone.
It is indeed needed by the RST reader.
2012-07-25 22:05:06 -07:00
John MacFarlane
2654da3823 Moved stateApplyMacros, stateIndentedCodeClasses to ReaderOptions. 2012-07-25 22:05:06 -07:00
John MacFarlane
070b968ae0 stateCitations -> readerCitations. 2012-07-25 22:05:06 -07:00
John MacFarlane
856aa8c244 Moved stateLiterateHaskell to readerLiterateHaskell in Options. 2012-07-25 22:05:06 -07:00
John MacFarlane
1dba82f25e Got rid of stateStandalone, which was hardly used anyway.
The only possible effect will be with rst fragments that
begin with an rst title block, which will now cause the
header transform.
2012-07-25 20:08:42 -07:00
John MacFarlane
95570ba34c Moved stateOldDashes to readerOldDashes in ReaderOptions. 2012-07-25 12:37:04 -07:00
John MacFarlane
335cd5de4d Moved stateTabStop to readerTabStop in ReaderOptions. 2012-07-25 12:31:16 -07:00
John MacFarlane
0d4424c21c Moved stateColumns to readerColumns in ReaderOptions. 2012-07-25 11:51:33 -07:00
John MacFarlane
ef0619cc6d Moved ParseRaw from ParserState to ReaderOptions. 2012-07-25 11:43:56 -07:00
John MacFarlane
8b380a464e Text.Pandoc.Parsing: Added getOption. 2012-07-25 11:27:25 -07:00
John MacFarlane
dfa19061ab Options -> ReaderOptions.
Better to keep reader and writer options separate.
2012-07-25 11:08:06 -07:00
John MacFarlane
da3702357d Put smart, strict in separate options field in state.
This is the beginning of a larger transition that will make
Options, not ParserState, the parameter of the read functions.
(Options will also be used in writers, in place of WriterOptions.)

Next step is to remove strict, replacing it with granular
tests for different extensions.
2012-07-25 10:45:45 -07:00
John MacFarlane
0d21b8d6ae Added Text.Pandoc.Options. 2012-07-25 10:18:57 -07:00
John MacFarlane
fbd3d2b450 Better algorithm for oneOfStrings.
This goes character by character, not backtracking.
2012-07-24 22:45:22 -07:00
John MacFarlane
02ef26ae91 Slightly more efficient normalizeSpaces. 2012-07-24 22:12:18 -07:00
John MacFarlane
c00f5c4372 HTML reader: Fixed bug in htmlBalanced.
This caused hangs in parsing certain markdown input using --strict.
2012-07-24 21:43:24 -07:00
John MacFarlane
1fb1cfb670 Don't require strict HTML blocks to begin at left margin.
Technically this is required, according to the mardkown syntax
document, but Markdown.pl and other markdown processors are more
liberal.
2012-07-24 21:41:57 -07:00
John MacFarlane
308436996e Use catch from Control.Exception to avoid warnings. 2012-07-24 19:38:16 -07:00
John MacFarlane
e6c76525b2 Text.Pandoc: writers now an assoc list of String, Writer.
A Writer can be a PureStringWriter, an IOStringWriter, or
an IOByteStringWriter.  ALL writers are now in the 'writers'
list, including the binary writers and fb2 writer.  Code simplified
at end of pandoc.hs.
2012-07-24 19:05:38 -07:00
John MacFarlane
11884d6ebf Removed unneeded import. 2012-07-24 09:59:06 -07:00
John MacFarlane
999edd9608 Changed signatures of writeODT, writeDocx, writeEPUB.
These now take WriterOptions and Pandoc only.
The extra parameters for epub stylesheet, epub fonts,
reference Docx, and reference ODT have been removed, since
these things are now in WriterOptions.

Note:  breaking API change!
2012-07-24 09:56:00 -07:00
John MacFarlane
cd19d4596b Added fields to WriterOptions.
writerEpubStylesheet, writerEpubFonts, writerReferenceODT,
writerReferenceDocx.  These can now be removed as extra
parameters to the writers.
2012-07-24 09:49:57 -07:00
John MacFarlane
6da9d9bca5 Small fix to fix: Allow blank lines btw table and caption. 2012-07-24 09:24:56 -07:00
John MacFarlane
da1e99c03a Fixed performance improvement to tables. 2012-07-24 09:19:52 -07:00
John MacFarlane
2a4b987cc3 More performance improvements on pipe tables. 2012-07-24 09:08:54 -07:00
John MacFarlane
bab816cefe Refactored table parsers, captions now not part of core tableWith. 2012-07-24 09:06:13 -07:00
John MacFarlane
ce72d6aba8 Slight improvement to performance for pipe tables.
Still, pipe tables are a huge performance drag.  One benchmark:
With pipe tables, 1.25 sec (including this fix).
without pipe tables, 1.05 sec.
2012-07-24 07:13:49 -07:00
John MacFarlane
fb6e798917 Set writerTableOfContents for s5 in Text.Pandoc, not pandoc.hs. 2012-07-23 22:58:16 -07:00
John MacFarlane
1bd0c47968 Set writerSlideVariant in Text.Pandoc rather than pandoc.hs. 2012-07-23 22:53:35 -07:00
John MacFarlane
d2cc56a46a Revised code for pipe tables.
* All tables now require at least one body row.
* Renamed from 'extra' to 'pipe' tables.
* Moved functions from Parsing to Readers.Markdown.
* Cleaned up code; revised to parse in one pass rather than
  parsing a raw string, splitting it, and parsing the components.
* Allow pipe tables without pipes on the ends (as PHP Markdown Extra
  does).
2012-07-22 22:09:15 -07:00
John MacFarlane
5a704ecc6e Renamed tests/markdown-tables -> tests/extra-tables.
Added to cabal file.
2012-07-22 19:28:56 -07:00
John MacFarlane
511f5e891d Merge pull request #510 from mytskine/markdown-extra
Markdown extra tables [part of the multi-markdown syntax for tables]
2012-07-22 18:40:18 -07:00
John MacFarlane
1d19400572 Removed fb2.math-webtex.fb2 tests.
Test suite should not require net access to run.
2012-07-22 11:15:59 -07:00
Sergey Astanin
436a585c3b FB2: support images embedded as data URIs + tests. 2012-07-22 11:13:14 -07:00
Sergey Astanin
a9429e951c Test suite for FB2 writer. 2012-07-22 11:13:14 -07:00
Sergey Astanin
b39597a910 Added a new FictionBook2 (FB2) writer. 2012-07-22 11:13:14 -07:00
John MacFarlane
f79ed27bb5 Use Parsec directly in Biblio and Templates. 2012-07-20 16:33:37 -07:00
John MacFarlane
2c30c48757 Use Parser as type synonym for Parsec. 2012-07-20 15:54:57 -07:00
John MacFarlane
5085962c28 Text.Pandoc.Parsing: Export all Parsec functions used in pandoc code.
No other module directly imports Parsec.  This will make it easier
to change the parsing backend in the future, if we want to.
2012-07-20 14:41:44 -07:00
John MacFarlane
a4c28ead79 Use Text.Parsec instead of Text.ParserCombinators.Parsec. 2012-07-20 14:19:06 -07:00
John MacFarlane
5be6bf07d2 Make --ascii work properly with --self-contained.
Closes #568.
2012-07-19 12:45:26 -07:00
John MacFarlane
2351f7a112 Provide Data.Default instances for ParserState and WriterOptions.
Now you can use def (which is re-exported by Text.Pandoc) instead of
defaultParserState or defaultWriterOptions.  For now, these
are still defined too, so existing code need not change.

Closes #546.
2012-07-19 12:38:54 -07:00
John MacFarlane
26748da6d4 Don't recognize inline-markup starts inside words.
For example, "2*2 = 4*1" should not contain an emphasized
section.  Added test case for "Literal symbols".  Closes #569.
2012-07-16 10:58:44 -07:00
Arlo O'Keeffe
d25656571a Set ODT title property 2012-07-13 15:19:39 -06:00
John MacFarlane
f68b05e74b Textile reader: properly handle links with surrounding brackets.
Square brackets need to be used when the link isn't surrounded by
spaces or punctuation, or when the URL ending may be ambiguous.

Closes #564.
2012-07-13 14:01:56 -07:00
John MacFarlane
6442e185b3 HTML writer: Put mathjax in span with class "math".
Closes #562.
2012-07-11 16:54:13 -07:00
John MacFarlane
5c56165555 -V option: Add variables to beginning of list, not end.
This means that duplicate variables specified later on the command
line take precedence.

It also allows the default `-slidy-url` to be overridden even when
`--self-contained` is used (provided the `-V` comes after
`--self-contained`.  Previously this could not be done.  Note
that when `--self-contained` is used, the `slidy-url` variable is
set to `slidy` so that local copies are used.
2012-07-03 21:59:46 -07:00
John MacFarlane
9e458d7974 Pretty: Added wide punctuation range to charWidth.
Fixes bug with Chinese commas in tables.
2012-06-30 11:51:52 -07:00
John MacFarlane
9d5230c0f6 Changed macro parser so it returns raw macro if stateApplyMacros false.
Closes #554.
2012-06-29 18:30:53 -07:00
John MacFarlane
6cdfde5807 SelfContained: Fix handling of absolute URLs in css imports.
Also allow single-quoted values.

Closes #535.
2012-06-28 18:35:21 -07:00
John MacFarlane
83238cb686 Added webm to mime types. Closes #543. 2012-06-28 09:48:07 -07:00
John MacFarlane
7da913dbd7 ConTeXt writer: don't escape &,^,<,>.
Simplified escapes for `}` and `{` to `\{` and `\}`.

Thanks to Aditya Mahajan.
2012-06-27 15:05:13 -07:00
John MacFarlane
d320c2eac5 MediaWiki writer: Avoid extra blank lines after sublists.
Thanks to Gavin Beatty.
2012-06-27 14:46:46 -07:00
John MacFarlane
e9f6366af7 Don't escape _ as \letterunderscore{} in ConTeXt. 2012-06-26 19:50:52 -07:00
John MacFarlane
dc158768b9 Docbook reader: Added support for "bold" emphasis.
Thanks to mb21.
2012-06-26 19:41:34 -07:00
John MacFarlane
527be1ddf2 Don't generate empty H1 after hrule slide breaks.
We now use a slide-level header with contents [Str "\0"] to mark
an hrule break.  This avoids creation of an empty H1 in these
contexts.

Closes #484.
2012-06-25 14:52:09 -07:00
John MacFarlane
4cf3aaecde Test for base 4.4.0 instead of 4.5.0 for argument/filename encoding. 2012-06-25 14:27:22 -07:00
John MacFarlane
cc39c313c5 Don't encode/decode file paths if base >= 4.5.
Prior to base 4.5 (and perhaps earlier - check), filepaths and command
line arguments were treated as unencoded lists of bytes, not unicode
strings, so we had to work around that by encoding and decoding
them.  This commit adds CPP checks for base 4.5 that disable the
encoding/decoding.

Fixes a bug with multilingual filenames when pandoc was compiled
with ghc 7.4. Closes #540.
2012-06-24 10:58:15 +02:00
John MacFarlane
c24b7991aa Fixed shadowing warning. 2012-06-08 11:12:56 -07:00
John MacFarlane
db645f7087 Biblio: Workaround broken toCapital in citeproc-0.3.4. 2012-06-08 10:28:51 -07:00
John MacFarlane
c06ed6e3b1 Biblio: Add comma to beginning of bare suffix, e.g. @item1 [50].
Motivation: @item1 [50] should be as close as possible to
[@item1, 50].
2012-06-05 11:54:27 -07:00
John MacFarlane
0dab912c22 Markdown reader: Added cf. and cp. to list of likely abbreviations. 2012-06-04 11:13:41 -07:00
John MacFarlane
34fac208d2 Fixed --incremental behavior for Beamer.
When `--incremental` is used, lists inside block quotes should
appear all at once (as in HTML).
2012-06-03 09:14:09 -07:00
John MacFarlane
5669dc2a47 Simplified bullet characters so they work with Word 2007.
Closes #520.
2012-06-01 18:44:00 -07:00
John MacFarlane
e14712dabd LaTeX writer: Ensure newline after Verbatim at end of footnote.
This fixes a regression. Also added a test for this.
2012-06-01 10:50:22 -07:00
John MacFarlane
4834865653 Escape % as \letterpercent{} not \letterpercent in ConTeXt. 2012-05-31 19:15:42 -07:00
John MacFarlane
81be8fbf77 Merge pull request #521 from jonassmedegaard/master
Slidy lang support, and new Slideous writer
2012-05-30 18:21:26 -07:00
paul.rivier
75cba828b5 Textile reader: fix for <notextile> and ==.
Closes #517.
2012-05-29 17:40:55 -07:00
John MacFarlane
9a47237412 RST reader: handle figures.
Closes #522.
2012-05-29 16:59:56 -07:00
John MacFarlane
91e9d904b5 Org writer: Add space before language name.
Closes #523.
2012-05-29 16:27:19 -07:00
John MacFarlane
60495e9fb3 Added a couple needed trys to textile reader. 2012-05-29 16:23:40 -07:00
John MacFarlane
3b4e4de52b ConTeXt writer: ensure space after \stopformula. 2012-05-29 12:43:11 -07:00
Jonas Smedegaard
61f8dd4da8 Add support for Slideous output. 2012-05-24 10:31:18 +02:00
John MacFarlane
9552543b96 Massively simplified Text.Pandoc.Biblio.
Fixed a bug with citations in notes and captions.

We now handle note citations by inserting notes at the
beginning, and removing notes within notes later.
2012-05-23 16:11:05 -07:00
John MacFarlane
2e4860bc6d LaTeX reader: Support \centerline. 2012-05-22 15:38:11 -07:00
John MacFarlane
79a17ef9b9 Markdown Use a nonzero space to prevent false recognition of list marker.
This addresses #516, but in a rather hackish way.  There ought to
be a better solution.
2012-05-19 17:44:15 -07:00
John MacFarlane
b2340cd874 Added 'zenburn' highlight style from highlighting-kate.
Depend on h-k 0.5.0.6.
2012-05-17 18:54:41 -07:00
John MacFarlane
4991852edb Markdown writer: Improved definition lists.
* Use `:` form instead of `~`, for better compatibility with other
  markdown implementations.

* Don't wrap the term, because it breaks definition lists.
2012-05-16 13:07:58 -07:00
John MacFarlane
4e35c67c23 LaTeX writer: More consistent interblock spacing. 2012-05-14 07:04:47 -07:00
John MacFarlane
428595469e LaTeX reader: ensure we don't have extra blank lines at ends of cells.
This can cause LaTeX errors, as they are interpreted as new paragraphs.
2012-05-13 14:59:02 -07:00
John MacFarlane
d0d101d840 Export readDocBook in Text.Pandoc. 2012-05-12 19:29:39 -07:00
John MacFarlane
a5f71e5fad DocBook: support segmentedlist. 2012-05-12 18:34:15 -07:00
John MacFarlane
6dfaf43f3e DocBook reader: Support simplelist, member. 2012-05-12 13:21:13 -07:00
John MacFarlane
0d3c7b5204 Don't include non-language classes for code blocks. 2012-05-12 12:33:51 -07:00
John MacFarlane
2c04d0b2bf DocBook reader: Recognize example as block element. 2012-05-12 12:33:49 -07:00
John MacFarlane
1c26f2c516 DocBook reader: Promote level 0 headers to 1 even if dbBook not set. 2012-05-12 12:24:26 -07:00
John MacFarlane
9d44dc3887 DocBook reader: Support bridgehead. 2012-05-12 12:17:36 -07:00
John MacFarlane
3d15d4c668 DocBook reader: only use language classes for inline code. 2012-05-12 11:35:20 -07:00
John MacFarlane
199c9de654 DocBook reader: Better handling tags that can have inline or block content. 2012-05-12 11:31:17 -07:00
John MacFarlane
89fa0e4a08 DocBook reader: computeroutput is an inline tag, not block. 2012-05-12 11:21:23 -07:00
John MacFarlane
5f889b9396 Added writerTeXLigatures to WriterOptions, --no-tex-ligatures option.
This is useful for those who want to use advanced OpenType features
with xelatex/lualatex.
2012-05-11 23:00:46 -07:00
John MacFarlane
206f261194 LaTeX reader: Allow skipping of unknown block commands in \author section.
Closes #505, which was a problem with `\vspace{10pt}` inside `\author`.
2012-05-11 20:50:00 -07:00
John MacFarlane
c844634757 DocBook reader: Support bibliomixed tag. 2012-05-11 20:35:19 -07:00
John MacFarlane
02fa1050b0 DocBook reader: Support link tag with no content. 2012-05-11 20:27:28 -07:00
John MacFarlane
e1e6505abe DocBook reader: print ? for xref tag. 2012-05-11 20:20:53 -07:00
John MacFarlane
d46d2000f4 DocBook reader: Support uri tag. 2012-05-11 20:16:39 -07:00
John MacFarlane
5dfcf004b4 DocBook reader: Use ALLCAPS for unknown entities. 2012-05-11 20:14:11 -07:00
John MacFarlane
de27dbc0f8 DocBook reader. Handle block elements inside paragraphs. 2012-05-11 20:08:26 -07:00
John MacFarlane
b4b5642ac7 DocBook reader: support more elements. 2012-05-10 23:58:13 -07:00
John MacFarlane
023bb2bb45 DocBook reader: Implemented glossary, simplified sect. 2012-05-10 21:27:16 -07:00
John MacFarlane
523acadd5b DocBook reader: Skip index. 2012-05-10 20:11:07 -07:00
John MacFarlane
84d213baff DocBook reader: Skip toc tags. 2012-05-10 19:56:08 -07:00
John MacFarlane
dab6a36585 DocBook reader: Supported bibliography, bibliodiv. 2012-05-10 19:50:51 -07:00
John MacFarlane
15ef1a1a48 DocBook reader: Support language attribute on inline code. 2012-05-10 10:24:07 -07:00
John MacFarlane
79e83749bf DocBook reader: Support language attribute in programlisting. 2012-05-10 10:10:24 -07:00
John MacFarlane
4d9a1324ae DocBook reader: areaspec, area, areaset 2012-05-10 10:10:20 -07:00
John MacFarlane
858bf197fe Revert "Removed blaze_html_05 flag -- require blaze >= 0.5 by default."
This reverts commit f67a80cea2.
2012-05-10 09:13:14 -07:00
John MacFarlane
d63bfb4bc5 DocBook reader: Support prompt, parameter. 2012-05-10 09:12:40 -07:00
John MacFarlane
bff02dd369 DocBook reader: Support 'optional' tag. 2012-05-10 09:10:25 -07:00
John MacFarlane
cb1096b75f DocBook reader: Support subtitle, simpara. 2012-05-10 09:01:38 -07:00
John MacFarlane
a408ce5fd7 DocBook reader: Add attribute for "option" code inline. 2012-05-09 11:01:10 -07:00
John MacFarlane
83d0e7e4bd DocBook reader: Support computeroutput, literallayout. 2012-05-09 10:46:34 -07:00
John MacFarlane
87de361cdc DocBook reader: More improvements, passes tests. 2012-05-09 10:34:37 -07:00
John MacFarlane
4f8c536de0 DocBook reader: More improvements, more tests pass. 2012-05-08 23:25:34 -07:00
John MacFarlane
8ba8a720ed DocBook reader: Improved def lists with multiple defs. 2012-05-08 22:18:24 -07:00
John MacFarlane
b1cba4ae8e DocBook reader: Fixed headers for headerless table. 2012-05-08 21:44:46 -07:00
John MacFarlane
ef5c7fb4b6 DocBook reader: Trim definition list terms. 2012-05-08 21:25:51 -07:00
John MacFarlane
6b783d38ea DocBook reader: Fixed some compiler warnings. 2012-05-08 21:02:17 -07:00
John MacFarlane
c20c139255 Added docbook reader tests (still failing). 2012-05-08 20:26:39 -07:00
John MacFarlane
b79df946d1 Treat four or more ~ or ^ in an inline context as regular text.
This avoids exponential parsing blowups with long strings
of these characters. Closes #507.
2012-05-08 13:31:27 -07:00
John MacFarlane
ffef28e860 DocBook reader: Skip chapterinfo. 2012-05-07 10:06:11 -07:00
John MacFarlane
8d6cc370d4 DocBook reader: Added epigraph, fixed entities in plain contexts. 2012-05-07 10:02:48 -07:00
John MacFarlane
233c71b6a9 DocBook reader: handle tables, entities. 2012-05-07 00:07:34 -07:00
John MacFarlane
6a3e60504e DocBook reader: Implemented important, note, caution, tip, warning. 2012-05-05 19:58:37 -07:00
John MacFarlane
d8dc57d91c DocBook reader: Support email tag. 2012-05-05 19:34:39 -07:00
John MacFarlane
4c825cf045 DocBook reader: Implemented refsectN, refsection. 2012-05-02 11:22:05 -07:00
John MacFarlane
2d29c94acf DocBook reader: Minor doc fix. 2012-05-01 22:37:34 -07:00
John MacFarlane
bc511109fe DocBook reader: Support question and answer tags. 2012-05-01 22:35:28 -07:00
John MacFarlane
cbfd187ba9 DocBook reader: Implemented screen, quandadiv, ackno. 2012-05-01 20:54:39 -07:00
John MacFarlane
9961dc274a Improved spacing around LaTeX block environments.
verbatim, itemize, description, enumerate.
2012-04-30 09:26:15 -07:00
John MacFarlane
8201257b5c LaTeX writer: Fixed spacing in quote environments.
Closes #502.  Previously you'd get:

~~~
hi

\begin{quote}
hi

\end{quote}
hi
~~~

Now we get:

~~~
hi

\begin{quote}
hi
\end{quote}

hi
~~~
2012-04-30 07:46:38 -07:00
John MacFarlane
deb72b5f43 ConTeXt writer: Fixed escaping of %.
* In text, `%` needs to be escaped as `\letterpercent`, not `\%`
* Inside URLs, `%` needs to be escaped as `\%`

Thanks to jmarca and adityam for the fix.  Closes #492.
2012-04-29 14:21:56 -07:00
John MacFarlane
a9f037a615 HTML reader: Support <col> and <caption> in tables.
Closes #486.
2012-04-29 13:54:52 -07:00
John MacFarlane
0db7d87240 DocBook reader: implemented authorinitials and other minor tags. 2012-04-29 10:10:38 -07:00
John MacFarlane
1455a3ce81 DocBook reader: Implemented appendix, preface, book, bookinfo. 2012-04-29 10:03:36 -07:00
John MacFarlane
835e79f3e8 DocBook reader: Implemented wordasword and markup tags. 2012-04-29 09:43:52 -07:00
John MacFarlane
41016eebe2 DocBook reader: Supported variablelist.
Also added 'named' convenience function to avoid repetition.
2012-04-28 11:04:15 -07:00
John MacFarlane
d4d5910e0a HTML reader: Don't skip nonbreaking spaces.
Previously a paragraph containing just `&nbsp;` would be rendered
as an empty paragraph. Thanks to Paul Vorbach for pointing out the bug.
2012-04-28 09:24:52 -07:00
John MacFarlane
5932d905ff Textile reader: Parse +text+ as emphasized (should be underline). 2012-04-27 15:10:40 -07:00
John MacFarlane
4b77def061 Merge pull request #485 from paul-r-ml/master
Textile reader update
2012-04-27 15:00:02 -07:00