Commit graph

1283 commits

Author SHA1 Message Date
John MacFarlane
05fa195bf7 Biblio: Fixed mess created by my removing procInlines.
Now I see that procInlines was needed to prevent bottomUp
from acting on sublists.

This should fix the problem where '@item1, @item1' yielded
"Doe (1999), Doe Doe Doe Doe (1999)".
2011-11-07 11:32:08 -08:00
John MacFarlane
1af2ebce43 Biblio - fixed author-in-text citations so they don't double. 2011-11-07 11:03:33 -08:00
John MacFarlane
e95e6f3664 Biblio - Removed redundancy. 2011-11-07 10:31:25 -08:00
John MacFarlane
ca98cd8f18 Biblio: Put whole author-in-text citation in a Cite.
Previously just the date and other info went in the Cite.
2011-11-06 17:28:39 -08:00
John MacFarlane
ca5f4434c2 Further simplification of Biblio. 2011-11-06 16:48:16 -08:00
John MacFarlane
380fa06720 Further cleanup of Biblio. 2011-11-06 16:37:50 -08:00
John MacFarlane
3bf1984df6 Simplified Biblio, removed procInlines, use generics instead. 2011-11-06 16:16:06 -08:00
John MacFarlane
dd6ed88707 Markdown reader: allow punctuation only internally in cite keys.
The characters '.',':',';','$','<','>','~','#','-','_' can
be used only between two letters or digits in a citation key.

This means that '@item1.' will be parsed as a citation, 'item1',
followed by a period, instead of a citation 'item1.', as was the
case previously.

Thanks to David Sanson for alerting us to the problem.
2011-11-06 16:00:23 -08:00
John MacFarlane
e8bfabeeeb Don't add comma+space to prefix if it ends in punctuation.
Patch from Andrea Rossato.
2011-11-04 17:38:18 -07:00
John MacFarlane
f4dbd85347 Text.Pandoc.Biblio: Expand citations recursively inside nested inlines.
Closes #331.
2011-10-28 13:18:58 -07:00
John MacFarlane
565113fb6b Biblio: Treat \160 as space when parsing locator and suffix.
This fixes a bug with "p. 33" when `--smart` is used. Previously
the whole "p. 33" would be included in the suffix, with no locator.
2011-10-27 13:58:10 -07:00
John MacFarlane
40cb070fe6 Don't generate superfluous file cover-image.jpg.
Closes #319.
2011-10-27 12:53:46 -07:00
John MacFarlane
1a1f6cb08b Added TOC identifier in EPUB page template.
Closes #329.
2011-10-27 12:00:34 -07:00
John MacFarlane
dea38326ab Removed redundant import. 2011-10-26 17:36:21 -07:00
John MacFarlane
1b81981c5f HTML reader now recognizes DocBook block and inline tags.
It was always possible to include raw DocBook tags in a markdown
document, but now pandoc will be able to distinguish block from
inline tags and behave accordingly. Thus, for example,

    <sidebar>
    hello
    </sidebar>

will not be wrapped in `<para>` tags.
2011-10-25 12:44:20 -07:00
John MacFarlane
c335b6cbd8 HTML slides: only add id to div/section if --section-divs selected. 2011-10-02 23:19:03 -07:00
John MacFarlane
072df3f5dd Simplified slide creation in HTML writer.
A horizontal rule now gets transformed into an empty H1 header
before 'hierarchicalize' is called.

If the document that does not begin with an H1 header, an
empty one is provided.

This avoids the need for kludgy raw HTML.

Also, the 'titleslide' class is added to any section containing
just a title:

----

----
2011-10-02 11:49:56 -07:00
John MacFarlane
9b37c9cc35 Added dzslides output option.
* Added DZSlides to HTMLSlideVariant.
* Added support for dzslides in HTML writer.
* Added dzslides template.
2011-10-01 23:02:24 -07:00
John MacFarlane
44bcb5da51 LaTeX writer: don't escape # or ~ inside href{...}.
Closes #309.
2011-10-01 22:21:39 -07:00
John MacFarlane
f8df0f50fd Added escaping of euro character to LaTeX writer.
Partially resolves #309.
2011-09-23 14:58:16 -07:00
John MacFarlane
e3c560ac3d RST writer: Fixed bug involving empty table cells.
isSimple was being calculated in a way that assumed there
were no non-empty cells.

Resolves #299. Thanks to rmunoz for reporting the bug.
2011-09-05 19:13:30 -07:00
Antoine Latter
afdffec763 TypeSynonymInstances no longer implies FlexibleInstances in GHC 7.2 2011-09-02 17:50:17 -05:00
takahashim
724de8314c allow footnotes followed by newline without space chars 2011-08-23 09:56:58 +09:00
John MacFarlane
24095e0615 ConTeXt writer: Changed 'descr' to 'description', fixed alignment. 2011-08-20 15:30:57 -07:00
John MacFarlane
fa03bf52cb ConTeXt: Use buffering for footnotes containing code blocks.
Closes #291.
2011-08-18 19:23:34 -07:00
John MacFarlane
f9ae93d854 ConTeXt: Escape # in link URLs.
Partially addresses #291.
2011-08-18 12:16:39 -07:00
John MacFarlane
f2fb733e0d Templates: Return empty string for json template.
Thanks to Dirk Laurie for pointing out the bug.
2011-08-18 10:49:19 -07:00
John MacFarlane
6c639d3420 HTML reader: Fixed bug parsing tables w both thead and tbody.
See bug #274, which was not completely fixed by the last patch.
2011-08-01 11:56:15 -07:00
John MacFarlane
77cf7f9cac Tweaked Arbitrary instance to help avoid timeouts in tests. 2011-07-31 08:47:11 -07:00
John MacFarlane
8be6cc210c Added PRAGMA needed for ghc 6.12. 2011-07-30 19:58:46 -07:00
John MacFarlane
81381a9305 Removed applicative stuff in Markdown reader.
It requires parsec 3, and currently pandoc can build with parsec 2.
2011-07-30 19:43:20 -07:00
John MacFarlane
b66b7a791c Markdown reader: Improved emph/strong parsing.
Ported code from pandoc2.
Now all tests pass.
2011-07-30 18:08:49 -07:00
John MacFarlane
2d14c9b436 Added nonspaceChar to Text.Pandoc.Parsing. 2011-07-30 18:08:02 -07:00
John MacFarlane
8ed75af42c markdown2pdf: Added -interaction nonstopmode.
Otherwise it can hang if the error requests user input!
2011-07-30 00:03:55 -07:00
John MacFarlane
45b8520af8 Fix template problem for epub. 2011-07-28 18:53:59 -07:00
John MacFarlane
57821e1cdf Added s5-url and slidy-url variables, instead of hard-coding.
If you want to put your slidy files in the slidy subdirectory,
for example, you can do

    pandoc -t slidy -V slidy-url=slidy -s
2011-07-28 17:35:26 -07:00
John MacFarlane
0f0c1579f8 Smart quotes: handle '...hi' properly.
Also added test case.
2011-07-25 23:49:45 -07:00
John MacFarlane
a3327835be Docbook writer: Use programlisting for code blocks.
Instead of screen, as before.
2011-07-24 23:36:30 -07:00
John MacFarlane
07c7cd1945 Docbook writer: Use CALS tables (instead of XHTML tables).
Reason:  Some older docbook software does not work with XHTML
tables.

Closes #77.
2011-07-24 23:24:03 -07:00
John MacFarlane
3162adbd9b HTML writer: Removed English title on footnote back links.
This is incongruous in non-English documents.
2011-07-24 16:24:27 -07:00
John MacFarlane
7b4c1b171c Use data: protocol to embed s5 css in <link> tags.
Using inline css didn't work properly with Chrome and Safari.
2011-07-24 11:36:54 -07:00
John MacFarlane
d6df566a75 Reordered offline slidy includes. 2011-07-24 10:39:46 -07:00
John MacFarlane
d5e0c449bd Use yuicompressor-packed js for s5.
Removed s5/default/slides.js.comment,
s5/default/slides.js.packed. Added s5/default/slides.min.js.
2011-07-24 09:27:08 -07:00
John MacFarlane
fa16e31f89 Fixed slidy css.
* Use non-minimized version of `slidy.css` with `--offline` option,
  so users can more easily edit it.
* Fixed bug in slidy css that prevented proper centering of title.
2011-07-24 09:08:11 -07:00
John MacFarlane
c872d9f7ef Insert CDATA around inline js/css in HTML, slidy. 2011-07-24 08:23:38 -07:00
John MacFarlane
835dc412d2 Enclose s5 scripts and css in CDATA tags. 2011-07-24 07:52:44 -07:00
John MacFarlane
35cef01659 RST reader: Partial support for labeled footnotes.
Also made simpleReferenceName parser more accurate, which
affects several other parsers.
2011-07-23 18:51:02 -07:00
John MacFarlane
310697ce7e Changed --mathjax to link to mathjax CDN by default.
`--mathjax` now takes an optional URL argument. If it is not provided,
pandoc links directly to the (secure) mathjax CDN.
This is what they now recommend.  Thanks to dsanson.
2011-07-23 13:30:59 -07:00
John MacFarlane
81c403d2d1 Use \enquote{..} for latex quotes if template uses csquotes package.
This provides better support for foreign language quoting.
Thanks to Andreas Wagner for the idea.
2011-07-23 13:12:11 -07:00
John MacFarlane
6424e7d02c Properly handle characters in the 128..159 range.
These aren't valid in HTML, but many HTML files produced by
Windows tools contain them.  We substitute correct unicode
characters.
2011-07-23 12:43:01 -07:00
John MacFarlane
26418b7d14 HTML writer/templates: Made TOC more customizable.
The container for the TOC is now in the template, so users
can insert a header or other styling. Thanks to Bruce D'Arcus
for the suggestion.
2011-07-23 12:04:31 -07:00
John MacFarlane
48368061a1 LaTeX writer: don't set stVerbInNote unnecessarily. 2011-07-23 08:36:41 -07:00
John MacFarlane
fd34dcba85 Changed default template naming scheme.
Instead of latex.template, we now have default.latex.

An appropriate extension is added automatically if the value of
`--template` has no extension.  So, `pandoc --template=special -t latex`
looks for `special.latex`, while `pandoc --template=special -t man`
looks for `special.man`.
2011-07-22 22:49:38 -07:00
John MacFarlane
94405121ab Look for value of --template in datadir if not found.
This way, you can put your special.template.latex in ~/.pandoc
and use it from any directory.
2011-07-22 22:15:25 -07:00
John MacFarlane
fecbceb610 Added --luatex option to markdown2pdf.
This uses lualatex to create the PDF.
2011-07-22 13:17:41 -07:00
John MacFarlane
18306c74fb Deprecated --xetex option - it is no longer needed.
Deprecated `writerXeTeX` and the `--xetex` option.
The latex writer now produces a file that can be processed
by latex, pdflatex, lualatex, or xelatex, so this option isn't
needed.

The option is still neded in markdown2pdf, however, which
has been modified to take some options that aren't in pandoc.
2011-07-22 13:11:46 -07:00
John MacFarlane
0cf2a631e8 LaTeX writer: Use \texttt and escapes instead of \verb!..!.
\verb is simply too fragile; it doesn't work inside command
arguments.
2011-07-22 12:19:34 -07:00
John MacFarlane
e01ae38a77 markdown2pdf: Better error printing.
This goes with the earlier change to -halt-on-error.
2011-07-22 10:30:06 -07:00
John MacFarlane
5eec45ec40 markdown2pdf: Don't crash if pdflatex's output is not UTF-8.
This requires using a custom version of readProcessWithExitCode
that uses utf8-string's conversions instead of the system ones.
utf8-string's utf-8 conversion doesn't crash on invalid
encoding.
2011-07-22 10:28:48 -07:00
John MacFarlane
4ffb787214 Merge pull request #278 from tanimoto/master
markdown2pdf: reading log with non-UTF8 characters
2011-07-21 14:49:39 -07:00
John MacFarlane
fe14bf9447 LaTeX reader: Handle \subtitle command.
If there's a subtitle, it is added to the title,
separated by a colon and linebreak.  Closes #280.
2011-07-21 13:33:51 -07:00
John MacFarlane
6c029621ed LaTeX reader & writer: Use \and to separate authors.
Closes #279.
2011-07-21 10:09:51 -07:00
Paulo Tanimoto
c95a73bdb3 markdown2pdf: Fix issue reading log with non-UTF8 characters.
Replaced 'UTF8.readFile logFile' with 'liftM toString $ BS.readFile logFile'
2011-07-20 22:54:26 -05:00
John MacFarlane
1951c2349f Changed markdown2pdf to halt-on-error.
Before, we used -interaction=batchmode, which just ignored errors.
This leads to bad results--users should know when something goes wrong.
2011-07-20 08:13:00 -07:00
John MacFarlane
71736869bb ConTeXt writer: Made \start/stoptyping flush with margin.
This prevents extra blank lines.
2011-07-19 16:29:33 -07:00
John MacFarlane
8fd3d0bdbb LaTeX writer: make verbatim environments flush to avoid extra space.
The indented `\end{verbatim}` was causing an extra blank line in
the output.

Closes #277.
2011-07-19 16:25:01 -07:00
John MacFarlane
1c28c5308f Added unexported Text.Pandoc.MIME.
Moved getMimeType from Text.Pandoc.Shared to Text.Pandoc.MIME,
so we won't have an API change.
2011-07-19 12:01:20 -07:00
John MacFarlane
e2aec87956 ODT writer: Construct META-INF/manifest.xml based on archive contents.
This fixes a bug in ODTs containing images.  LibreOffice would signal
that these ODTs were corrupt, because the manifest.xml did not contain
a reference to the image files.
2011-07-17 23:21:59 -07:00
John MacFarlane
e980627769 Added getMimeType to Text.Pandoc.Shared. 2011-07-17 19:33:52 -07:00
John MacFarlane
b5da7adfb8 Un-URI-escape image filenames in LaTeX, ConTeXt, RTF, Texinfo.
Also do this when copying image files into EPUBs and ODTs.

Closes #263.
2011-07-16 14:19:45 -07:00
John MacFarlane
8d13ff5bc3 HTML writer: Use embed tag for images with non-image extensions.
(e.g.  PDFs).

Closes #264.
2011-07-16 10:11:46 -07:00
John MacFarlane
dd59cd2341 HTML reader: treat Plain as Para when needed.
For example, in

    Just a few glitches remaining.
    <ul><li> In this situation, one loses the list.
    </ul>
    And in this, the preformatting.
   <pre>Preformatted text not starting with its own blank line.
   </pre>

Thansk to Dirk Laurie for noticing the issue.
2011-07-16 09:42:16 -07:00
John MacFarlane
934867f858 HTML reader: Handle tbody, thead in simple tables.
Closes #274.
2011-07-15 21:16:49 -07:00
John MacFarlane
b30afc2009 Merge pull request #273 from qerub/master
Textile reader: Make it possible to have colons after links.
2011-07-11 08:31:29 -07:00
John MacFarlane
c83b578f58 LaTeX reader: Gobble option & space after linebreak \\[10pt]. 2011-07-10 19:07:40 -07:00
John MacFarlane
4134dad500 Make HTML reader more forgiving of bad HTML.
* Skip spaces after <b>, <emph>, etc.
* Convert Plain elements into Para when they're in a list
  item with Para, Pre, BlockQuote, CodeBlock.

An example of HTML that pandoc handles better now:

~~~~
<h4> Testing html to markdown </h4>
<ul>
<li>
<b> An item in a list </b>
<p> An introductory sentence.
<pre>
Some preformatted text
at this stage comes next.

But alas! much havoc
is wrought by Pandoc.
</pre>
</ul>
~~~~

Thanks to Dirk Laurie for reporting the issues.
2011-07-10 16:54:46 -07:00
John MacFarlane
b5411c06aa Improved LaTeX tables.
* Use ctable package, which allows footnotes and
  provides additional options.
* Made cell alignments work in multiline tables.
* Closes #272.
2011-07-10 12:33:45 -07:00
John MacFarlane
09479ba7b2 LaTeX tables: more space btw lines, top-align cells.
Closes #271.
2011-07-10 12:33:34 -07:00
Christoffer Sawicki
8fa4e8bff1 Textile reader: Make it possible to have colons after links. 2011-07-10 16:30:14 +02:00
John MacFarlane
ea0a09aef1 Fixed bug in slidy writer: unclosed div tag. 2011-07-06 17:24:40 -07:00
Kelsey Hightower
cf11673d83 EPUB writer: Add a meta element specify the cover.
Some EPUB e-readers, such as the Nook, require a meta element inside the
OPF metadata block to ensure the cover image is properly displayed.

When generating an EPUB using the `--epub-cover-image` option, this
patch adds the following meta element to the OPF metadata block in
`content.opf`:

  <meta name="cover" content="cover-image" />
2011-07-04 23:39:50 -04:00
John MacFarlane
9b5f1cba21 Fixed test, added another markdown emph/strong test. 2011-06-22 20:37:57 -07:00
John MacFarlane
5611057e06 Added failing test case due to Perry Wagle. 2011-06-22 20:18:32 -07:00
John MacFarlane
9e71dc3f48 Support \dots and well as \ldots in LaTeX reader. 2011-06-22 20:06:29 -07:00
John MacFarlane
d324bcb0a9 Added Tests.Writers.Markdown. 2011-06-22 19:46:54 -07:00
John MacFarlane
da2301387f Markdown writer: Insert HTML comment btw list and indented code block.
This prevents the code block from being interpreted as part of the list.
2011-06-06 05:56:59 -07:00
John MacFarlane
8d54e304c6 LaTeX writer: use deVerb on table and picture captions.
Otherwise LaTeX complains about \verb inside command argument.
Thanks to bbanier for reporting the bug.
2011-05-24 23:56:23 -07:00
John MacFarlane
6e59053d32 Forbid ()s in citation item keys.
Resolves Issue #304: problems with

(@item1; @item2)

because the final paren was being parsed as part of
the item key.
2011-05-22 20:24:18 -07:00
John MacFarlane
9ff589359f Revert "Parsing: Use new type aliases, PandocParser, GeneralParser."
This reverts commit ec5410bc4e.
2011-04-29 11:34:36 -07:00
John MacFarlane
ec5410bc4e Parsing: Use new type aliases, PandocParser, GeneralParser.
This should make it easier to change the types later.
2011-04-29 11:32:24 -07:00
John MacFarlane
b9ba3847be Allow non-plain math methods in epub. 2011-04-29 10:49:45 -07:00
John MacFarlane
b42c48e919 Disallow notes within notes in reST and markdown.
These previously caused infinite looping and stack overflows.
For example:

[^1]

[^1]: See [^1]

Note references are allowed in reST notes, so this isn't a full
implementation of reST. That can come later. For now we need to
prevent the stack overflows.

Partially resolves Issue #297.
2011-04-20 11:42:27 -07:00
John MacFarlane
cfaa9acd18 Fixed Slidy/S5 output to allow --section-divs.
This is also a cleaner way of inserting the slide divs.
Resolves Issue #296.
2011-04-16 12:16:24 -07:00
John MacFarlane
8ddf7f5dc7 Whitespace cleanup. 2011-04-16 10:37:47 -07:00
John MacFarlane
220bd121d8 Allow --section-divs with slidy output. 2011-04-16 10:33:44 -07:00
John MacFarlane
679113ab02 Revert API change in EPUB writer.
Instead of passing the epub cover image as a parameter, we now pass
it in the list of variables.  This avoids the API change introduced
in f5cbb68534 without losing the
new functionality.
2011-04-16 09:54:05 -07:00
John MacFarlane
4b90ffe1bd Allow '|' followed by newline in RST line block. 2011-04-11 14:45:42 -07:00
John MacFarlane
4ad9360a97 Fixed bug in footnote order in HTML.
CircleCode pointed out that the following markdown produces
out-of-order footnote markers in HTML:

-8<------------------------

some text^[with a footnote which will be #1]

issue

some other text^[with a footnote which will be #2]
-8<------------------------

This fixes the problem.
2011-03-28 16:54:37 -07:00
John MacFarlane
69b0c15030 Added FlexibleInstances pragma.
Thanks to Sivaram Gowkana for the patch.
2011-03-19 12:05:55 -07:00
John MacFarlane
6beba76f61 Changed uri parser so it doesn't include trailing punctuation.
So, in RST, 'http://google.com.' should be parsed as a link
to 'http://google.com' followed by a period.

The parser is smart enough to recognize balanced parentheses,
as often occur in wikipedia links: 'http://foo.bar/baz_(bam)'.

Also added ()s to RST specialChars, so '(http://google.com)'
will be parsed as a link in parens.

Added test cases.

Resolves Issue #291.
2011-03-18 11:30:20 -07:00
John MacFarlane
d1304e8356 OpenDocument writer: Use "First paragraph" style after most non-para blocks.
(Not just headers, as in the last patch.)
Patch from Andrea Rossato, slightly modified by JM.
2011-03-16 12:35:32 -07:00
John MacFarlane
f5cbb68534 Added --epub-cover-image option.
API change: Added a parameter for the cover image path to
writeEPUB.

Followed best practices outlined in
http://blog.threepress.org/2009/11/20/best-practices-in-epub-cover-images/
2011-03-13 12:42:16 -07:00
John MacFarlane
403bb521cd Fixed bug in RST field list parser.
The bug affected field lists with multi-line items at the
end of the list.
2011-03-12 17:08:23 -08:00
John MacFarlane
e24ce1c11d OpenDocument: Use special style for 1st para after heading.
"First paragraph" as opposed to "Text body."  This allows
users to specify e.g. that only paragraphs after the first
paragraph of a section are to be indented.

Thanks to Andrea Rossato for the patch.
Closes github Issue #20.
2011-03-12 13:38:04 -08:00
John MacFarlane
eebd77829c Markdown+lhs reader: Require space after inverse bird tracks.
The point of the change is to allow html tags to be used freely
at the left margin of a markdown+lhs document.

Thanks to Conal Elliot for the suggestion.
2011-03-02 12:47:17 -08:00
John MacFarlane
5c3d9488d2 markdown2pdf: Removed mistakenly included debugging lines.
With the lines, markdown2pdf creates a temporary directory in the
working directory. Original behavior now restored.
2011-02-13 08:53:48 -08:00
John MacFarlane
78cd41c597 markdown2pdf: Fixed filename encoding issues.
With help from Paulo Tanimoto.

Resolves Issue #286.
2011-02-13 08:28:59 -08:00
John MacFarlane
84bf846503 LaTeX writer: Changed figure defaults to htbp.
This prevents "too many unprocessed floats."  Resolves
Issue #285.
2011-02-11 19:03:46 -08:00
John MacFarlane
37fa6df612 UTF8: Encode filenames.
(This is still needed, even with recent base.)

Partially resolves Issue #286 (though now there is a
new markdown2pdf problem).
2011-02-11 18:55:14 -08:00
John MacFarlane
459e460abb pandoc.hs: Updated copyright notice. 2011-02-06 17:28:12 -08:00
John MacFarlane
47ba15f5a1 Revert "Use us-ascii charset in HTML template if --ascii option."
This reverts commit aec5489960.

No need for this, since a UTF-8 charset will handle ascii just fine.
2011-02-06 10:30:52 -08:00
John MacFarlane
fb5faaa91e HTML writer: Fixed footnote backrefs in --ascii mode. 2011-02-06 09:46:59 -08:00
John MacFarlane
aec5489960 Use us-ascii charset in HTML template if --ascii option. 2011-02-06 09:38:44 -08:00
John MacFarlane
8f408e4b7b Added --ascii option.
Currently supported only in HTML writer.
2011-02-06 09:27:03 -08:00
John MacFarlane
9b38b69c94 Make --toc work in epub output. 2011-02-06 08:59:51 -08:00
John MacFarlane
79a0fbe146 HTML writer: Put line breaks in section divs. 2011-02-05 11:27:25 -08:00
John MacFarlane
cbe162ecbe Make writerSectionDivs default to False. 2011-02-05 11:21:10 -08:00
John MacFarlane
6c0e86d144 HTML writer: stringify alt text.
Previously, if you had formatting in the label of an Image
element, you'd get escaped HTML in the alt attribute.  Now
you just get a plain string version, which seems preferable.
2011-02-05 08:16:34 -08:00
John MacFarlane
bdf23d3a5d Improved HTML table output (line breaks). 2011-02-04 23:35:10 -08:00
John MacFarlane
58929eb4e5 More changes to HTML output.
Removed blank lines.  More consistent format.
2011-02-04 23:03:38 -08:00
John MacFarlane
ce4f9a3787 HTML writer: Spacing adjustments for Plain and RawHtml blocks. 2011-02-04 21:05:48 -08:00
John MacFarlane
99cb6076f8 Improved new HTML format; restored original --no-wrap behavior. 2011-02-04 20:12:17 -08:00
John MacFarlane
f9dcea6655 HTML writer: More normal line breaks.
Also removes any distinction between --no-wrap and default HTML
output.

Resolves Issue #134.
2011-02-04 18:37:02 -08:00
John MacFarlane
1a19f96a5b Native writer test: in block list test, limit to list < 20 blocks. 2011-02-04 18:33:32 -08:00
John MacFarlane
c686010a92 Added cCommented-out round-trip property in markdown reader test. 2011-02-04 18:33:08 -08:00
John MacFarlane
221177c272 Shared: Minor refactoring. 2011-02-04 18:32:54 -08:00
John MacFarlane
714303b210 Improved Arbitrary instance. 2011-02-04 18:32:30 -08:00
John MacFarlane
70405ef98a normalize: Normalize spaces too.
In normal form, Space elements only occur to separate two non-Space
elements.  So, we never have [Space], or [, ..., Space].
2011-02-04 13:43:38 -08:00
John MacFarlane
8e81437fd1 markdown2pdf: Fixed bug with output file extensions.
Previously 'markdown2pdf test.txt -o test.en.pdf' would produce
'test.pdf', not 'test.en.pdf'.

Thanks to Paolo Tanimoto for the fix.
2011-02-04 11:27:20 -08:00
John MacFarlane
d4b71a6423 Markdown reader: Simplified and corrected footnote block parser. 2011-02-01 22:35:27 -08:00
John MacFarlane
1edeea5d60 Added a (failing) test for footnotes. 2011-02-01 07:37:22 -08:00
John MacFarlane
e898f0abef Improved fix to markdown noteBlock parser.
The last patch did not handle cases with > 4 spaces.

Also added a more general test case.
2011-01-31 20:42:49 -08:00
John MacFarlane
f282b462bb Markdown reader: Fixed whitespace footnote bug (Jesse Rosenthal).
The problem was in input like this:

[^1]:  note

not in note.

Also added a test case for this.
2011-01-31 20:05:11 -08:00
John MacFarlane
cf0a843239 UTF8: Use #if instead of #ifdef. 2011-01-30 17:01:50 -08:00
John MacFarlane
b1b6d0f859 UTF8 module: Use base 4.2 IO if available.
This gives us proper line endings on windows, and some speed
improvements.

We fall back to the old functions if base < 4.2.

hGetContents is now exported.
2011-01-30 16:01:31 -08:00
John MacFarlane
afe90390ea pandoc.hs: Simplified code for writing result. 2011-01-30 14:02:16 -08:00
John MacFarlane
71ca44db6e LaTeX reader: Fixed bug with whitespace at beginning of file.
Previously a file beginning "   hi" would cause a parse error.
Also cleaned up comment parsing.
2011-01-30 08:21:48 -08:00
John MacFarlane
8a3fd7606f Markdown reader tables: Fixed bug in alignments.
Previously pandoc got confused by blank rows in the header.
2011-01-29 23:09:07 -08:00
John MacFarlane
caa091e810 Highlighting: Fixed non-highlighting-kate version of highlightHtml. 2011-01-29 23:08:29 -08:00
John MacFarlane
3b5dbe6fdb Added HTML writer tests for inline code. 2011-01-29 16:26:00 -08:00
John MacFarlane
22969c1b9c HTML writer: avoid doubled <code> tag for highlighted inline code. 2011-01-29 16:11:16 -08:00
John MacFarlane
9f28acba9d Fixed highlighting for inline code.
highlightHtml in Highlighting now has a boolean argument that
selects between inline and block content.

Revised tests for new highlighting-kate.
2011-01-29 16:04:07 -08:00
John MacFarlane
570d8ff08c Moved tests to src. 2011-01-29 11:24:16 -08:00
John MacFarlane
387a2b365e Shared: Fixed bug in normalize revealed by tests! 2011-01-29 10:03:31 -08:00
John MacFarlane
d28daf0e89 Support --listings in markdown2pdf (Etienne Millon). 2011-01-28 21:21:09 -08:00
Josef Svenningsson
d8d0f46c4c Add possibility to use listings package for code blocks and
inline code in the LaTeX writer.
2011-01-28 21:09:38 -08:00
John MacFarlane
7f5130709b RST reader: skip blanklines at beginning, not all leading spaces.
If you skip all spaces, it becomes impossible to start with
a blockquote.
2011-01-28 12:30:33 -08:00
John MacFarlane
5ba5373ec6 Shared: Make 'normalize' more generic.
Now it can transform an Inline, [Inline], Block, [Block], or Pandoc.
2011-01-28 09:35:43 -08:00
John MacFarlane
f90e18b955 RST reader: Skip blank space at beginning.
Resolves Debian Bug #611328.
2011-01-28 08:52:54 -08:00
John MacFarlane
382564ed9e RTF writer: Embed images when possible.
* Resolves Issue #275.
* PNG and JPEG supported.
* Export rtfEmbedImage.
2011-01-28 08:42:04 -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
703c421c9e RST reader: Improved field lists.
Field lists now work properly with block content.
(Thanks to Lachlan Musicman for pointing out the bug.)

In addition, definition list items are now always Para instead
of Plain -- which matches behavior of rst2xml.py.

Finally, in image blocks, the alt attribute is parsed properly
and used for the alt, not also the title.
2011-01-26 17:23:57 -08:00
John MacFarlane
80f5a89a0b LaTeX reader: Fixed an incomplete pattern match. 2011-01-26 17:23:56 -08:00
John MacFarlane
422bba202e RST reader: Include line breaks in raw field list parser output.
Note: field list items can have lists, etc. as values.
2011-01-26 17:23:56 -08:00
John MacFarlane
e66cc6728c RST reader: Allow spaces in field list names. 2011-01-26 17:23:56 -08:00
John MacFarlane
0cc7625d98 Adjusted writers to use "tex". 2011-01-26 17:23:56 -08:00
John MacFarlane
d3667f9aac Markdown reader: Don't parse latex/context environments as inline. 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
65a015e74b Added needed space after .bc and .bq.
Otherwise these can trap a </dd>, for example.

Better solution to try next: rewrite using Pretty.
2011-01-23 10:08:11 -08:00
John MacFarlane
16d4366431 Textile writer: Don't escape code in bc. block. 2011-01-23 09:44:28 -08:00
John MacFarlane
38013de857 Textile writer: Don't HTML-escape between @'s. 2011-01-23 09:12:50 -08:00
John MacFarlane
628a1ef815 Textile reader: Fixed bug (swallowed p at beginning of paragraph).
The problem was a missing 'try' in the maybeExplicitBlock parser.
Test case, a paragraph beginning with 'p', has been added.
2011-01-23 08:59:35 -08:00
John MacFarlane
7234a79104 Textile writer: Use <pre> instead of bc.. for code with blank lines.
This has fewer interaction effects.
2011-01-23 08:49:55 -08:00
John MacFarlane
1d683be414 Textile reader: Support <tt> for inline code. 2011-01-23 00:25:05 -08:00
John MacFarlane
50d08ec2c3 Textile reader: Added code blocks with bc. 2011-01-23 00:05:35 -08:00
John MacFarlane
9f99c39caf Default to textile writer on .textile extension. 2011-01-23 00:05:10 -08:00
John MacFarlane
d562efa39d ConTeXt writer: Ensure cr after \stoptyping. 2011-01-22 23:26:44 -08:00
John MacFarlane
ea5cd35004 Text.Pandoc: Added jsonFilter for easy construction of scripts.
Here's an example of its use:

-- removelinks.hs - removes links from document
import Text.Pandoc

main = interact $ jsonFilter $ bottomUp removeLink

removeLink :: Inline -> Inline
removeLink (Link xs _) = Emph xs
removeLink x = x
2011-01-22 17:53:16 -08:00
John MacFarlane
a74010a051 Markdown reader: slight speedup by moving whitespace parser. 2011-01-22 16:04:32 -08:00
John MacFarlane
a6d7d88b0f RST reader: Big speed improvement (300->260ms).
Moved whitespace parser to top of inline parsers.
2011-01-22 16:01:42 -08:00
John MacFarlane
8dcc67a993 ConTeXt writer: Don't add cr at end of inline footnote. 2011-01-22 12:17:39 -08:00
John MacFarlane
5c35be1362 Make sure native output ends in newline with --standalone. 2011-01-21 09:58:23 -08:00
John MacFarlane
bfbc289871 Haddock comment improvements. 2011-01-21 09:00:05 -08:00
John MacFarlane
9bb5b54102 Added --normalize option. 2011-01-20 22:48:20 -08:00
John MacFarlane
8894b1a030 Markdown writer: Avoid printing excess spaces at end if no notes/refs. 2011-01-20 22:36:08 -08:00
John MacFarlane
8011d079c8 Native writer: eliminated empty spaces in brackets. 2011-01-20 20:48:06 -08:00
John MacFarlane
6b50778b2a Export readNative in Text.Pandoc.Shared. 2011-01-20 08:52:59 -08:00
John MacFarlane
810e3336dc Improved native writer using Pretty.
2-3X speed improvement and more consistent layout.
2011-01-20 08:43:13 -08:00
John MacFarlane
978d949526 Made writeNative sensitive to writerStandalone.
The Pandoc (Meta ...) is not written unless standalone is set.
2011-01-19 18:57:25 -08:00
John MacFarlane
e1f3c6058e Added Text.Pandoc.Readers.Native (readNative).
readNative can now read full pandoc documents, block lists, blocks,
inline lists, or inlines.  It will interpret

Str "hi"

as if it were

Pandoc (Meta [] [] []) [Plain [Str "hi"]]

This should make testing easier.
2011-01-19 18:36:27 -08:00
John MacFarlane
e647f761ed Use spaceChar instead of oneOf " \t" in rst reader. 2011-01-19 15:17:51 -08:00
John MacFarlane
1b8a9711b8 Replaced more noneOf/oneOf parsers. 2011-01-19 15:14:23 -08:00
John MacFarlane
a400cfe10f Replaced uses of oneOf with more efficient parsers.
This speeds up the markdown reader.
2011-01-19 15:06:56 -08:00
John MacFarlane
c09518eefd More small parser rewrites for small performance gains. 2011-01-19 14:59:59 -08:00
John MacFarlane
61f3db612c Parsing: Rewrote spaceChar for significant speedup in readers. 2011-01-19 14:45:15 -08:00
John MacFarlane
adaae082fc Fixed problem with inline code in ConTeXt writer.
Previously `}` would be rendered '\type{}}'.
Now we check the string for '}' and '{'. If it contains neither,
use \type{}; otherwise use \mono{} with an escaped version of the
string.

Note:  There are some issues using the \type!str! form, including
differences btw mkii and mkiv. For now this is a conservative fix.
Perhaps in the future we can use \type!str!.  See the discussion on
pandoc-discuss s.v. "Bug in context writer".
2011-01-19 11:53:00 -08:00
John MacFarlane
8f7c119c0f Removed '--no-citeproc' as alias for '--natbib'.
This was confusing, I think, as no-citeproc could be either
natbib or biblatex.
2011-01-16 11:08:56 -08:00
John MacFarlane
281b36470f Minor code formatting. 2011-01-16 11:08:20 -08:00
John MacFarlane
b6d1f4bc9e Moved --chapters to before --number-sections in option list. 2011-01-16 09:34:26 -08:00
John MacFarlane
ab20da4be5 Support --chapters for ConTeXt output as well. 2011-01-16 09:08:19 -08:00
John MacFarlane
ece098b9e0 Use <chapter> for top docbook header if template has <book>.
Resolves Issue #265.
2011-01-16 08:59:53 -08:00
John MacFarlane
9721b87c26 Added --chapters option affecting docbook and latex.
* Added writerChapters to WriterOptions.
* Added --chapters command-line option.
* --chapters causes top-level headers to be "chapter" instead of
  "section" in LaTeX and DocBook.
* Resolves Issue #225.
2011-01-16 08:58:29 -08:00
John MacFarlane
53eb2c4828 HTML writer: Add ids to <section> tags. 2011-01-15 22:35:25 -08:00
John MacFarlane
a0e19ba8aa Merge branch 'tests' 2011-01-15 09:25:01 -08:00
John MacFarlane
fd79417825 Fixed the parser for rst+lhs - set stateLiterateHaskell. 2011-01-14 22:38:02 -08:00
John MacFarlane
a5cbcdfe3a HTML reader: parse simple tables.
Resolves Issue #106.  Thanks to Rodja Trappe for the idea
and some sample code.
2011-01-14 20:48:10 -08:00
John MacFarlane
c31d3cc306 HTML reader: parse location tags in pSatisfy.
This avoids the need for manual parsing all over the place.
2011-01-14 20:47:32 -08:00
John MacFarlane
9305114b9f LaTeX writer: Escape strings in \href{..}.
Previously strings weren't escaped, so %5D would be interpreted
as a LaTeX comment!
2011-01-14 18:59:50 -08:00
John MacFarlane
5131589be0 Simplified Text.Pandoc.CharacterReferences by using TagSoup entity lookup 2011-01-14 18:28:54 -08:00