Commit graph

2168 commits

Author SHA1 Message Date
John MacFarlane
aab4c47da5 Text.Pandoc.UTF8: Use strict bytestrings in reading.
The use of lazy bytestrings seemed to cause problems using
pandoc on Windows 7/8 64-bit machines.

Closes #874.
2013-07-04 15:43:42 -07:00
John MacFarlane
3f1937f78e LaTeX writer: Don't use ligatures in escaping inline code. 2013-07-04 15:06:23 -07:00
John MacFarlane
3cd62d7c35 Rename Ext_yaml_title_block -> Ext_yaml_metadata_block. 2013-07-02 20:54:30 -07:00
John MacFarlane
0da863f951 Markdown writer: Changed condition for rendering title block.
Previously it was only rendered if title, author, or date set.
Now any metadata field can be set.
2013-07-02 20:44:19 -07:00
John MacFarlane
e973bbbbc8 Markdown reader: Better error messages for yaml headers. 2013-07-02 09:23:43 -07:00
John MacFarlane
d39f527b07 Fixed bug retrieving default template for markdown variants. 2013-07-02 09:04:07 -07:00
John MacFarlane
1f7ce4a2cd Write full metadata in MMD style title blocks. 2013-07-02 09:03:54 -07:00
John MacFarlane
0fa5792790 Markdown reader: Ignore fields ending with _ in YAML headers. 2013-07-01 22:39:56 -07:00
John MacFarlane
f3f557d988 Emit warning instead of failing on invalid YAML header. 2013-07-01 22:29:04 -07:00
John MacFarlane
9009a7e4a8 Markdown writer: Commas are okay in plain yaml scalars.
It's just commas with brackets that can cause problems.
2013-07-01 21:00:46 -07:00
John MacFarlane
e7a68fc7e8 Markdown writer: Render yaml title block fields in alpha order.
This makes the output predictable; previously it varied across
implementations.
2013-07-01 20:56:27 -07:00
John MacFarlane
7f83d88a65 Added Text.Pandoc.Writers.Shared to repository.
This should have been in last commit.
2013-07-01 20:49:22 -07:00
John MacFarlane
956425709d Created Text.Pandoc.Writers.Shared, improved metaToJSON.
* Text.Pandoc.Writers.Shared contains shared functions used
  only in writers.
* metaToJSON now takes a WriterOptions parameter, and will
  return an empty object if standalone is not specified.
2013-07-01 20:47:26 -07:00
John MacFarlane
19ad69b1c6 Improvements to yaml title block writer. 2013-07-01 16:28:34 -07:00
John MacFarlane
55c8003e22 Shared: Export getField. 2013-07-01 16:28:22 -07:00
John MacFarlane
2d46828b1c Revert "Markdown writer: Don't include variables in metadata."
This reverts commit 0ec8573347.
2013-07-01 14:17:04 -07:00
John MacFarlane
0ec8573347 Markdown writer: Don't include variables in metadata. 2013-07-01 12:48:13 -07:00
John MacFarlane
5d01e9a117 Markdown writer: Support yaml title block. 2013-06-30 23:37:27 -07:00
John MacFarlane
a1f010de78 Metadata changes: Variables now completely shadow metadata.
Previously if you set a value both in metadata and with a variable,
they'd be combined into a list.  Now the variable replaces the
value in document metadata.  If many variables with the same
name are set, a list is created.

Shared:  metaToJSON now has an argument for a variable list.
2013-06-29 22:14:01 -07:00
John MacFarlane
5cb0f0bbf1 ConTeXt writer: Properly handle tables without captions.
The old output only worked in MkII. This should work in MkIV
as well.

Closes #837.
2013-06-28 21:30:27 -07:00
John MacFarlane
644e3239a9 Custom writer: Pass full metadata, not just tit/auth/date. 2013-06-27 22:55:10 -07:00
John MacFarlane
899a65b7d1 Writers: Use defField for defaults.
This way explicitly specified fields not overridden.

Fixes a problem e.g. with specifying a documentclass via
the command line using -V.
2013-06-27 22:42:55 -07:00
John MacFarlane
9ab60a4d15 Shared: Added defField.
`defField` is like `setField`, but does nothing if the
field already has a value.
2013-06-27 21:13:18 -07:00
John MacFarlane
dd96213c05 Man writer: give more fine-grained control in template.
Now the `title`, `section`, `header`, and `footer` can all be set
individually in metadata.  The `description` variable has been
removed.

Quotes have been added so that spaces are allowed in the title.

If you have a title that begins

    COMMAND(1) footer here | header here

pandoc will parse it as before into a title, section, header, and
footer.  But you can also specify these elements explicitly.

Closes #885.
2013-06-27 19:32:28 -07:00
John MacFarlane
82e46bf385 LaTeX reader: Support alltt environment.
Closes  #892.
2013-06-27 18:54:31 -07:00
John MacFarlane
79a4ea03e2 Stop escaping | in LaTeX math.
This caused problems with array environments.  Closes #891.
2013-06-26 20:54:31 -07:00
John MacFarlane
243c56a880 Fixed 'authors' metadata parsing in reST.
Semicolons separate different authors.
2013-06-25 22:32:50 -07:00
John MacFarlane
70eeeb82b5 Fixed regression with RTF table of contents. 2013-06-25 22:32:50 -07:00
John MacFarlane
08631ef1a3 Some test suite fixes for new metadata. 2013-06-25 22:32:50 -07:00
John MacFarlane
16d6005ed9 Fixed merge bugs in Shared. 2013-06-25 18:15:22 -07:00
John MacFarlane
f34232c934 Removed 'Functor' constraint. 2013-06-25 17:41:15 -07:00
John MacFarlane
f869f7e08d Use new flexible metadata type.
* Depend on pandoc 1.12.
* Added yaml dependency.
* `Text.Pandoc.XML`: Removed `stripTags`.  (API change.)
* `Text.Pandoc.Shared`:  Added `metaToJSON`.
  This will be used in writers to create a JSON object for use
  in the templates from the pandoc metadata.
* Revised readers and writers to use the new Meta type.
* `Text.Pandoc.Options`: Added `Ext_yaml_title_block`.
* Markdown reader:  Added support for YAML metadata block.
  Note that it must come at the beginning of the document.
* `Text.Pandoc.Parsing.ParserState`:  Replace `stateTitle`,
  `stateAuthors`, `stateDate` with `stateMeta`.
* RST reader:  Improved metadata.
  Treat initial field list as metadata when standalone specified.
  Previously ALL fields "title", "author", "date" in field lists
  were treated as metadata, even if not at the beginning.
  Use `subtitle` metadata field for subtitle.
* `Text.Pandoc.Templates`:  Export `renderTemplate'` that takes a string
  instead of a compiled template..
* OPML template:  Use 'for' loop for authors.
* Org template: '#+TITLE:' is inserted before the title.
  Previously the writer did this.
2013-06-24 20:29:41 -07:00
John MacFarlane
e32a8f5981 Revised Text.Pandoc.Templates to accept JSON contexts.
Currently the library is set up with a shim for association
lists, for compatibility, but this can change when the writers
are changed.

New export: `varListToJSON`.

Removed `Empty`.

Simplified template type to a newtype.
2013-06-24 20:27:37 -07:00
John MacFarlane
5f4a32e465 Use aeson for json.
Benchmarked:  about twice as slow as json!
2013-06-24 20:27:37 -07:00
John MacFarlane
a578a490ee Parsing: Generalized state type on readWith. 2013-06-24 20:27:36 -07:00
John MacFarlane
e3b8b89d31 Markdown reader: Check for blank lines first in blocks.
(And skip them.  This might speed things up in some cases.)
2013-06-19 09:22:57 -07:00
John MacFarlane
f2c3335642 Properly handle blank line at beginning of input.
Closes #882.
2013-06-19 09:11:34 -07:00
John MacFarlane
b53ea23b3f Improved code readability. 2013-06-19 09:08:35 -07:00
John MacFarlane
e0832b0359 Markdown reader: fixed bug in unmatched reference links.
The input

    [*infile*] [*outfile*]

was getting improperly parsed:  "infile" was emphasized, but
"*outfile*" was literal.  This was due to failure to parse the
"fallback" in the reference link parser.

Closes #883.
2013-06-19 08:56:11 -07:00
John MacFarlane
b04dfde403 RST reader: don't insert paragraphs where docutils doesn't.
rst2html doesn't add `<p>` tags to list items (even when they are
separated by blank lines) unless there are multiple paragraphs in the
list.  This commit changes the RST reader to conform more closely to
what docutils does.

Closes #880.
2013-06-18 10:04:37 -07:00
John MacFarlane
a43e0ad5d6 Markdown writer: Don't wrap attributes in fenced code blocks. 2013-06-11 10:17:12 -07:00
John MacFarlane
50ba5a801a Textile reader: Correctly handle entities. 2013-06-11 10:16:54 -07:00
John MacFarlane
8d19e45b97 LaTeX writer: Always create labels for sections.
Previously the labels were only created when there were links to
the section in the document.

Closes #871.
2013-06-02 14:38:18 -07:00
Max Rydahl Andersen
2e868c8251 Add --atx-headers support to asciidoc and dont print empty identifier blocks ([[]]) on headers 2013-05-31 01:34:46 +02:00
John MacFarlane
7998587810 Added CPP directives to avoid warnings.
For 'import Prelude hiding (catch)'.  catch is no longer in
Prelude starting with base 4.6.
2013-05-29 20:21:32 -07:00
John MacFarlane
0a6e9f048a Shared.openURL: Properly handle data: URIs. 2013-05-28 12:48:17 -07:00
John MacFarlane
f8e6f9c215 EPUB writer: math with --webtex is automatically made self-contained.
And some code cleanup.
2013-05-22 14:51:47 -07:00
John MacFarlane
210855e03e EPUB writer: Download webtex images and include as data URLs.
This allows you to use `--webtex` in creating EPUBs.
2013-05-22 10:21:22 -07:00
John MacFarlane
ca09c1ac3b MediaWiki reader: Ignore attributes on headers. 2013-05-20 11:08:27 -07:00
John MacFarlane
c63e490ab2 MediaWiki reader: Skip attributes on table rows.
Previously we just crashed if rows had attributes, now we
ignore them.
2013-05-20 10:43:12 -07:00