aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2014-06-23Add new typeclass, ReducibleJesse Rosenthal1-0/+150
This defines a typeclass `Reducible` which allows us to "reduce" pandoc Inlines and Blocks, like so Emph [Strong [Str "foo", Space]] <++> Strong [Emph [Str "bar"]], Str "baz"] = [Strong [Emph [Str "foo", Space, Str "bar"], Space, Str "baz"]] So adjacent formattings and strings are appropriately grouped. Another set of operators for `(Reducible a) => (Many a)` are also included.
2014-06-22Docx reader: Fix spacing in formatting.Jesse Rosenthal1-1/+1
The normalizing tests revealed a problem with unformatted spaces, brought about by `spanTrim`. This fixes by not trimming the spaces out of spans until they are in their final form.
2014-06-22Implement new normalization.Jesse Rosenthal1-11/+57
There were some problems with the old str normalization. This fixes those problems. Also, since it drills down on its own, it only needs to be mapped over the blocks, not walked over the tree.
2014-06-20Markdown reader: Support smallcaps through span.John MacFarlane1-1/+6
`<span style="font-variant:small-caps;">foo</span>` will be parsed as a `SmallCaps` inline, and will work in all output formats that support small caps. Closes #1360.
2014-06-20MediaWiki reader: Tightened up template parsing.John MacFarlane1-0/+1
The opening "{{" must be followed by an alphanumeric or ':'. This prevents the exponential slowdown in #1033. Closes #1033.
2014-06-20MediaWiki reader: Support --trace.John MacFarlane1-1/+10
2014-06-20Markdown reader: Prevent spurious line breaks after list items.John MacFarlane1-1/+2
When the `hard_line_breaks` option was specified, pandoc would produce a spurious line break after a tight list item. This patch solves the problem. Closes #1137.
2014-06-20HTML reader: Fix performance issue with malformed HTML tables.John MacFarlane1-0/+2
We let a `</table>` tag close an open `<tr>` or `<td>`. Closes #1167.
2014-06-20Support --trace in HTML reader.John MacFarlane1-1/+10
2014-06-20Make strNormalize go bottomUp.Jesse Rosenthal1-5/+5
This was how it used to be before it was folded into blockNormalize.
2014-06-20Docx reader: Add a comment explaining strNormalizeJesse Rosenthal1-0/+4
`normalize` from Text.Pandoc.Shared is more general. In tests, though, it more than doubles the run time. `strNormalize` does less, but it does what we need. This comment is added for future maintainability.
2014-06-20Docx Reader: Normalize DefinitionListsJesse Rosenthal1-0/+2
Previously DefinitionList had been left out of `blockNormalize`. Now it is included.
2014-06-20Docx reader: simplify blockNormalizeJesse Rosenthal1-10/+8
Use a function `stripSpaces`, instead of recursion. Makes it a bit easier to read and mantain, and simplify normalizing DefinitionList, which was left out the first time.
2014-06-20Docx reader: Fix hdr handling in block normJesse Rosenthal1-0/+2
`blockNormalize` previously forgot to account for the case in which a Header's inlines did not start with a space.
2014-06-19HTML reader: Allow space between `<col>` and `</col>`.John MacFarlane1-0/+1
Test case: ``` <table border="1"> <colgroup> <col> </col> <col></col> </colgroup> <tbody> <tr> <td>X</td> <td>Y</td> </tr> <tr> <td>1</td> <td>2</td> </tr> </tbody> </table> ```
2014-06-19Introduce blockNormalizeJesse Rosenthal1-1/+14
This will help take care of spaces introduced at the beginning of strings.
2014-06-19Have Docx reader properly interpret tabs.Jesse Rosenthal1-0/+2
2014-06-19Add literal tabs to parser.Jesse Rosenthal1-1/+4
2014-06-18More polish on Haddock reader/writer.John MacFarlane1-5/+41
2014-06-18Finished first draft of Haddock writer.John MacFarlane1-2/+11
2014-06-18Rewrote haddock reader to use haddock-library.John MacFarlane1-22/+102
This brings pandoc's rendering of haddock markup in line with the new haddock. Note that we preserve line breaks in `@` code blocks, unlike the earlier version. Modified tests pass. More tests would be good.
2014-06-18Removed old haddock reader code. Add dependency on haddock-library.John MacFarlane3-360/+21
This also removes the dependency on alex and happy.
2014-06-17DocBook reader: Support <?asciidoc-br?>.John MacFarlane1-2/+17
Closes #1236. Note, this is a bit of a kludge, to work around the fact that xml-light doesn't parse `<?asciidoc-br?>` correctly. We preprocess the input, replacing that instruction with `<br/>`, and then parse that as a line break. Other XML instructions are simply removed from the input stream.
2014-06-17LaTeX reader: Correctly handle table rows with too few cells.John MacFarlane1-3/+7
LaTeX seems to treat them as if they have empty cells at the end. Closes #241.
2014-06-16Fixed compiler warning.John MacFarlane1-1/+3
2014-06-16Naming: Use Docx instead of DocX.John MacFarlane3-44/+44
For consistency with the existing writer.
2014-06-16Merge branch 'docx' of https://github.com/jkr/pandoc into jkr-docxJohn MacFarlane3-0/+1291
2014-06-16Org reader: make tildes create inline code.John MacFarlane1-4/+4
Closes #1345. Also relabeled 'code' and 'verbatim' parsers to accord with the org-mode manual. I'm not sure what the distinction between code and verbatim is supposed to be, but I'm pretty sure both should be represented as Code inlines in pandoc. The previous behavior resulted in the text not appearing in any output format.
2014-06-16Small improvement to fix to #1333.John MacFarlane1-4/+1
This allows blank lines at end of multiline headers.
2014-06-16Markdown reader: fixed #1333 (table parsing bug).John MacFarlane1-5/+6
2014-06-16LaTeX reader: handle leading/trailing spaces in emph better.John MacFarlane1-17/+17
`\emph{ hi }` gets parsed as `[Space, Emph [Str "hi"], Space]` so that we don't get things like `* hi *` in markdown output. Also applies to textbf and some other constructions. Closes #1146. (`--normalize` isn't touched by this, but normalization should not generally be necessary with the changes to the readers.)
2014-06-16LaTeX reader: don't assume preamble doesn't contain environments.John MacFarlane1-1/+1
Closes #1338.
2014-06-16HTML reader: Fixed major parsing problem with HTML tables.John MacFarlane1-15/+11
Table cells were being combined into one cell. Closes #1341.
2014-06-16Merge pull request #1344 from mpickering/masterJohn MacFarlane1-13/+4
Moved extractSpaces to Shared.hs
2014-06-16Org reader: fixed #1342.John MacFarlane1-9/+5
This change rewrites `inlineLaTeXCommand` so that parsec will know when input is being consumed. Previously a run-time error would be produced with some input involving raw latex. (I believe this does not affect the last release, as the inline latex reading was added recently.)
2014-06-16Moved extractSpaces to Shared.hsmpickering1-13/+4
Generalised and move the extractSpaces function from `HTML.hs` to `Shared.hs` so that the docx reader can also use it.
2014-06-16Add DocX files to tree.Jesse Rosenthal3-0/+1291
This introduces Text.Pandoc.DocX, and its exported `readDocX` function.
2014-06-12allow (and discard) optional argument for \captionJames Aspnes1-1/+1
2014-06-03LaTeX reader: Handle comments at the end of tables.John MacFarlane1-0/+1
This resolves the issue illustrated in http://stackoverflow.com/questions/24009489/comments-in-latex-break-pandoc-table.
2014-05-28Merge pull request #1302 from tarleb/inline-latexJohn MacFarlane2-1/+32
Org reader: support for inline LaTeX
2014-05-27Markdown reader: Handle `c++` and `objective-c` as language identifiersJohn MacFarlane1-1/+8
in github-style fenced blocks. Closes #1318. Note: This is special-case handling of these two cases. It would be good to do something more systematic.
2014-05-20Org reader: support for inline LaTeXAlbert Krewinkel2-1/+32
Inline LaTeX is now accepted and parsed by the org-mode reader. Both, math symbols (like \tau) and LaTeX commands (like \cite{Coffee}), can be used without any further escaping.
2014-05-14Merge pull request #1297 from tarleb/citationsJohn MacFarlane2-30/+59
Org reader: support Pandocs citation extension
2014-05-14Org reader: support Pandocs citation extensionAlbert Krewinkel1-2/+53
Citations are defined via the "normal citation" syntax used in markdown, with the sole difference that newlines are not allowed between "[...]". This is for consistency, as org-mode generally disallows newlines between square brackets. The extension is turned on by default and can be turned off via the default syntax-extension mechanism, i.e. by specifying "org-citation" as the input format. Move `citeKey` from Readers.Markdown into Parsing The function can be used by other readers, so it is made accessible for all parsers.
2014-05-14Move `citeKey` from Readers.Markdown to ParsingAlbert Krewinkel1-14/+0
The function can be used by other readers, so it is made accessible for all parsers.
2014-05-14Introduce class HasLastStrPosition, generalize functionsAlbert Krewinkel2-15/+7
Both `ParserState` and `OrgParserState` keep track of the parser position at which the last string ended. This patch introduces a new class `HasLastStrPosition` and makes the above types instances of that class. This enables the generalization of functions updating the state or checking if one is right after a string.
2014-05-12LaTeX reader: Support `\addbibresource`.John MacFarlane1-0/+2
2014-05-11LaTeX reader: set `bibliography` in metadata from `\bibliography` cmd.John MacFarlane1-1/+6
2014-05-10LaTeX reader: Don't error on "%foo" with no newline.John MacFarlane1-1/+1
2014-05-10Org reader: Fix block parameter reader, relax constraintsAlbert Krewinkel1-6/+13
The reader produced wrong results for block containing non-letter chars in their parameter arguments. This patch relaxes constraints in that it allows block header arguments to contain any non-space character (except for ']' for inline blocks). Thanks to Xiao Hanyu for noticing this.