aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Org
AgeCommit message (Collapse)AuthorFilesLines
2018-05-09Org reader: fix image filename recognitionAlbert Krewinkel1-6/+7
Use a function from the *filepath* library to check whether a string is a valid file name. The custom validity checker that was used before gave wrong results, e.g. for absolute file paths on Windows (kawabata/ox-pandoc#52).
2018-05-07Use Data.Maybe.fromMaybeAlexander Krotov1-6/+3
2018-03-18Removed unnecessary import.John MacFarlane1-2/+0
2018-03-18Use NoImplicitPrelude and explicitly import Prelude.John MacFarlane9-0/+18
This seems to be necessary if we are to use our custom Prelude with ghci. Closes #4464.
2018-03-16Monoid/Semiground cleanup relying on custom Prelude.John MacFarlane3-3/+0
2018-03-15Remove redundant import.John MacFarlane1-1/+1
2018-03-13Require pandoc-types 1.17.4.John MacFarlane2-2/+2
And a few tweaks related to the Semigroups/Monoid change. Closes #4448.
2018-02-21Org reader: allow changing emphasis syntaxAlbert Krewinkel3-11/+39
The characters allowed before and after emphasis can be configured via `#+pandoc-emphasis-pre` and `#+pandoc-emphasis-post`, respectively. This allows to change which strings are recognized as emphasized text on a per-document or even per-paragraph basis. The allowed characters must be given as (Haskell) string. #+pandoc-emphasis-pre: "-\t ('\"{" #+pandoc-emphasis-post: "-\t\n .,:!?;'\")}[" If the argument cannot be read as a string, the default value is restored. Closes: #4378
2018-01-19hlint code improvements.John MacFarlane1-1/+1
2018-01-05Update copyright notices to include 2018Albert Krewinkel9-18/+18
2017-12-28Org reader: support minlevel option for includesAlbert Krewinkel1-14/+37
The level of headers in included files can be shifted to a higher level by specifying a minimum header level via the `:minlevel` parameter. E.g. `#+include: "tour.org" :minlevel 1` will shift the headers in tour.org such that the topmost headers become level 1 headers. Fixes: #4154
2017-12-20Org reader: fix asterisks-related parsing errorAlbert Krewinkel1-1/+1
A parsing error was fixed which caused the org reader to fail when parsing a paragraph starting with two or more asterisks. Fixes: #4180
2017-11-22Org reader: allow empty list itemsAlbert Krewinkel2-45/+42
Fixes: #4090
2017-10-27Automatic reformating by stylish-haskell.John MacFarlane1-6/+5
2017-10-27Consistent underline for Readers (#2270)hftf1-2/+2
* Added underlineSpan builder function. This can be easily updated if needed. The purpose is for Readers to transform underlines consistently. * Docx Reader: Use underlineSpan and update test * Org Reader: Use underlineSpan and add test * Textile Reader: Use underlineSpan and add test case * Txt2Tags Reader: Use underlineSpan and update test * HTML Reader: Use underlineSpan and add test case
2017-10-08Org reader: end footnotes after two blank linesAlbert Krewinkel1-4/+5
Footnotes can not only be terminated by the start of a new footnote or a header, but also by two consecutive blank lines.
2017-10-02Org reader: support `\n` export optionAlbert Krewinkel3-2/+5
The `\n` export option turns all newlines in the text into hard linebreaks. Closes #3950
2017-09-25Org reader: update emphasis border charsAlbert Krewinkel1-3/+3
The org reader was updated to match current org-mode behavior: the set of characters which are acceptable to occur as the first or last character in an org emphasis have been changed and now allows all non-whitespace chars at the inner border of emphasized text (see `org-emphasis-regexp-components`). Fixes: #3933
2017-08-09Org reader: use org-language attribute rather than data-org-language.John MacFarlane1-1/+1
2017-08-09Org reader: use tag-name attribute instead of data-tag-name.John MacFarlane1-1/+1
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane2-2/+13
This rewrite is primarily motivated by the need to get macros working properly. A side benefit is that the reader is significantly faster (27s -> 19s in one benchmark, and there is a lot of room for further optimization). We now tokenize the input text, then parse the token stream. Macros modify the token stream, so they should now be effective in any context, including math. Thus, we no longer need the clunky macro processing capacities of texmath. A custom state LaTeXState is used instead of ParserState. This, plus the tokenization, will require some rewriting of the exported functions rawLaTeXInline, inlineCommand, rawLaTeXBlock. * Added Text.Pandoc.Readers.LaTeX.Types (new exported module). Exports Macro, Tok, TokType, Line, Column. [API change] * Text.Pandoc.Parsing: adjusted type of `insertIncludedFile` so it can be used with token parser. * Removed old texmath macro stuff from Parsing. Use Macro from Text.Pandoc.Readers.LaTeX.Types instead. * Removed texmath macro material from Markdown reader. * Changed types for Text.Pandoc.Readers.LaTeX's rawLaTeXInline and rawLaTeXBlock. (Both now return a String, and they are polymorphic in state.) * Added orgMacros field to OrgState. [API change] * Removed readerApplyMacros from ReaderOptions. Now we just check the `latex_macros` reader extension. * Allow `\newcommand\foo{blah}` without braces. Fixes #1390. Fixes #2118. Fixes #3236. Fixes #3779. Fixes #934. Fixes #982.
2017-06-03Improve code style in lua and org modulesAlbert Krewinkel5-26/+24
2017-06-03Org reader: apply hlint suggestionsAlbert Krewinkel7-89/+84
2017-05-31Org reader: respect export option for tagsAlbert Krewinkel3-2/+8
Tags are appended to headlines by default, but will be omitted when the `tags` export option is set to nil. Closes: #3713
2017-05-31Org reader: include tags in headlinesAlbert Krewinkel1-6/+16
The Emacs default is to include tags in the headline when exporting. Instead of just empty spans, which contain the tag name as attribute, tags are rendered as small caps and wrapped in those spans. Non-breaking spaces serve as separators for multiple tags.
2017-05-31Org reader: recognize babel result blocks with attributesAlbert Krewinkel2-22/+22
Babel result blocks can have block attributes like captions and names. Result blocks with attributes were not recognized and were parsed as normal blocks without attributes. Fixes: #3706
2017-05-31Org reader: fix module names in haddock commentsAlbert Krewinkel7-9/+8
Copy-pasting had lead to haddock module descriptions containing the wrong module names.
2017-05-28Org reader: Fix cite parsing behaviourHerwig Stuetz1-2/+10
Until now, org-ref cite keys included special characters also at the end. This caused problems when citations occur right before colons or at the end of a sentence. With this change, all non alphanumeric characters at the end of a cite key are ignored. This also adds `,` to the list of special characters that are legal in cite keys to better mirror the behaviour of org-export.
2017-05-28Parsing: `many1Till`: Check for the end condition before parsingHerwig Stuetz1-2/+2
By not checking for the end condition before the first parse, the parser was applied too often, consuming too much of the input. This fixes the behaviour of `testStringWith (many1Till (oneOf "ab") (string "aa")) "aaa"` which before incorrectly returned `Right "a"`. With this change, it instead correctly fails with `Left (PandocParsecError ...)` because it is not able to parse at least one occurence of `oneOf "ab"` that is not `"aa"`. Note that this only affects `many1Till p end` where `p` matches on a prefix of `end`.
2017-05-27Org reader: subject full doc tree to headline transformationsAlbert Krewinkel2-6/+37
Emacs parses org documents into a tree structure, which is then post-processed during exporting. The reader is changed to do the same, turning the document into a single tree of headlines starting at levelĀ 0. Fixes: #3695
2017-05-22Move indentWith to Text.Pandoc.Parsing (#3687)Alexander Krotov2-9/+1
2017-05-18Org reader: fix smart parsing behaviorAlbert Krewinkel2-10/+15
Parsing of smart quotes and special characters can either be enabled via the `smart` language extension or the `'` and `-` export options. Smart parsing is active if either the extension or export option is enabled. Only smart parsing of special characters (like ellipses and en and em dashes) is enabled by default, while smart quotes are disabled. This means that all smart parsing features will be enabled by adding the `smart` language extension. Fine-grained control is possible by leaving the language extension disabled. In that case, smart parsing is controlled via the aforementioned export OPTIONS only. Previously, all smart parsing was disabled unless the language extension was enabled.
2017-05-17Merge pull request #3677 from labdsf/anylinenewlineJohn MacFarlane2-4/+1
Move anyLineNewline to Parsing.hs
2017-05-17Move anyLineNewline to Parsing.hsAlexander Krotov2-4/+1
2017-05-16Org reader: replace `sequence . map` with `mapM`Albert Krewinkel2-3/+3
2017-05-16Org reader: put tree parsing code into dedicated moduleAlbert Krewinkel2-210/+262
2017-05-14Org reader: add basic file inclusion mechanismAlbert Krewinkel3-5/+43
Support for the `#+INCLUDE:` file inclusion mechanism was added. Recognized include types are *example*, *export*, *src*, and normal org file inclusion. Advanced features like line numbers and level selection are not implemented yet. Closes: #3510
2017-05-13Update dates in copyright noticesAlbert Krewinkel6-11/+11
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-12Replace `repeat' and `take' with `replicate' once moreAlexander Krotov1-1/+1
2017-05-06Drop redundant import of sortAlbert Krewinkel1-1/+1
This was left in accidentally.
2017-05-06Org reader: support macrosAlbert Krewinkel3-1/+65
Closes: #3401
2017-05-03Org reader: support table.el tablesAlbert Krewinkel3-8/+18
Closes #3314
2017-04-30Provide shared F monad functions for Markdown and Org readersAlbert Krewinkel2-38/+10
The `F` monads used for delayed evaluation of certain values in the Markdown and Org readers are based on a shared data type capturing the common pattern of both `F` types.
2017-04-30Add returnF to Text.Pandoc.ParsingAlexander Krotov2-3/+3
2017-04-30Org reader: Avoid creating nullMeta by applying setMeta directlyAlexander Krotov1-4/+1
2017-04-23Org reader: allow multi-word arguments to src block paramsAlbert Krewinkel1-2/+5
The reader now correctly parses src block parameter list even if parameter arguments contain multiple words. Closes: #3477
2017-04-23Org reader: stop adding rundoc prefix to src paramsAlbert Krewinkel3-39/+24
Source block parameter names are no longer prefixed with *rundoc*. This was intended to simplify working with the rundoc project, a babel runner. However, the rundoc project is unmaintained, and adding those markers is not the reader's job anyway. The original language that is specified for a source element is now retained as the `data-org-language` attribute and only added if it differs from the translated language.
2017-04-23Org reader: handle line numbering switch for src blocksAlbert Krewinkel1-13/+57
The line-numbering switch that can be given to source blocks (`-n` with an start number as an optional parameter) is parsed and translated to a class/key-value combination used by highlighting and other readers and writers.
2017-04-16Org reader: allow emphasized text to be followed by `[`Albert Krewinkel1-1/+1
Closes: #3577
2017-04-16Org reader: convert markup at beginning of footnotesAlbert Krewinkel1-1/+1
Closes: #3576