aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2016-06-13Org reader: support arbitrary raw inlinesAlbert Krewinkel1-1/+9
Org mode allows arbitrary raw inlines ("export snippets" in Emacs parlance) to be included as `@@format:raw foreign format text@@`. Support for this features is added to the Org reader.
2016-06-05Org reader: add support for "Berkeley-style" citesAlbert Krewinkel2-7/+127
A specification for an official Org-mode citation syntax was drafted by Richard Lawrence and enhanced with the help of others on the orgmode mailing list. Basic support for this citation style is added to the reader. This closes #1978.
2016-06-05Org reader: add semicolon to list of special charsAlbert Krewinkel1-1/+1
Semicolons are used as special characters in citations syntax. This ensures the correct parsing of Pandoc-style citations: [prefix; @key; suffix] Previously, parsing would have failed unless there was a space or other special character as the last <prefix> character.
2016-06-03Org reader: support special strings export optionAlbert Krewinkel4-12/+36
Parsing of special strings (like '...' as ellipsis or '--' as en dash) can be toggled using the `-` option.
2016-06-03Org reader: support emphasized text export optionAlbert Krewinkel3-15/+28
Parsing of emphasized text can be toggled using the `*` option. This influences parsing of text marked as emphasized, strong, strikeout, and underline. Parsing of inline math, code, and verbatim text is not affected by this option.
2016-06-03Org reader: support smart quotes export optionAlbert Krewinkel4-12/+28
Reading of smart quotes can be toggled using the `'` option.
2016-06-02Org reader: drop unused field from parser stateAlbert Krewinkel2-18/+8
The `OrgParserState` contained both an `orgStateMeta` and `orgStateMeta'` field, the former for plain meta information and the latter for F-monad wrapped meta info. The plain meta info is only used to make `OrgParserState` an instance of the `HasMeta` class, which in turn is never used in the reader. The (F Meta) version is hence renamed to the "un-primed" version while the other one is dropped.
2016-06-02Org reader: undo code duplicationAlbert Krewinkel3-55/+83
Some code was duplicated (copy-pasted) or placed in an inappropriate module during the modularization refactoring. Those functions are moved into a `Shared` module, as was originally intended but forgotten. Better documentation of the respective functions is a positive side-effect.
2016-05-31Merge pull request #2950 from tarleb/org-ref-supportJohn MacFarlane2-7/+71
Org reader: support org-ref style citations
2016-05-29Org reader: support new syntax for export blocksAlbert Krewinkel1-0/+9
Org-mode version 9 usees a new syntax for export blocks. Instead of `#+BEGIN_<FORMAT>`, where `<FORMAT>` is the format of the block's content, the new format uses `#+BEGIN_export <FORMAT>` instead. Both types are supported.
2016-05-29Org reader: refactor BEGIN…END block parsingAlbert Krewinkel1-111/+131
- Reorder functions, grouping related functions together. - Demote simple functions to local functions if they are used just once. - Rename and document functions to increase code readability. - Fix handling of whitespace in blocks, allowing content to be indented less then the block header.
2016-05-29Org reader: rename `parseInlines` to `inlines`Albert Krewinkel2-10/+11
Having a function starting with `parse` in a parsing library is overly redundant. Let's use a nicer, shorter name more in line with the rest of the library.
2016-05-27Org reader: support org-ref style citationsAlbert Krewinkel2-7/+71
The *org-ref* package is an org-mode extension commonly used to manage citations in org documents. Basic support for the `cite:citeKey` and `[[cite:citeKey][prefix text::suffix text]]` syntax is added.
2016-05-25Org reader: extract blocks parser to moduleAlbert Krewinkel2-844/+900
Block parsing code is moved to a separate module. This is part of the Org-mode reader cleanup effort.
2016-05-25Org reader: extract inline parser to moduleAlbert Krewinkel4-756/+887
Inline parsing code is moved to a separate module. Parsers for block starts are extracted as well, as those are used in the `endline` parser. This is part of the Org-mode reader cleanup effort.
2016-05-25Org reader: extract parsing function to moduleAlbert Krewinkel3-78/+197
The Org-mode reader uses many functions defined in the `Text.Pandoc.Parsing` utility module. Some of the functions are overwritten with versions adapted to Org-mode idiosyncrasies. These special functions, as well as the normal Pandoc versions, are combined in a single module to increase the ease of use. This leads to decoupling of Org-mode and Pandoc and hence to slightly cleaner code. The downside is code-bloat due to repeated import/export statements.
2016-05-24EPUB Reader: normalise Link id as wellmb211-2/+4
2016-05-23Org reader: respect drawer export settingAlbert Krewinkel2-12/+79
The `d` export option can be used to control which drawers are exported and which are discarded. Basic support for this option is added here.
2016-05-22Org reader/writer: use CUSTOM_ID in propertiesAlbert Krewinkel1-3/+4
The `ID` property is reserved for internal use by Org-mode and should not be used. The `CUSTOM_ID` property is to be used instead, it is converted to the `ID` property for certain export format. The reader and writer erroneously used `ID`. This is corrected by using `CUSTOM_ID` where appropriate.
2016-05-21HTML reader: fixed bug in pClose.John MacFarlane1-1/+1
This caused exponential parsing behavior in documnets with unclosed tags in dl, dd, dt.
2016-05-20Org reader: add :PROPERTIES: drawer supportAlbert Krewinkel1-28/+56
Headers can have optional `:PROPERTIES:` drawers associated with them. These drawers contain key/value pairs like the header's `id`. The reader adds all listed pairs to the header's attributes; `id` and `class` attributes are handled specially to match the way `Attr` are defined. This also changes behavior of how drawers of unknown type are handled. Instead of including all unknown drawers, those are not read/exported, thereby matching current Emacs behavior. This closes #1877.
2016-05-19Merge pull request #2927 from tarleb/org-attr-htmlJohn MacFarlane2-84/+106
Org reader support for ATTR_HTML statements
2016-05-19Org reader: add support for ATTR_HTML attributesAlbert Krewinkel1-7/+28
Arbitrary key-value pairs can be added to some block types using a `#+ATTR_HTML` line before the block. Emacs Org-mode only includes these when exporting to HTML, but since we cannot make this distinction here, the attributes are always added. The functionality is now supported for figures. This closes #1906.
2016-05-19Org reader: use custom `anyLine`Albert Krewinkel1-3/+10
Additional state changes need to be made after a newline is parsed, otherwise markup may not be recognized correctly. This fixes a bug where markup after certain block-types would not be recognized. E.g. `/emph/` in the following snippet was not parsed as emphasized. foo # comment /emph/
2016-05-19Org reader: refactor block attribute handlingAlbert Krewinkel2-83/+77
A parser state attribute was used to keep track of block attributes defined in meta-lines. Global state is undesirable, so block attributes are no longer saved as part of the parser state. Old functions and the respective part of the parser state are removed.
2016-05-17EPUB reader: unescape URIs in spine.John MacFarlane1-2/+4
This should fix #2924. Testing on the epub that caused the problem originally would be welcome.
2016-05-12Merge pull request #2894 from sid-kap/rst-code-classJohn MacFarlane1-6/+8
Add class option for code block in RST reader
2016-05-11Org reader: parse but ignore export optionsAlbert Krewinkel1-2/+35
All known export options are parsed but ignored.
2016-05-11Org reader: add support for sub/superscript export optionsAlbert Krewinkel2-3/+57
Org-mode allows to specify export settings via `#+OPTIONS` lines. Disabling simple sub- and superscripts is one of these export options, this options is now supported.
2016-05-11Org reader: move parser state into separate moduleAlbert Krewinkel2-158/+232
The org reader code has become large and confusing. Extracting smaller parts into submodules should help to clean things up.
2016-05-09Merge pull request #2907 from tarleb/org-fixesJohn MacFarlane1-4/+9
Org fixes (reader and writer)
2016-05-09Org reader: fix inline-LaTeX regressionAlbert Krewinkel1-4/+9
The last fix for whitespace handling of inline LaTeX commands was incorrect, preventing correct recognition of inline LaTeX commands which contain spaces. This fix ensures that only trailing whitespace is cut off.
2016-05-09Allow spaces before '!' in MediaWiki table headerroblabla1-1/+1
2016-05-05Merge pull request #2898 from tarleb/org-table-refactoringJohn MacFarlane1-59/+59
Org reader: table parsing code refactoring and fixes
2016-05-04Org reader: fix spacing after LaTeX-style symbolsAlbert Krewinkel1-5/+7
The org-reader was droping space after unescaped LaTeX-style symbol commands: `\ForAll \Auml` resulted in `∀Ä` but should give `∀ Ä` instead. This seems to be because the LaTeX-reader treats the command-terminating space as part of the command. Dropping the trailing space from the symbol-command fixes this issue.
2016-05-04Org reader: fix handling of empty table cells, rowsAlbert Krewinkel1-13/+17
This fixes Org mode parsing of some corner cases regarding empty cells and rows. Empty cells weren't parsed correctly, e.g. `|||` should be two empty cells, but would be parsed as a single cell containing a pipe character. Empty rows where parsed as alignment rows and dropped from the output. This fixes #2616.
2016-05-04Org reader: refactor rows-to-table conversionAlbert Krewinkel1-25/+25
This refactores the codes conversing a list table lines to an org table ADT. The old code was simplified and is now slightly less ugly.
2016-05-04Org reader: stop padding short table rowsAlbert Krewinkel1-24/+20
Emacs Org-mode doesn't add any padding to table rows. The first row (header or first body row) is used to determine the column count, no other magic is performed. The org reader was padding rows to the length of the longest table row. This was done due to a misunderstanding of how Org handles tables. This feature reflected how Org-mode handles tables when pressing <TAB>. The Org exporter however, which is what the reader should implement, doesn't do any of this. So this was a mis-feature that made the reader more complex and reduced comparability. It was hence removed.
2016-05-01Add class option for code block in RST readerSidharth Kapur1-6/+8
According to http://docutils.sourceforge.net/docs/ref/rst/directives.html#code, the code directive supports the ":class:" option.
2016-05-01Binary fmts throw PandocError on zip-archive failJesse Rosenthal2-3/+7
Commit 91dc3342 made `readDocx` throw PandocError if there was an unarchiving error. This extends that fix to `readOdt` and `readEPUB`.
2016-05-01Docx Reader: Throw PandocError on unzip failureJesse Rosenthal1-4/+5
Previously, readDocx would error out if zip-archive failed. We change the archive extraction step from `toArchive` to `toArchiveOrFail`, which returns an Either value.
2016-04-26Ignore leading space in org code blocksEmanuel Evans1-4/+20
Fixes #2862 Also fix up tab handling for leading whitespace in code blocks.
2016-04-15Docx Reader: parse `moveTo` and `moveFrom`Jesse Rosenthal1-2/+2
`moveTo` and `moveFrom` are track-changes tags that are used when a block of text is moved in the document. We now recognize these tags and treat them the same as `insert` and `delete`, respectively. So, `--track-changes=accept` will show the moved version, while `--track-changes=reject` will show the original version.
2016-04-10Markdown reader: Fix pandoc title blocks with lines ending in 2 spaces.John MacFarlane1-19/+23
Closes #2799. Also added -s to markdown-reader-more test.
2016-04-10Markdown + HTML readers: be more forgiving about unescaped &.John MacFarlane1-10/+15
We are now more forgiving about parsing invalid HTML with unescaped `&` as raw HTML. (Previously any unescaped `&` would cause pandoc not to recognize the string as raw HTML.) Closes #2410.
2016-03-22Fixed bug in Markdown raw HTML parsing.John MacFarlane1-1/+1
This was a regression, with the rewrite of `htmlInBalanced` (from `Text.Pandoc.Readers.HTML`) in 1.17. It caused newlines to be omitted in raw HTML blocks. Closes #2804.
2016-03-18Docx reader: Handle alternate contentJesse Rosenthal1-14/+37
Some word functions -- especially graphics -- give various choices for content so there can be backwards compatibility. This follows the largely undocumented feature by working through the choices until we find one that works. Note that we had to split out the processing of child elems of runs into a separate function so we can recurse properly. Any processing of an element *within* a run (other than a plain run) should go into `childElemToRun`.
2016-03-16Docx reader: Don't make numbered heads into lists.Jesse Rosenthal1-6/+8
Word uses list numbering styles to number its headings. We only call something a numbered list if it does not also heave a heading style.
2016-03-12Add readDocxWithWarningsJesse Rosenthal1-6/+15
The regular readDocx just becomes a special case.
2016-03-12Docx Reader: Add state to the parser, for warningsJesse Rosenthal1-6/+19
In order to be able to collect warnings during parsing, we add a state monad transformer to the D monad. At the moment, this only includes a list of warning strings (nothing currently triggers them, however). We use StateT instead of WriterT to correspond more closely with the warnings behavior in T.P.Parsing.