aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
AgeCommit message (Collapse)AuthorFilesLines
2016-07-14Haddock reader - support math.John MacFarlane1-0/+4
The Haddock document model added elements for math in 1.4.
2016-07-14Removed some redundant class constraints.John MacFarlane1-3/+3
2016-07-14Merge pull request #3019 from tarleb/org-verbatim-fixJohn MacFarlane1-2/+4
Org reader: fix parsing of verbatim inlines
2016-07-14Fixed exponential parsing bug in textile reader.John MacFarlane1-0/+1
Closes #3020.
2016-07-14Org reader: fix parsing of verbatim inlinesAlbert Krewinkel1-2/+4
Org rules for allowed characters before or after markup chars were not checked for verbatim text. This resultet in wrong parsing outcomes of if the verbatim text contained e.g. space enclosed markup characters as part of the text (`=is_substr = True=`). Forcing the parser to update the positions of allowed/forbidden markup border characters fixes this. This fixes #3016.
2016-07-04Org reader: replace ugly code with view patternAlbert Krewinkel1-5/+4
Some less-than-smart code required a pragma switching of overlapping pattern warnings in order to compile seamlessly. Using view patterns makes the code easier to read and also doesn't require overlapping pattern checks to be disabled.
2016-07-03Merge pull request #3010 from tarleb/org-header-treeJohn MacFarlane4-247/+386
Org reader: support archived trees, headline levels export setting
2016-07-03Odt reader: Removed redundant Monoid constraints.John MacFarlane1-7/+7
2016-07-03Org reader: support headline levels export settingAlbert Krewinkel3-8/+40
The depths of headlines can be modified using the `H` option. Deeper headlines will be converted to lists.
2016-07-02Org reader: put export setting parser into moduleAlbert Krewinkel3-191/+191
Export option parsing is distinct enough from general block parsing to justify putting it into a separate module.
2016-07-01LaTeX reader: strip off double quotes around image source if present.John MacFarlane1-1/+8
Avoids interpreting these as part of the literal filename. See #2825.
2016-07-01Org reader: support archived trees export optionsAlbert Krewinkel2-8/+62
Handling of archived trees can be modified using the `arch` option. Archived trees are either dropped, exported completely, or collapsed to include just the header when the `arch` option is nil, non-nil, or `headline`, respectively.
2016-07-01Org reader: refactor comment tree handlingAlbert Krewinkel2-39/+21
Comment trees were handled after parsing, as pattern matching on lists is easier than matching on sequences. The new method of reading documents as trees allows for more elegant subtree removal.
2016-07-01Org reader: parse as headlines, convert to blocksAlbert Krewinkel1-47/+86
Emacs org-mode is based on outline-mode, which treats documents as trees with headlines are nodes. The reader is refactored to parse into a similar tree structure. This simplifies transformations acting on document (sub-)trees.
2016-07-01Org reader: improve tag and properties type safetyAlbert Krewinkel1-25/+57
Specific newtype definitions are used to replace stringly typing of tags and properties. Type safety is increased while readability is improved.
2016-06-29LaTeX reader: fixed `\cite` so it is a NormalCitation not AuthorInText.John MacFarlane1-2/+2
2016-06-26Merge pull request #3001 from tarleb/org-figure-labelJohn MacFarlane1-1/+6
Org reader: support figure labels
2016-06-26Org reader: support figure labelsAlbert Krewinkel1-1/+6
Figure labels given as `#+LABEL: thelabel` are used as the ID of the respective image. This allows e.g. the LaTeX to add proper `\label` markup. This fixes half of #2496 and #2999.
2016-06-25Textile reader: Fix overly aggressive interpretation as images.John MacFarlane1-7/+4
Spaces are not allowed in the image URL in textile. Closes #2998.
2016-06-25Fixed RST links with no explicit link text.John MacFarlane1-1/+4
The link `<foo>`_ should have `foo` as both its link text and its URL. See RST spec at <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases> "The reference text may also be omitted, in which case the URI will be duplicated for use as the reference text. This is useful for relative URIs where the address or file name is also the desired reference text: See `<a_named_relative_link>`_ or `<an_anonymous_relative_link>`__ for details." Closes Debian #828167 -- reported by Christian Heller.
2016-06-23Textile reader: fixed attributes.John MacFarlane1-1/+3
Attributes can't be followed by a space. So, _(class)emph_ but _(noclass) emph_ Closes #2984.
2016-06-23Docx reader: Add warning for advanced comment formatting.Jesse Rosenthal1-2/+18
We can't guarantee we'll convert every comment correctly, though we'll do the best we can. This warns if the comment includes something other than Para or Plain.
2016-06-23docx reader: enable warnings in top-level readerJesse Rosenthal1-6/+10
Previously we had only allowed for warnings in the parser. Now we allow for them in the `Docx.hs` as well. The warnings are simply concatenated.
2016-06-23Docx reader: add simple comment functionality.Jesse Rosenthal2-1/+73
This adds simple track-changes comment parsing to the docx reader. It is turned on with `--track-changes=all`. All comments are converted to inlines, which can list some information. In the future a warning will be added for comments with formatting that seems like it will be excessively denatured. Note that comments can extend across blocks. For that reason there are two spans: `comment-start` and `comment-end`. `comment-start` will contain the comment. `comment-end` will always be empty. The two will be associated by a numeric id.
2016-06-21Org reader: remove partial functionsAlbert Krewinkel2-19/+21
Partial functions like `head` lead to avoidable errors and should be avoided. They are replaced with total functions. This fixes #2991.
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.