aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2015-12-13Docx reader: image attributesmb212-10/+32
2015-12-13new function to extract multiple properties at once in CSS.hsmb211-4/+1
and use it in Textile reader
2015-12-13RST reader: image attributesmb211-7/+14
2015-12-12Implemented `east_asian_line_breaks` extension.John MacFarlane1-1/+15
Text.Pandoc.Options: Added `Ext_east_asian_line_breaks` constructor to `Extension` (API change). This extension is like `ignore_line_breaks`, but smarter -- it only ignores line breaks between two East Asian wide characters. This makes it better suited for writing with a mix of East Asian and non-East Asian scripts. Closes #2586.
2015-12-12Modified readers to emit SoftBreak when appropriate.John MacFarlane7-9/+19
2015-12-11Implemented SoftBreak and new `--wrap` option.John MacFarlane1-1/+1
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-11Markdown reader: parse soft break as SoftBreak.John MacFarlane1-1/+1
2015-12-03Markdown reader: Improved pipe table relative widths.John MacFarlane1-4/+4
Previously pipe table columns got relative widths (based on the header underscore lines) when the source of one of the rows was greater in width than the column width. This gave bad results in some cases where much of the width of the row was due to nonprinting material (e.g. link URLs). Now pandoc only looks at printable width (the width of a plain string version of the source), which should give better results. Thanks to John Muccigrosso for bringing up the issue.
2015-12-03Textile Reader: image attributesmb211-2/+9
closes #2515
2015-11-24Allow pipe tables with no body rows.John MacFarlane1-2/+3
Previously this raised a runtime error. Closes #2556.
2015-11-24LaTeX reader: Improved smart quote parsing.John MacFarlane1-14/+13
This fixes redering of unmatched quotes. Closes #2555.
2015-11-23LaTeX reader: Use curly quotes for unmatched `.John MacFarlane1-1/+8
Partially addresses #2555. Note that there's still a problem with the code sample given.
2015-11-23Docx Reader: Remove DummyListItem typeJesse Rosenthal2-12/+7
Change 5527465c introduced a `DummyListItem` type in Docx/Parse.hs. In retrospect, this seems like it mixes parsing and iterpretation excessively. What's *really* going on is that we have a list item without and associate level or numeric info. We can decide what to do what that in Docx.hs (treat it like a list paragraph), but the parser shouldn't make that decision. This commit makes what is going on a bit more explicit. `LevelInfo` is now a Maybe value in the `ListItem` type. If it's a Nothing, we treat it as a ListParagraph. If it's a Just, it's a normal list item.
2015-11-19Renamed link attribute extensions.John MacFarlane1-4/+4
* Old `link_attributes` -> `mmd_link_attributes` * Recently added `common_link_attributes` -> `link_attributes` Note: this change could break some existing workflows.
2015-11-19Merge branch 'new-image-attributes' of https://github.com/mb21/pandoc into ↵John MacFarlane9-87/+117
mb21-new-image-attributes * Bumped version to 1.16. * Added Attr field to Link and Image. * Added `common_link_attributes` extension. * Updated readers for link attributes. * Updated writers for link attributes. * Updated tests * Updated stack.yaml to build against unreleased versions of pandoc-types and texmath. * Fixed various compiler warnings. Closes #261. TODO: * Relative (percentage) image widths in docx writer. * ODT/OpenDocument writer (untested, same issue about percentage widths). * Update pandoc-citeproc.
2015-11-19Rationalized behavior of --no-tex-ligatures and --smart.John MacFarlane1-9/+15
This change makes `--no-tex-ligatures` affect the LaTeX reader as well as the LaTeX and ConTeXt writers. If it is used, the LaTeX reader will parse characters `` ` ``, `'`, and `-` literally, rather than parsing ligatures for quotation marks and dashes. And the LaTeX writer will print unicode quotation mark and dash characters literally, rather than converting them to the standard ASCII ligatures. Note that `--smart` has no affect on the LaTeX reader. `--smart` is still the default for all input formats when LaTeX or ConTeXt is the output format, *unless* `--no-tex-ligatures` is used. Some examples to illustrate the logic: ``` % echo "'hi'" | pandoc -t latex `hi' % echo "'hi'" | pandoc -t latex --no-tex-ligatures 'hi' % echo "'hi'" | pandoc -t latex --no-tex-ligatures --smart ‘hi’ % echo "'hi'" | pandoc -f latex --no-tex-ligatures <p>'hi'</p> % echo "'hi'" | pandoc -f latex <p>’hi’</p> ``` Closes #2541.
2015-11-18Docx reader: Clean up commented-out functionJesse Rosenthal1-7/+0
A residue of a recent change was left around in the form of a commented-out function. Let's clean that up.
2015-11-18Docx reader: Handle dummy list items.Jesse Rosenthal2-6/+15
These come up when people create a list item and then delete the bullet. It doesn't refer to any real list item, and we used to ignore it. We handle it with a DummyListItem type, which, in Docx.hs, is turned into a normal paragraph with a "ListParagraph" class. If it follow another list item, it is folded as another paragraph into that item. If it doesn't, it's just its own (usually indented, and therefore block-quoted) paragraph.
2015-11-16Textile reader: skip over attribute in image source.John MacFarlane1-0/+1
We don't have a place yet for styles or sizes on images, but we can skip the attributes rather than incorrectly taking them to be part of the filename. Closes #2515.
2015-11-14Follow relationships correctly in foot/endnotes.Jesse Rosenthal1-27/+40
There are separate relationship (link) files for foot and endnotes. These had previously been grouped together which led to links not working correctly in notes. This should finally fix that.
2015-11-13Merge pull request #2526 from tarleb/org-definition-lists-fixJohn MacFarlane1-1/+4
Org reader: Require whitespace around def list markers
2015-11-13Org reader: Require whitespace around def list markersAlbert Krewinkel1-1/+4
Definition list markers (i.e. double colons `::`) must be surrounded by whitespace to start a definition item. This rule was not checked before, resulting in bugs with footnotes and some link types. Thanks to @conklech for noticing and reporting this issue. This fixes #2518.
2015-11-13Merge pull request #2525 from tarleb/org-smart-fixesJohn MacFarlane1-4/+9
Org reader: Fix emphasis rules for smart parsing
2015-11-13Added `emoji` extension to Markdown.John MacFarlane1-0/+17
This is enabled by default in `markdown_github`. Added `Ext_emoji` to `Extension` in `Text.Pandoc.Options` (API change). Closes #2523.
2015-11-13Org reader: Fix emphasis rules for smart parsingAlbert Krewinkel1-4/+9
Smart quotes, ellipses, and dashes should behave like normal quotes, single dashes, and dots with respect to text markup parsing. The parser state was not updated properly in all cases, which has been fixed. Thanks to @conklech for reporting this issue. This fixes #2513.
2015-11-09Restored Text.Pandoc.Compat.Monoid.John MacFarlane12-4/+12
Don't use custom prelude for latest ghc. This is a better approach to making 'stack ghci' and 'cabal repl' work. Instead of using NoImplicitPrelude, we only use the custom prelude for older ghc versions. The custom prelude presents a uniform API that matches the current base version's prelude. So, when developing (presumably with latest ghc), we don't use a custom prelude at all and hence have no trouble with ghci. The custom prelude no longer exports (<>): we now want to match the base 4.8 prelude behavior.
2015-11-09Revert "Use -XNoImplicitPrelude and 'import Prelude' explicitly."John MacFarlane33-34/+1
This reverts commit c423dbb5a34c2d1195020e0f0ca3aae883d0749b.
2015-11-08Merge pull request #2502 from minoki/latex-comment-environmentJohn MacFarlane1-1/+2
LaTeX reader: Handle `comment` environment.
2015-11-08Merge pull request #2505 from tarleb/org-header-markup-fixJohn MacFarlane1-1/+1
Org reader: fix markup parsing in headers
2015-11-08Use -XNoImplicitPrelude and 'import Prelude' explicitly.John MacFarlane33-1/+34
This is needed for ghci to work with pandoc, given that we now use a custom prelude. Closes #2503.
2015-11-08Org reader: fix markup parsing in headersAlbert Krewinkel1-1/+1
Markup as the very first item in a header wasn't recognized. This was caused by an incorrect parser state: positions at which inline markup can start need to be marked explicitly by changing the parser state. This wasn't done for headers. The proper function to update the state is now called at the beginning of the header parser, fixing this issue. This fixes #2504.
2015-11-08LaTeX reader: Handle `comment` environment.ARATA Mizuki1-1/+2
The `comment` environment is handled in a similar way to the `verbatim` environment, except that its content is discarded.
2015-10-30Pipe tables with long lines now get relative cell widths.John MacFarlane1-13/+20
If a pipe table contains a line longer than the column width (as set by `--columns` or 80 by default), relative widths are computed based on the widths of the separator lines relative to the column width. This should solve persistent problems with long pipe tables in LaTeX/PDF output, and give more flexibility for determining relative column widths in other formats, too. For narrower pipe tables, column widths of 0 are used, telling pandoc not to specify widths explicitly in output formats that permit this. Closes #2471.
2015-10-30Textile reader: don't do smart punctuation unless explicitly asked.John MacFarlane1-3/+4
Closes #2480. Note that although smart punctuation is part of the textile spec, it's not always wanted when converting from textile to, say, Markdown. So it seems better to make this an option.
2015-10-26Markdown reader: improved parser for `mmd_title_block`.John MacFarlane1-9/+8
We now allow blank metadata fields. These were explicitly disallowed before. For background see #2026. The issue in #2026 has since been fixed in another way, so there is no need to forbid blank metadata fields.
2015-10-25Merge pull request #2477 from tarleb/org-toggling-header-argsJohn MacFarlane1-4/+16
Org reader: allow toggling header args
2015-10-25Org reader: allow toggling header argsAlbert Krewinkel1-4/+16
Org-mode allows to skip the argument of a code block header argument if it's toggling a value. Argument-less headers are now recognized, avoiding weird parsing errors. The fixes are not exactly pretty, but neither is the code that was fixed. So I guess it's about par for the course. However, a rewrite of the header parsing code wouldn't hurt in the long run. Thanks to @jo-tham for filing the bug report. This fixes #2269.
2015-10-24Org reader: fix paragraph/list interactionAlbert Krewinkel1-6/+29
Paragraphs can be followed by lists, even if there is no blank line between the two blocks. However, this should only be true if the paragraph is not within a list, were the preceding block should be parsed as a plain instead of paragraph (to allow for compact lists). Thanks to @rgaiacs for bringing this up. This fixes #2464.
2015-10-22Fixed over-eager raw HTML inline parsing.John MacFarlane1-0/+1
Tightened up the inline HTML parser so it disallows TagWarnings. This only affects the markdown reader when the `markdown_in_html_blocks` option is disabled. Closes #2469.
2015-10-22Changed § to % in operators from Odt.Arrows.Utils.John MacFarlane5-43/+42
This prevents problems building haddocks with "C" locale. Closes #2457.
2015-10-15LaTeX reader: fixed longtable support.John MacFarlane1-1/+1
2015-10-14More changes to avoid compiler warnings on ghc 7.10.John MacFarlane1-1/+1
* CPP around deprecated `parseTime`. * Text.Pandoc.Compat.Locale -> Text.Pandoc.Compat.Time, now exports Data.Time.
2015-10-14Use custom Prelude to avoid compiler warnings.John MacFarlane24-45/+10
- The (non-exported) prelude is in prelude/Prelude.hs. - It exports Monoid and Applicative, like base 4.8 prelude, but works with older base versions. - It exports (<>) for mappend. - It hides 'catch' on older base versions. This allows us to remove many imports of Data.Monoid and Control.Applicative, and remove Text.Pandoc.Compat.Monoid. It should allow us to use -Wall again for ghc 7.10.
2015-10-11HTML reader/writer: better handling of "section" elements.John MacFarlane1-3/+10
Previously `<section>` tags were just parsed as raw HTML blocks. With this change, section elements are parsed as Div elements with the class "section". The HTML writer will use `<section>` tags to render these Divs in HTML5; otherwise they will be rendered as `<div class="section">`. Closes #2438.
2015-10-10Merge pull request #2412 from frerich/reader/docbook/xref_supportJohn MacFarlane1-5/+37
Added support for <xref> tag in DocBook reader
2015-10-09LaTeX reader: don't eat excess whitespace after macros.John MacFarlane1-4/+4
Really close #2446.
2015-10-09LaTeX reader: don't eat whitespace after macro with only opt arg.John MacFarlane1-1/+3
Closes #2446.
2015-10-04Docx Reader: Parse soft, no-break hyphen elementsOphir Lifshitz2-1/+7
2015-09-25Markdown reader: handle 'id' and 'class' in parsing key/value attrs.John MacFarlane1-1/+5
# Header {id="myid" class="foo bar"} is now equivalent to # Header {#myid .foo .bar} Closes #2396.
2015-09-24Improve text generated for <xref> by employing docbook-xsl heuristicsFrerich Raabe1-2/+16
docbook-xsl, a set of XSLT scripts to generate HMTL out of DocBook, tries harder to generate a nice xref text. Depending on the element being linked to, it looks at the title or other descriptive child elements. Let's do that, too.